FastLED 3.10.6
Loading...
Searching...
No Matches

◆ readToken()

bool fl::istream_real::readToken ( string & token)
private

Definition at line 174 of file istream.cpp.hpp.

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

References fl::string::append(), fl::available(), fl::basic_string::clear(), fl::basic_string::empty(), mBuffer, mBufferLen, mFailed, mPos, readLine(), and skipWhitespace().

Referenced by operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), and operator>>().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: