Lines Matching refs:StringPiece
4 // Copied from strings/stringpiece.cc with modifications
23 bool operator==(const StringPiece& x, const StringPiece& y) {
27 return StringPiece::wordmemcmp(x.data(), y.data(), x.size()) == 0;
30 std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
36 void CopyToString(const StringPiece& self, std::string* target) {
40 void AppendToString(const StringPiece& self, std::string* target) {
45 StringPiece::size_type copy(const StringPiece& self,
47 StringPiece::size_type n,
48 StringPiece::size_type pos) {
49 StringPiece::size_type ret = std::min(self.size() - pos, n);
54 StringPiece::size_type find(const StringPiece& self,
55 const StringPiece& s,
56 StringPiece::size_type pos) {
58 return StringPiece::npos;
60 StringPiece::const_iterator result =
62 const StringPiece::size_type xpos =
64 return xpos + s.size() <= self.size() ? xpos : StringPiece::npos;
67 StringPiece::size_type find(const StringPiece& self,
69 StringPiece::size_type pos) {
71 return StringPiece::npos;
73 StringPiece::const_iterator result =
76 static_cast<size_t>(result - self.begin()) : StringPiece::npos;
79 StringPiece::size_type rfind(const StringPiece& self,
80 const StringPiece& s,
81 StringPiece::size_type pos) {
83 return StringPiece::npos;
88 StringPiece::const_iterator last =
90 StringPiece::const_iterator result =
93 static_cast<size_t>(result - self.begin()) : StringPiece::npos;
96 StringPiece::size_type rfind(const StringPiece& self,
98 StringPiece::size_type pos) {
100 return StringPiece::npos;
102 for (StringPiece::size_type i = std::min(pos, self.size() - 1); ; --i) {
108 return StringPiece::npos;
119 static inline void BuildLookupTable(const StringPiece& characters_wanted,
121 const StringPiece::size_type length = characters_wanted.length();
123 for (StringPiece::size_type i = 0; i < length; ++i) {
128 StringPiece::size_type find_first_of(const StringPiece& self,
129 const StringPiece& s,
130 StringPiece::size_type pos) {
132 return StringPiece::npos;
140 for (StringPiece::size_type i = pos; i < self.size(); ++i) {
145 return StringPiece::npos;
148 StringPiece::size_type find_first_not_of(const StringPiece& self,
149 const StringPiece& s,
150 StringPiece::size_type pos) {
152 return StringPiece::npos;
163 for (StringPiece::size_type i = pos; i < self.size(); ++i) {
168 return StringPiece::npos;
171 StringPiece::size_type find_first_not_of(const StringPiece& self,
173 StringPiece::size_type pos) {
175 return StringPiece::npos;
182 return StringPiece::npos;
185 StringPiece::size_type find_last_of(const StringPiece& self,
186 const StringPiece& s,
187 StringPiece::size_type pos) {
189 return StringPiece::npos;
197 for (StringPiece::size_type i = std::min(pos, self.size() - 1); ; --i) {
203 return StringPiece::npos;
206 StringPiece::size_type find_last_not_of(const StringPiece& self,
207 const StringPiece& s,
208 StringPiece::size_type pos) {
210 return StringPiece::npos;
212 StringPiece::size_type i = std::min(pos, self.size() - 1);
228 return StringPiece::npos;
231 StringPiece::size_type find_last_not_of(const StringPiece& self,
233 StringPiece::size_type pos) {
235 return StringPiece::npos;
237 for (StringPiece::size_type i = std::min(pos, self.size() - 1); ; --i) {
243 return StringPiece::npos;
246 StringPiece substr(const StringPiece& self,
247 StringPiece::size_type pos,
248 StringPiece::size_type n) {
251 return StringPiece(self.data() + pos, n);