MCPcopy Create free account
hub / github.com/catboost/catboost / Next

Method Next

util/stream/tokenizer.h:108–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 }
107
108 inline bool Next(char*& buf, size_t& len) {
109 char* it = Cur_;
110
111 while (true) {
112 do {
113 while (it != End_) {
114 if (Eot_(*it)) {
115 *it = '\0';
116
117 buf = Cur_;
118 len = it - Cur_;
119 Cur_ = it + 1;
120
121 return true;
122 } else {
123 ++it;
124 }
125 }
126
127 if (Fill() == 0 && End_ != BufEnd()) {
128 *it = '\0';
129
130 buf = Cur_;
131 len = it - Cur_;
132 Cur_ = End_;
133
134 return len;
135 }
136 } while (it != BufEnd());
137
138 Y_ASSERT(it == BufEnd());
139 Y_ASSERT(End_ == BufEnd());
140
141 const size_t blen = End_ - Cur_;
142 if (Cur_ == BufBegin()) {
143 Y_ASSERT(blen == Buf_.Capacity());
144
145 /*
146 * do reallocate
147 */
148
149 Buf_.Reserve(Buf_.Capacity() * 4);
150 CheckBuf();
151 } else {
152 /*
153 * do move
154 */
155
156 MemMove(BufBegin(), Cur_, blen);
157 }
158
159 Cur_ = BufBegin();
160 End_ = Cur_ + blen;
161 it = End_;
162 }
163 }
164
165 inline TIterator begin() {

Callers 2

TIteratorMethod · 0.45
NextMethod · 0.45

Calls 4

MemMoveFunction · 0.85
FillFunction · 0.50
CapacityMethod · 0.45
ReserveMethod · 0.45

Tested by

no test coverage detected