14 #ifndef LLVM_ADT_SMALLSTRING_H 15 #define LLVM_ADT_SMALLSTRING_H 17 #include "llvm/SmallVector.h" 18 #include "llvm/StringRef.h" 24 template<
unsigned InternalLen>
34 template<
typename ItTy>
45 void assign(
size_t NumElts,
char Elt) {
50 template<
typename in_iter>
73 template<
typename in_iter>
78 void append(
size_t NumInputs,
char Elt) {
147 size_t find(
char C,
size_t From = 0)
const {
163 size_t rfind(
char C,
size_t From = StringRef::npos)
const {
214 StringRef Chars,
size_t From = StringRef::npos)
const {
270 const char* c_str() {
286 this->
append(RHS.begin(), RHS.end());
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Definition: SmallString.h:260
int compare_lower(StringRef RHS) const
compare_lower - Compare two strings, ignoring case.
Definition: StringRef.cpp:52
void assign(StringRef RHS)
Assign from a StringRef.
Definition: SmallString.h:57
SmallString(ItTy S, ItTy E)
Initialize with a range.
Definition: SmallString.h:35
size_t find(StringRef Str, size_t From=0) const
Search for the first string Str in the string.
Definition: SmallString.h:155
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Definition: StringRef.h:266
void append(const SmallVectorImpl< char > &RHS)
Append from a SmallVector.
Definition: SmallString.h:89
bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition: StringRef.h:250
bool equals_lower(StringRef RHS) const
Check for string equality, ignoring case.
Definition: SmallString.h:104
size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
Definition: StringRef.h:286
StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:419
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
Definition: SmallString.h:121
size_t find_last_of(char C, size_t From=StringRef::npos) const
Find the last character in the string that is C, or npos if not found.
Definition: SmallString.h:205
int compare(StringRef RHS) const
Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than...
Definition: SmallString.h:110
StringRef substr(size_t Start, size_t N=StringRef::npos) const
Return a reference to the substring from [Start, Start + N).
Definition: SmallString.h:246
int compare(StringRef RHS) const
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less tha...
Definition: StringRef.h:195
size_t rfind(StringRef Str) const
Search for the last string Str in the string.
Definition: SmallString.h:171
size_t count(char C) const
Return the number of occurrences of C in the string.
Definition: SmallString.h:223
size_t find_first_not_of(StringRef 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:199
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: WindowsSupport.h:184
void assign(const SmallVectorImpl< char > &RHS)
Assign from a SmallVector.
Definition: SmallString.h:63
bool equals(StringRef RHS) const
Check for string equality.
Definition: SmallString.h:99
size_t rfind(char C, size_t From=StringRef::npos) const
Search for the last character C in the string.
Definition: SmallString.h:163
SmallString(StringRef S)
Initialize from a StringRef.
Definition: SmallString.h:31
int compare_lower(StringRef RHS) const
compare_lower - Compare two strings, ignoring case.
Definition: SmallString.h:115
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
void append(in_iter S, in_iter E)
Append from an iterator pair.
Definition: SmallString.h:74
size_t find_last_of(StringRef Chars, size_t From=StringRef::npos) const
Find the last character in the string that is in C, or npos if not found.
Definition: SmallString.h:213
size_t count(StringRef Str) const
Return the number of non-overlapped occurrences of Str in the string.
Definition: SmallString.h:229
void append(StringRef RHS)
Append from a StringRef.
Definition: SmallString.h:84
size_t count(char C) const
Return the number of occurrences of C in the string.
Definition: StringRef.h:352
SmallString()
Default ctor - Initialize to empty.
Definition: SmallString.h:28
size_t find(char C, size_t From=0) const
find - Search for the first character C in the string.
Definition: SmallString.h:147
bool startswith(StringRef Prefix) const
startswith - Check if this string starts with the given Prefix.
Definition: SmallString.h:130
void assign(size_t NumElts, char Elt)
Assign from a repeated element.
Definition: SmallString.h:45
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:382
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: StringRef.cpp:223
size_t find_last_of(char C, size_t From=npos) const
Find the last character in the string that is C, or npos if not found.
Definition: StringRef.h:327
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:241
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:834
bool endswith(StringRef Suffix) const
endswith - Check if this string ends with the given Suffix.
Definition: SmallString.h:135
StringRef str() const
Explicit conversion to StringRef.
Definition: SmallString.h:267
bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
Definition: StringRef.h:183
size_t find_first_of(StringRef 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:185
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:134
bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
Definition: StringRef.h:189
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:191
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: StringRef.h:305
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
Definition: StringRef.cpp:73
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:42
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Definition: StringRef.h:449
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:177
void assign(in_iter S, in_iter E)
Assign from an iterator pair.
Definition: SmallString.h:51