-
- //! Read line, also considers multi-line syntax (when last line symbol is slash).
- bool ReadLine()
- {
- int64_t aPosPrev = this->Position;
- char* aLine = &Line.ChangeFirst();
- for (; ::feof (this->File) == 0 && ::fgets (aLine, MaxLineLen - 1, this->File) != NULL; )
- {
- const int64_t aPosNew = ::ftell64 (this->File);
- if (aLine[0] == '#')
- {
- Position = aPosNew;
- return true;
- }
-
- const Standard_Integer aNbRead = Standard_Integer(aPosNew - aPosPrev);
- bool toReadMore = false;
- for (int aTailIter = aNbRead - 1; aTailIter >= 0; --aTailIter)
- {
- if (aLine[aTailIter] != '\n'
- && aLine[aTailIter] != '\r'
- && aLine[aTailIter] != '\0')
- {
- if (aLine[aTailIter] == '\\')
- {
- // multi-line syntax
- aLine[aTailIter] = ' ';
- const ptrdiff_t aFullLen = aLine + aTailIter + 1 - &this->Line.First();
- if (LineBuffLen < aFullLen + MaxLineLen)
- {
- LineBuffLen += MaxLineLen;
- this->Line.Resize (0, LineBuffLen - 1, true);
- }
- aLine = &this->Line.ChangeFirst() + aFullLen;
- toReadMore = true;
- break;
- }
- break;
- }
- }
-
- if (toReadMore)
- {
- aPosPrev = aPosNew;
- continue;
- }
-
- Position = aPosNew;
- return true;
- }
- return false;
- }
-