Lines Matching refs:StringView

22 class StringView {
41 StringView() : Data(nullptr), Len(0) {} in StringView() function
45 explicit StringView(const char *Str) : Data(Str), Len(0) { in StringView() function
54 explicit StringView(const char *Str, size_t N) in StringView() function
59 StringView(const char (&Str)[N]) : StringView(Str, N - 1) {} in StringView() function
83 int compare(StringView Other) const { in compare()
94 bool equals(StringView Other) const { in equals()
99 inline bool operator==(StringView Other) const { return equals(Other); }
100 inline bool operator!=(StringView Other) const { return !(*this == Other); }
101 inline bool operator<(StringView Other) const { return compare(Other) == -1; }
102 inline bool operator<=(StringView Other) const { return compare(Other) != 1; }
103 inline bool operator>(StringView Other) const { return compare(Other) == 1; }
104 inline bool operator>=(StringView Other) const {
120 StringView trim(const char C) const { in trim()
121 StringView Copy = *this; in trim()
130 bool starts_with(StringView Prefix) const { in starts_with()
146 bool ends_with(StringView Suffix) const { in ends_with()
160 StringView substr(size_t Start, size_t N = npos) const {
162 return StringView(Data + Start, min(N, Len - Start));
170 StringView S = drop_front(From);
184 StringView S = drop_back(size() - End);
198 StringView S = drop_front(From);
222 StringView drop_front(size_t N = 1) const { return substr(N); }
226 StringView drop_back(size_t N = 1) const { return substr(0, size() - N); }
231 StringView take_front(size_t N = 1) const {
240 StringView take_back(size_t N = 1) const {
248 template <typename F> StringView take_while(F Function) const { in take_while()
254 template <typename F> StringView take_until(F Function) const { in take_until()
260 template <typename F> StringView drop_while(F Function) const { in drop_while()
266 template <typename F> StringView drop_until(F Function) const { in drop_until()
272 bool consume_front(StringView Prefix) { in consume_front()
282 bool consume_back(StringView Suffix) { in consume_back()