FastLED 3.10.8
Loading...
Searching...
No Matches

◆ readToken()

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

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

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

References fl::available(), fl::FL_NO_EXCEPT, mBuffer, mBufferLen, mFailed, mPos, fl::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: