Home | History | Annotate | Download | only in ADT

Lines Matching refs:Length

35   /// array and a length, which need not be null terminated.
52 /// The length of the string.
53 size_t Length;
58 static int compareMemory(const char *Lhs, const char *Rhs, size_t Length) {
59 if (Length == 0) { return 0; }
60 return ::memcmp(Lhs,Rhs,Length);
68 /*implicit*/ StringRef() : Data(nullptr), Length(0) {}
74 Length = ::strlen(Str); // invoking strlen(NULL) is undefined behavior
77 /// Construct a string ref from a pointer and length.
79 /*implicit*/ StringRef(const char *data, size_t length)
80 : Data(data), Length(length) {
81 assert((data || length == 0) &&
82 "StringRef cannot be built from a NULL argument with non-null length");
88 : Data(Str.data()), Length(Str.length()) {}
96 iterator end() const { return Data + Length; }
116 bool empty() const { return Length == 0; }
120 size_t size() const { return Length; }
131 return Data[Length-1];
136 char *S = A.template Allocate<char>(Length);
138 return StringRef(S, Length);
145 return (Length == RHS.Length &&
146 compareMemory(Data, RHS.Data, RHS.Length) == 0);
151 return Length == RHS.Length && compare_lower(RHS) == 0;
159 if (int Res = compareMemory(Data, RHS.Data, std::min(Length, RHS.Length)))
163 if (Length == RHS.Length)
165 return Length < RHS.Length ? -1 : 1;
199 return std::string(Data, Length);
207 assert(Index < Length && "Invalid index!");
226 return Length >= Prefix.Length &&
227 compareMemory(Data, Prefix.Data, Prefix.Length) == 0;
236 return Length >= Suffix.Length &&
237 compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0;
253 size_t FindBegin = std::min(From, Length);
254 if (FindBegin < Length) { // Avoid calling memchr with nullptr.
256 if (const void *P = ::memchr(Data + FindBegin, C, Length - FindBegin))
273 From = std::min(From, Length);
340 for (size_t i = 0, e = Length; i != e; ++i)
411 /// the index is npos or greater than the length of the string then the
419 Start = std::min(Start, Length);
420 return StringRef(Data + Start, std::min(N, Length - Start));
442 /// the index is npos or greater than the length of the string then the
451 Start = std::min(Start, Length);
452 End = std::min(std::max(Start, End), Length);
545 return drop_front(std::min(Length, find_first_not_of(Chars)));
551 return drop_back(Length - std::min(Length, find_last_not_of(Chars) + 1));