#include <string_ref.hh>
Inherited by LPadded, and RPadded.
Detailed Description
convenient datatype for referencing character data
- Note:
- it is not in general safe to store a StringRef as it does not guarantee that the character data it points to stays alive.
Definition at line 39 of file string_ref.hh.
Member Typedef Documentation
Constructor & Destructor Documentation
Member Function Documentation
const char* begin |
( |
| ) |
const |
|
inline |
const char* data |
( |
| ) |
const |
|
inline |
const char* end |
( |
| ) |
const |
|
inline |
find character in StringRef
- Returns:
- iterator position when found, else iterator pointing to the end
Definition at line 65 of file string_ref.hh.
strip space characters on the left
Definition at line 122 of file string_ref.hh.
bool operator!= |
( |
const StringRef & |
rhs | ) |
const |
|
inline |
bool operator== |
( |
const StringRef & |
rhs | ) |
const |
|
inline |
const char& operator[] |
( |
int |
index | ) |
const |
|
inline |
strip space characters on the right
Definition at line 115 of file string_ref.hh.
split string into chunks delimited by p
split string into chunks delimited by whitespace
std::string str |
( |
| ) |
const |
|
inline |
std::string str_no_whitespace |
( |
| ) |
const |
returns a new string with all whitespace removed from this StringRef
StringRef substr |
( |
size_t |
pos, |
|
|
size_t |
n = std::string::npos |
|
) |
| const |
|
inline |
returns a substring of the string
- Parameters:
-
pos | the starting position of the substring |
length | is the length of the string. if std::string::npos, the substring goes from pos to the end of the string The function does on purpose not perform any boundary check in release mode. It's the duty of the caller to make sure the string has the required length. |
Definition at line 84 of file string_ref.hh.
std::pair<bool, float> to_float |
( |
| ) |
const |
convert to float
- Returns:
- a tuple with
first
set to true and second
set to the float if the conversion succeeds. If the conversion fails, first
is set to false.
std::pair<bool, int> to_int |
( |
| ) |
const |
convert to integer
- Returns:
- a tuple with
first
set to true and second
set to the int if the conversion succeeds. If the conversion fails, first
is set to false.
strip space characters on the left and the right
Definition at line 130 of file string_ref.hh.
The documentation for this class was generated from the following file: