14#ifndef WPIUTIL_WPI_SMALLSTRING_H
15#define WPIUTIL_WPI_SMALLSTRING_H
26template<
unsigned InternalLen>
42 template<
typename ItTy>
57 void assign(std::initializer_list<std::string_view> Refs) {
74 void append(std::initializer_list<std::string_view> Refs) {
75 size_t CurrentSize = this->
size();
76 size_t SizeNeeded = CurrentSize;
78 SizeNeeded += Ref.size();
81 std::copy(Ref.begin(), Ref.end(), this->begin() + CurrentSize);
82 CurrentSize += Ref.size();
84 assert(CurrentSize == this->
size());
94 return str().compare(RHS);
105 size_t find(
char C,
size_t From = 0)
const {
106 return str().find(C, From);
114 return str().find(Str, From);
121 size_t rfind(
char C,
size_t From = std::string_view::npos)
const {
122 return str().rfind(C, From);
130 return str().rfind(Str);
136 return str().find_first_of(C, From);
144 return str().find_first_of(Chars, From);
150 return str().find_first_not_of(C, From);
158 return str().find_first_not_of(Chars, From);
163 size_t find_last_of(
char C,
size_t From = std::string_view::npos)
const {
164 return str().find_last_of(C, From);
173 return str().find_last_of(Chars, From);
193 explicit operator std::string()
const {
194 return std::string(this->
data(), this->
size());
204 this->
append(RHS.begin(), RHS.end());
This file defines the SmallVector class.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:27
size_t find_first_not_of(char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
Definition: SmallString.h:149
size_t find_last_of(std::string_view Chars, size_t From=std::string_view::npos) const
Find the last character in the string that is in C, or npos if not found.
Definition: SmallString.h:171
size_t find_first_of(std::string_view Chars, size_t From=0) const
Find the first character in the string that is in Chars, or npos if not found.
Definition: SmallString.h:143
size_t rfind(char C, size_t From=std::string_view::npos) const
Search for the last character C in the string.
Definition: SmallString.h:121
size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
Definition: SmallString.h:135
void assign(std::initializer_list< std::string_view > Refs)
Assign from a list of std::string_views.
Definition: SmallString.h:57
std::string_view str() const
Explicit conversion to std::string_view.
Definition: SmallString.h:181
size_t find_first_not_of(std::string_view Chars, size_t From=0) const
Find the first character in the string that is not in the string Chars, or npos if not found.
Definition: SmallString.h:157
size_t find(char C, size_t From=0) const
find - Search for the first character C in the string.
Definition: SmallString.h:105
SmallString(ItTy S, ItTy E)
Initialize with a range.
Definition: SmallString.h:43
const char * c_str()
Definition: SmallString.h:184
size_t find_last_of(char C, size_t From=std::string_view::npos) const
Find the last character in the string that is C, or npos if not found.
Definition: SmallString.h:163
void append(std::string_view RHS)
Append from a std::string_view.
Definition: SmallString.h:69
size_t rfind(std::string_view Str) const
Search for the last string Str in the string.
Definition: SmallString.h:129
void assign(std::string_view RHS)
Assign from a std::string_view.
Definition: SmallString.h:52
void append(std::initializer_list< std::string_view > Refs)
Append from a list of std::string_views.
Definition: SmallString.h:74
SmallString & operator=(std::string_view RHS)
Definition: SmallString.h:198
size_t find(std::string_view Str, size_t From=0) const
Search for the first string Str in the string.
Definition: SmallString.h:113
SmallString(std::string_view S)
Initialize from a std::string_view.
Definition: SmallString.h:33
SmallString & operator+=(std::string_view RHS)
Definition: SmallString.h:203
SmallString()=default
Default ctor - Initialize to empty.
SmallString(std::initializer_list< std::string_view > Refs)
Initialize by concatenating a list of std::string_views.
Definition: SmallString.h:36
int compare(std::string_view RHS) const
Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than,...
Definition: SmallString.h:93
SmallString & operator+=(char C)
Definition: SmallString.h:207
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1202
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
Definition: SmallVector.h:647
void clear()
Definition: SmallVector.h:616
void assign(size_type NumElts, ValueParamT Elt)
Definition: SmallVector.h:710
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:689
void pop_back()
Definition: SmallVector.h:430
void push_back(const char &Elt)
Definition: SmallVector.h:418
size_t size() const
Definition: SmallVector.h:98
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:291
iterator begin()
Definition: SmallVector.h:272
iterator end()
Definition: SmallVector.h:274
basic_string_view< char > string_view
Definition: core.h:501
auto copy(const Range &range, OutputIt out) -> OutputIt
Definition: ranges.h:26
Definition: ntcore_cpp.h:26
#define S(label, offset, message)
Definition: Errors.h:119