|
| String (char const *s) noexcept |
| Initialize from a zero-terminated string.
|
|
| String (char const *s, unsigned long len) noexcept |
| Initialize from a pointer to first character and a length.
|
|
| String (char const *s, char const *e) noexcept |
| Initialize with start and end pointer.
|
|
| String () |
| Zero-initialize. Create an invalid string.
|
|
Index | start () const |
| Pointer to first character.
|
|
Index | end () const |
| Pointer to first byte behind the string.
|
|
int | len () const |
| Length.
|
|
void | start (char const *s) |
| Set start.
|
|
void | len (unsigned long len) |
| Set length.
|
|
bool | empty () const |
| Check if the string has length zero.
|
|
String | head (Index end) const |
| Return prefix up to index.
|
|
String | head (unsigned long end) const |
| Prefix of length end .
|
|
String | substr (unsigned long idx, unsigned long len=~0UL) const |
| Substring of length len starting at idx .
|
|
String | substr (char const *start, unsigned long len=0) const |
| Substring of length len starting at start .
|
|
template<typename F > |
char const * | find_match (F &&match) const |
| Find matching character. match should be a function such as isspace .
|
|
char const * | find (char const *c) const |
| Find character. Return end() if not found.
|
|
char const * | find (int c) const |
| Find character. Return end() if not found.
|
|
char const * | rfind (char const *c) const |
| Find right-most character. Return end() if not found.
|
|
Index | starts_with (cxx::String const &c) const |
| Check if c is a prefix of string.
|
|
char const * | find (int c, char const *s) const |
| Find character c starting at position s . Return end() if not found.
|
|
char const * | find (char const *c, char const *s) const |
| Find character set at position.
|
|
char const & | operator[] (unsigned long idx) const |
| Get character at idx .
|
|
char const & | operator[] (int idx) const |
| Get character at idx .
|
|
char const & | operator[] (Index idx) const |
| Get character at idx .
|
|
bool | eof (char const *s) const |
| Check if pointer s points behind string.
|
|
template<typename INT > |
int | from_dec (INT *v) const |
| Convert decimal string to integer.
|
|
template<typename INT > |
int | from_hex (INT *v) const |
| Convert hex string to integer.
|
|
bool | operator== (String const &o) const |
| Equality.
|
|
bool | operator!= (String const &o) const |
| Inequality.
|
|
Allocation free string class with explicit length field.
This class is used to group characters of a string which belong to one syntactical token types number, identifier, string, whitespace or another single character.
Stings in this class can contain null bytes and may denote parts of other strings.
- Examples
- tmpfs/lib/src/fs.cc.
Definition at line 41 of file string.