Lines Matching refs:pos

50 StringPiece::StringPiece(StringPiece x, stringpiece_ssize_type pos)
51 : ptr_(x.ptr_ + pos), length_(x.length_ - pos) {
52 GOOGLE_DCHECK_LE(0, pos);
53 GOOGLE_DCHECK_LE(pos, x.length_);
57 stringpiece_ssize_type pos,
59 : ptr_(x.ptr_ + pos), length_(std::min(len, x.length_ - pos)) {
60 GOOGLE_DCHECK_LE(0, pos);
61 GOOGLE_DCHECK_LE(pos, x.length_);
92 size_type pos) const {
93 stringpiece_ssize_type ret = std::min(length_ - pos, n);
94 memcpy(buf, ptr_ + pos, ret);
102 stringpiece_ssize_type StringPiece::find(StringPiece s, size_type pos) const {
103 if (length_ <= 0 || pos > static_cast<size_type>(length_)) {
104 if (length_ == 0 && pos == 0 && s.length_ == 0) return 0;
107 const char *result = std::search(ptr_ + pos, ptr_ + length_,
112 stringpiece_ssize_type StringPiece::find(char c, size_type pos) const {
113 if (length_ <= 0 || pos >= static_cast<size_type>(length_)) {
117 memchr(ptr_ + pos, c, length_ - pos));
121 stringpiece_ssize_type StringPiece::rfind(StringPiece s, size_type pos) const {
124 if (s.length_ == 0) return std::min(ulen, pos);
126 const char* last = ptr_ + std::min(ulen - s.length_, pos) + s.length_;
131 // Search range is [0..pos] inclusive. If pos == npos, search everything.
132 stringpiece_ssize_type StringPiece::rfind(char c, size_type pos) const {
136 std::min(pos, static_cast<size_type>(length_ - 1));
163 size_type pos) const {
168 if (s.length_ == 1) return find_first_of(s.ptr_[0], pos);
172 for (stringpiece_ssize_type i = pos; i < length_; ++i) {
181 size_type pos) const {
185 if (s.length_ == 1) return find_first_not_of(s.ptr_[0], pos);
189 for (stringpiece_ssize_type i = pos; i < length_; ++i) {
198 size_type pos) const {
201 for (; pos < static_cast<size_type>(length_); ++pos) {
202 if (ptr_[pos] != c) {
203 return pos;
210 size_type pos) const {
213 if (s.length_ == 1) return find_last_of(s.ptr_[0], pos);
218 std::min(pos, static_cast<size_type>(length_ - 1)); i >= 0; --i) {
227 size_type pos) const {
230 stringpiece_ssize_type i = std::min(pos, static_cast<size_type>(length_ - 1));
234 if (s.length_ == 1) return find_last_not_of(s.ptr_[0], pos);
247 size_type pos) const {
251 std::min(pos, static_cast<size_type>(length_ - 1)); i >= 0; --i) {
259 StringPiece StringPiece::substr(size_type pos, size_type n) const {
260 if (pos > length_) pos = length_;
261 if (n > length_ - pos) n = length_ - pos;
262 return StringPiece(ptr_ + pos, n);