|
LLVM OpenMP
|
kmp_str_ref is a non-owning string class (similar to llvm::StringRef). More...
#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/openmp/runtime/src/kmp_adt.h"
Public Member Functions | |
| kmp_str_ref (const char *str) | |
| kmp_str_ref (const char *str, size_t len) | |
| kmp_str_ref (const kmp_str_ref &other)=default | |
| kmp_str_ref & | operator= (const kmp_str_ref &other)=default |
| bool | consume_front (kmp_str_ref prefix) |
| Check if the string starts with the given prefix and remove it from the string afterwards. | |
| bool | 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. | |
| char * | copy () const |
| Get an own duplicate of the string. | |
| template<typename Fn> | |
| size_t | count_while (const Fn &predicate) const |
| Count the number of characters in the string while the predicate returns true. | |
| void | drop_front (size_t n) |
| Drop the first n characters from the string. | |
| 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 |
| Return the index of the first character in the string for which the predicate returns true. | |
| template<typename Fn> | |
| size_t | find_if_not (const Fn &predicate) const |
| Return the index of the first character in the string for which the predicate returns false. | |
| size_t | length () const |
| Get the length of the string. | |
| size_t | size () const |
| void | skip_space () |
| Drop space from the start of the string. | |
| template<typename Fn> | |
| kmp_str_ref | take_while (const Fn &predicate) const |
| Construct a new string with the longest prefix of the original string that satisfies the predicate. | |
| const char * | begin () const |
| Iterator support (raw pointers work as iterators for contiguous storage) | |
| const char * | end () const |
Static Public Attributes | |
| static constexpr size_t | npos = SIZE_MAX |
kmp_str_ref is a non-owning string class (similar to llvm::StringRef).
|
inline |
Definition at line 38 of file kmp_adt.h.
Referenced by consume_front(), consume_integer(), kmp_str_ref(), operator=(), and take_while().
|
inline |
|
default |
References kmp_str_ref().
|
inline |
|
inline |
Check if the string starts with the given prefix and remove it from the string afterwards.
Definition at line 48 of file kmp_adt.h.
References drop_front(), empty(), and kmp_str_ref().
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.
References __kmp_basic_str_to_int(), consume_front(), count_while(), drop_front(), kmp_str_ref(), and value.
| 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.
References KMP_FATAL, and KMP_INTERNAL_MALLOC.
|
inline |
Count the number of characters in the string while the predicate returns true.
Definition at line 71 of file kmp_adt.h.
References find_if_not(), and npos.
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 80 of file kmp_adt.h.
Referenced by consume_front(), consume_integer(), and drop_while().
|
inline |
Drop characters from the string while the predicate returns true.
Definition at line 88 of file kmp_adt.h.
References count_while(), and drop_front().
Referenced by skip_space().
|
inline |
Check if the string is empty.
Definition at line 95 of file kmp_adt.h.
Referenced by consume_front().
|
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 100 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 112 of file kmp_adt.h.
References find_if().
Referenced by count_while().
|
inline |
|
default |
References kmp_str_ref().
|
inline |
|
inline |
Drop space from the start of the string.
Definition at line 123 of file kmp_adt.h.
References drop_while().
|
inline |
Construct a new string with the longest prefix of the original string that satisfies the predicate.
Doesn't modify the original string.
Definition at line 131 of file kmp_adt.h.
References count_while(), and kmp_str_ref().
|
staticconstexpr |
Definition at line 36 of file kmp_adt.h.
Referenced by count_while(), and find_if().