Lines Matching defs:pos
52 StringPiece::StringPiece(StringPiece x, stringpiece_ssize_type pos)
53 : ptr_(x.ptr_ + pos), length_(x.length_ - pos) {
54 GOOGLE_DCHECK_LE(0, pos);
55 GOOGLE_DCHECK_LE(pos, x.length_);
59 stringpiece_ssize_type pos,
61 : ptr_(x.ptr_ + pos), length_(std::min(len, x.length_ - pos)) {
62 GOOGLE_DCHECK_LE(0, pos);
63 GOOGLE_DCHECK_LE(pos, x.length_);
94 size_type pos) const {
95 stringpiece_ssize_type ret = std::min(length_ - pos, n);
96 memcpy(buf, ptr_ + pos, ret);
104 stringpiece_ssize_type StringPiece::find(StringPiece s, size_type pos) const {
105 if (length_ <= 0 || pos > static_cast<size_type>(length_)) {
106 if (length_ == 0 && pos == 0 && s.length_ == 0) return 0;
109 const char *result = std::search(ptr_ + pos, ptr_ + length_,
114 stringpiece_ssize_type StringPiece::find(char c, size_type pos) const {
115 if (length_ <= 0 || pos >= static_cast<size_type>(length_)) {
119 memchr(ptr_ + pos, c, length_ - pos));
123 stringpiece_ssize_type StringPiece::rfind(StringPiece s, size_type pos) const {
126 if (s.length_ == 0) return std::min(ulen, pos);
128 const char* last = ptr_ + std::min(ulen - s.length_, pos) + s.length_;
133 // Search range is [0..pos] inclusive. If pos == npos, search everything.
134 stringpiece_ssize_type StringPiece::rfind(char c, size_type pos) const {
138 std::min(pos, static_cast<size_type>(length_ - 1));
165 size_type pos) const {
170 if (s.length_ == 1) return find_first_of(s.ptr_[0], pos);
174 for (stringpiece_ssize_type i = pos; i < length_; ++i) {
183 size_type pos) const {
187 if (s.length_ == 1) return find_first_not_of(s.ptr_[0], pos);
191 for (stringpiece_ssize_type i = pos; i < length_; ++i) {
200 size_type pos) const {
203 for (; pos < static_cast<size_type>(length_); ++pos) {
204 if (ptr_[pos] != c) {
205 return pos;
212 size_type pos) const {
215 if (s.length_ == 1) return find_last_of(s.ptr_[0], pos);
220 std::min(pos, static_cast<size_type>(length_ - 1)); i >= 0; --i) {
229 size_type pos) const {
232 stringpiece_ssize_type i = std::min(pos, static_cast<size_type>(length_ - 1));
236 if (s.length_ == 1) return find_last_not_of(s.ptr_[0], pos);
249 size_type pos) const {
253 std::min(pos, static_cast<size_type>(length_ - 1)); i >= 0; --i) {
261 StringPiece StringPiece::substr(size_type pos, size_type n) const {
262 if (pos > length_) pos = length_;
263 if (n > length_ - pos) n = length_ - pos;
264 return StringPiece(ptr_ + pos, n);