MCPcopy Create free account
hub / github.com/FastLED/FastLED / readToken

Method readToken

src/fl/stl/istream.cpp.hpp:173–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173bool istream_real::readToken(string& token) {
174 skipWhitespace();
175
176 if (mPos >= mBufferLen && fl::available() == 0) {
177 mFailed = true;
178 return false;
179 }
180
181 // If buffer is empty but data is available, read a line
182 if (mPos >= mBufferLen && fl::available() > 0) {
183 if (!readLine()) {
184 mFailed = true;
185 return false;
186 }
187 skipWhitespace();
188 }
189
190 // Read until whitespace or end of buffer
191 token.clear();
192 while (mPos < mBufferLen &&
193 mBuffer[mPos] != ' ' && mBuffer[mPos] != '\t' &&
194 mBuffer[mPos] != '\n' && mBuffer[mPos] != '\r') {
195 // Explicitly append as a character string to avoid fl::u8->number conversion
196 char ch[2] = {mBuffer[mPos], '\0'};
197 token.append(ch, 1);
198 mPos++;
199 }
200
201 return !token.empty();
202}
203
204istream_real& istream_real::operator>>(string& str) {
205 if (!readToken(str)) {

Callers

nothing calls this directly

Calls 5

readLineFunction · 0.85
availableFunction · 0.70
clearMethod · 0.45
appendMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected