|
LLVM OpenMP* Runtime Library
|
kmp_str_ref is a non-owning string class (similar to llvm::StringRef). More...
#include <kmp_adt.h>
Public Member Functions | |
| bool | consume_front (kmp_str_ref prefix) |
| bool | consume_integer (int &value, bool allow_zero=true, bool allow_negative=false) |
| char * | copy () const |
| template<typename Fn > | |
| size_t | count_while (const Fn &predicate) const |
| void | drop_front (size_t n) |
| template<typename Fn > | |
| void | drop_while (const Fn &predicate) |
| Drop characters from the string while the predicate returns true. | |
| bool | empty () const |
| Check if the string is empty. | |
| template<typename Fn > | |
| size_t | find_if (const Fn &predicate) const |
| template<typename Fn > | |
| size_t | find_if_not (const Fn &predicate) const |
| size_t | length () const |
| Get the length of the string. | |
| void | skip_space () |
| Drop space from the start of the string. | |
| template<typename Fn > | |
| kmp_str_ref | take_while (const Fn &predicate) const |
| const char * | begin () const |
| Iterator support (raw pointers work as iterators for contiguous storage) | |
kmp_str_ref is a non-owning string class (similar to llvm::StringRef).
|
inline |
Check if the string starts with the given prefix and remove it from the string afterwards.
Definition at line 51 of file kmp_adt.h.
Referenced by consume_integer().
| bool kmp_str_ref::consume_integer | ( | int & | value, |
| bool | allow_zero = true, |
||
| bool | allow_negative = false |
||
| ) |
Start consuming an integer from the start of the string and remove it from the string afterwards. The maximum integer value that can currently be parsed is INT_MAX - 1.
Definition at line 27 of file kmp_adt.cpp.
| char * kmp_str_ref::copy | ( | ) | const |
Get an own duplicate of the string. Must be freed with KMP_INTERNAL_FREE().
Definition at line 56 of file kmp_adt.cpp.
|
inline |
Count the number of characters in the string while the predicate returns true.
Definition at line 74 of file kmp_adt.h.
Referenced by consume_integer(), drop_while(), and take_while().
|
inline |
Drop the first n characters from the string. (Limit n to the length of the string.)
Definition at line 83 of file kmp_adt.h.
Referenced by consume_front(), consume_integer(), and drop_while().
|
inline |
Return the index of the first character in the string for which the predicate returns true. Returns npos if no match is found.
Definition at line 103 of file kmp_adt.h.
Referenced by find_if_not().
|
inline |
Return the index of the first character in the string for which the predicate returns false. Returns npos if no match is found.
Definition at line 115 of file kmp_adt.h.
Referenced by count_while().
|
inline |