MCPcopy Create free account
hub / github.com/Kitware/VTK / Read

Method Read

IO/Geometry/vtkOpenFOAMReader.cxx:2255–2600  ·  view source on GitHub ↗

the tokenizer returns true if success, false if encountered EOF

Source from the content-addressed store, hash-verified

2253 // the tokenizer
2254 // returns true if success, false if encountered EOF
2255 bool Read(vtkFoamToken& token)
2256 {
2257 token.SetStreamOption(this->GetStreamOption());
2258 const bool use64BitLabels = this->IsLabel64();
2259
2260 // expanded the outermost loop in nextTokenHead() for performance
2261 int c;
2262 while (isspace(c = this->Getc())) // isspace() accepts -1 as EOF
2263 {
2264 if (c == '\n')
2265 {
2266 ++this->Superclass::LineNumber;
2267#if VTK_FOAMFILE_RECOGNIZE_LINEHEAD
2268 this->Superclass::WasNewline = true;
2269#endif
2270 }
2271 }
2272 if (c == '/')
2273 {
2274 this->PutBack(c);
2275 c = this->NextTokenHead();
2276 }
2277#if VTK_FOAMFILE_RECOGNIZE_LINEHEAD
2278 if (c != '#')
2279 {
2280 this->Superclass::WasNewline = false;
2281 }
2282#endif
2283
2284 constexpr int MAXLEN = 1024;
2285 char buf[MAXLEN + 1];
2286 int charI = 0;
2287 switch (c)
2288 {
2289 case '(':
2290 case ')':
2291 // high-priority punctuation token
2292 token = static_cast<char>(c);
2293 return true;
2294 case '1':
2295 case '2':
2296 case '3':
2297 case '4':
2298 case '5':
2299 case '6':
2300 case '7':
2301 case '8':
2302 case '9':
2303 case '0':
2304 case '-':
2305 // undetermined number token
2306 do
2307 {
2308 buf[charI++] = static_cast<unsigned char>(c);
2309 } while (isdigit(c = this->Getc()) && charI < MAXLEN);
2310 if (c != '.' && c != 'e' && c != 'E' && charI < MAXLEN && c != EOF)
2311 {
2312 // label token

Callers 1

ReadExpectingMethod · 0.95

Calls 15

GetcMethod · 0.95
PutBackMethod · 0.95
NextTokenHeadMethod · 0.95
ThrowStackTraceMethod · 0.95
StackStringMethod · 0.95
IncludeFileMethod · 0.95
ExpandPathMethod · 0.95
InflateNextMethod · 0.95
from_charsFunction · 0.85
ExtractPathFunction · 0.85
SetBadMethod · 0.80

Tested by

no test coverage detected