FastLED 3.9.15
Loading...
Searching...
No Matches

◆ readToken()

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

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

173 {
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 }
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}
fl::size mBufferLen
Definition istream.h:26
fl::size mPos
Definition istream.h:27
char mBuffer[BUFFER_SIZE]
Definition istream.h:25
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: