ITstream.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2025 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ITstream
29 
30 Description
31  An input stream of tokens.
32 
33  Although ITstream is principally meant to be used as a read-only
34  input stream, it also provides additional methods to help when
35  composing its contents (eg, when parsing).
36 
37 SourceFiles
38  ITstream.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_ITstream_H
43 #define Foam_ITstream_H
44 
45 #include "Istream.H"
46 #include "tokenList.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class ITstream Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class ITstream
58 :
59  public Istream,
60  public tokenList
61 {
62  // Private Data
63 
64  //- Name associated with the stream
65  fileName name_;
66 
67  //- Index of token currently being read
68  label tokenIndex_;
69 
70 
71  // Private Member Functions
72 
73  //- An ad hoc combination of reserve and setCapacity somewhat
74  //- similar to DynamicList.
75  //
76  // Increase list size if needed,
77  // but leave any excess capacity (ie, like reserve).
78  void reserveCapacity(const label newCapacity);
79 
80  //- Convert input sequence into a list of tokens,
81  static tokenList parse_chars
82  (
83  const char* s,
84  size_t nbytes,
85  IOstreamOption streamOpt
86  );
87 
88  //- Convert input sequence into a list of tokens,
89  //- using the existing stream format. Rewinds the stream
90  void reset(const char* input, size_t nbytes);
91 
92  //- Failsafe read-access to token at specified location
93  //- or undefinedToken
94  inline const token& peekNoFail(const label i) const noexcept
95  {
96  return
97  (
98  (i >= 0 && i < tokenList::size())
99  ? tokenList::cdata()[i]
101  );
102  }
103 
104 
105 public:
106 
107  // Constructors
108 
109  //- Copy construct
110  ITstream(const ITstream& is);
111 
112  //- Move construct
113  ITstream(ITstream&& is);
114 
115  //- Default construct. Empty stream, optionally with given name
116  explicit ITstream
117  (
118  IOstreamOption streamOpt = IOstreamOption(),
119  const string& name = "input"
120  );
121 
122  //- Construct empty, optionally with given name
123  explicit ITstream
124  (
125  Foam::zero,
126  const string& name = "input",
127  IOstreamOption streamOpt = IOstreamOption()
128  );
129 
130  //- Copy construct from tokens, optionally with given name
131  explicit ITstream
132  (
133  const UList<token>& tokens,
134  IOstreamOption streamOpt = IOstreamOption(),
135  const string& name = "input"
136  );
137 
138  //- Move construct from tokens, optionally with given name
139  explicit ITstream
140  (
142  IOstreamOption streamOpt = IOstreamOption(),
143  const string& name = "input"
144  );
145 
146  //- Construct token list by parsing the input character sequence
147  // Uses static parse function internally.
148  explicit ITstream
149  (
150  const UList<char>& input,
151  IOstreamOption streamOpt = IOstreamOption(),
152  const string& name = "input"
153  );
154 
155  //- Construct token list by parsing the input character sequence
156  // Uses static parse function internally.
157  explicit ITstream
158  (
159  const char* input,
160  IOstreamOption streamOpt = IOstreamOption(),
161  const string& name = "input"
162  );
163 
164  //- Construct token list by parsing the input character sequence
165  // Uses static parse function internally.
166  explicit ITstream
167  (
168  std::string_view s,
169  IOstreamOption streamOpt = IOstreamOption(),
170  const string& name = "input"
171  )
172  :
173  ITstream(streamOpt, name)
174  {
175  reset(s.data(), s.size());
176  }
177 
178  //- Construct token list by parsing the input character sequence
179  // Uses static parse function internally.
180  explicit ITstream
181  (
183  IOstreamOption streamOpt = IOstreamOption()
184  )
185  :
186  ITstream(streamOpt)
187  {
188  reset(s.data(), s.size());
189  }
190 
191  //- Construct token list by parsing the input character sequence
192  // Uses static parse function internally.
193  explicit ITstream
194  (
197  )
198  :
199  ITstream(streamOpt)
200  {
201  reset(s.data(), s.size());
202  }
203 
204 
205  // Additional constructors
206 
207  //- Copy construct from tokens, with given name
208  ITstream
209  (
210  const string& name,
211  const UList<token>& tokens,
212  IOstreamOption streamOpt = IOstreamOption()
213  )
214  :
215  ITstream(tokens, streamOpt, name)
216  {}
217 
218  //- Move construct from tokens, with given name
219  ITstream
220  (
221  const string& name,
223  IOstreamOption streamOpt = IOstreamOption()
224  )
225  :
226  ITstream(std::move(tokens), streamOpt, name)
227  {}
228 
230  //- Destructor
231  virtual ~ITstream() = default;
232 
233 
234  // Static Functions
235 
236  //- Return reference to an empty ITstream, for functions needing to
237  //- return an ITstream reference but which don't have anything valid
238  //- of their own. <b>The stream shall be considered \em read-only.</b>
239  //
240  // The returned stream has no tokens and has a 'bad' state,
241  // to indicate that it is invalid for reading.
242  //
243  // \caution the caller is still able to modify its contents,
244  // but they should not do that!
245  static ITstream& empty_stream();
247  //- Create token list by parsing the input character sequence
248  //- until no good tokens remain.
249  static tokenList parse
250  (
251  const UList<char>& input,
252  IOstreamOption streamOpt = IOstreamOption()
253  )
254  {
255  return parse_chars(input.cdata(), input.size(), streamOpt);
256  }
257 
258  //- Create token list by parsing the input string
259  //- until no good tokens remain.
260  static tokenList parse
261  (
262  const std::string& input,
263  IOstreamOption streamOpt = IOstreamOption()
264  )
265  {
266  return parse_chars(input.data(), input.size(), streamOpt);
267  }
268 
269  //- Create token list by parsing the input character sequence
270  //- until no good tokens remain.
271  static tokenList parse
272  (
273  const char* input,
274  IOstreamOption streamOpt = IOstreamOption()
275  )
276  {
277  return parse_chars(input, strlen(input), streamOpt);
278  }
279 
280  //- Create token list by parsing the input character sequence
281  //- until no good tokens remain.
282  static tokenList parse
283  (
284  std::string_view s,
285  IOstreamOption streamOpt = IOstreamOption()
286  )
287  {
288  return parse_chars(s.data(), s.size(), streamOpt);
289  }
290 
291  //- Create token list by parsing the input character sequence
292  //- until no good tokens remain.
293  static tokenList parse
294  (
297  )
298  {
299  return parse_chars(s.data(), s.size(), streamOpt);
300  }
301 
302  //- Create token list by parsing the input character sequence
303  //- until no good tokens remain.
304  static tokenList parse
305  (
307  IOstreamOption streamOpt = IOstreamOption()
308  )
309  {
310  return parse_chars(s.data(), s.size(), streamOpt);
311  }
312 
313 
314  // Member Functions
315 
316  // Characteristics
317 
318  //- The name of the input token stream.
319  virtual const fileName& name() const override { return name_; }
320 
321  //- The name of the input token stream, for modification.
322  virtual fileName& name() { return name_; }
323 
324  //- The line number of the first token in stream
325  label startLineNumber() const
326  {
327  return (tokenList::empty() ? -1 : tokenList::front().lineNumber());
328  }
329 
330  //- The line number of the last token in stream
331  label endLineNumber() const
332  {
333  return (tokenList::empty() ? -1 : tokenList::back().lineNumber());
334  }
336 
337  // Token Access
338 
339  //- The token contents (read-only access)
340  const tokenList& tokens() const noexcept { return *this; }
341 
342  //- The token contents (read/write access)
343  tokenList& tokens() noexcept { return *this; }
344 
345 
346  //- True if putback token is in use
347  bool hasPutback() const noexcept { return Istream::hasPutback(); }
349  //- Failsafe peek at the token at the \b front of the tokenList
350  // \return \c undefinedToken if the list is empty.
351  const token& front() const noexcept
352  {
353  return peekNoFail(0);
354  }
355 
356  //- Failsafe peek at the token at the \b back of the tokenList
357  // \return \c undefinedToken if the list is empty.
358  const token& back() const noexcept
359  {
360  return peekNoFail(tokenList::size()-1);
361  }
362 
363  //- Failsafe peek at what the next read would return,
364  //- including handling of any putback
365  // \return \c undefinedToken if list is exhausted
366  const token& peek() const noexcept;
367 
368  //- Read access to the token at the current tokenIndex.
369  //- \returns \c undefinedToken if list is exhausted
370  const token& currentToken() const noexcept
371  {
372  return peekNoFail(tokenIndex_);
373  }
374 
375  //- Write access to the token at the current tokenIndex.
376  //- Fatal if not in range
378 
379  //- Failsafe read access to token at given position in the tokenList
380  // \return \c undefinedToken for out-of-range
381  const token& peekToken(const label i) const { return peekNoFail(i); };
383  //- The current token index when reading, or the insertion point.
384  label tokenIndex() const noexcept { return tokenIndex_; }
385 
386  //- Non-const access to the current token index
387  label& tokenIndex() noexcept { return tokenIndex_; }
388 
389  //- Set the token index (no checks). \return the previous value
390  label tokenIndex(const label num) noexcept
391  {
392  label old(tokenIndex_);
393  tokenIndex_ = num;
394  return old;
395  }
396 
397  //- Number of tokens remaining
398  label nRemainingTokens() const noexcept
399  {
400  return (tokenList::size() - tokenIndex_);
401  }
402 
403  //- Move tokenIndex to the specified position
404  //- and adjust the stream status (open/good/eof ...)
405  // Using seek(0) is identical to rewind().
406  // Using seek(-1) moves to the end.
407  void seek(label pos) noexcept;
408 
409  //- Move tokenIndex relative to the current position.
410  // Will not overrun the beginning (0) or one-past end positions.
411  //
412  // Use skip(2) to move forward two tokens.
413  // Use skip(-2) to move backward two tokens.
414  // \return True if the indexing completed without underflow/overflow
415  bool skip(label n = 1) noexcept;
416 
418  // Searching
419 
420  //- Regular searching
421  using tokenList::find;
422 
423  //- Find range containing matching delimiter pair, starting at the
424  //- specified position. The position -1 indicates to continue
425  //- from the present tokenIndex() position.
427  (
428  const token::punctuationToken delimOpen,
429  const token::punctuationToken delimClose,
430  label pos = 0
431  ) const;
432 
433  //- Find compoundToken of specified Type, starting at the
434  //- specified position. The position -1 indicates to continue
435  //- from the present tokenIndex() position.
436  // \return nullptr if not found
437  template<class Type>
438  const Type* findCompound(label pos = 0) const;
439 
440 
441  // Token list modification
442 
443  //- Remove a (start,size) subset from the list and move remaining
444  //- elements down.
445  // If the tokenIndex() is within or to the right of the removed
446  // region, it will be adjusted to remain valid. However, this may
447  // not correspond to the expected parsing point so external bookkeeping
448  // is likely necessary.
449  // \note The range is subsetted with the list size itself to ensure
450  // the result always addresses a valid section of the list.
452 
453  //- Remove a (start,size) subset from the list and move remaining
454  //- elements down.
455  // If the tokenIndex() is within or to the right of the removed
456  // region, it will be adjusted to remain valid. However, this may
457  // not correspond to the expected parsing point so external bookkeeping
458  // is likely necessary.
459  // \note The range is subsetted with the list size itself to ensure
460  // the result always addresses a valid section of the list.
461  label remove(const labelRange& range);
462 
463  //- Copy append a token at the current tokenIndex,
464  //- incrementing the index.
465  void add_tokens(const token& tok);
466 
467  //- Move append a token at the current tokenIndex,
468  //- incrementing the index.
469  void add_tokens(token&& tok);
470 
471  //- Copy append a list of tokens at the current tokenIndex,
472  //- incrementing the index.
473  void add_tokens(const UList<token>& toks);
474 
475  //- Move append a list of tokens at the current tokenIndex,
476  //- incrementing the index.
477  void add_tokens(List<token>&& toks);
478 
479 
480  // Stream State Functions
481 
482  //- Return current stream flags.
483  //- Dummy for token stream, returns 0.
484  virtual std::ios_base::fmtflags flags() const override
485  {
486  return std::ios_base::fmtflags(0);
487  }
488 
489  //- Set stream flags, return old stream flags.
490  //- Dummy for token stream, returns 0.
491  std::ios_base::fmtflags flags(std::ios_base::fmtflags) override
492  {
493  return std::ios_base::fmtflags(0);
494  }
495 
496 
497  // Read Functions
498 
499  //- Return next token from stream
500  virtual Istream& read(token& tok) override;
501 
502  //- Read a character : triggers not implemented error
503  virtual Istream& read(char&) override;
504 
505  //- Read a word : triggers not implemented error
506  virtual Istream& read(word&) override;
507 
508  //- Read a string (including enclosing double-quotes) :
509  //- triggers not implemented error
510  virtual Istream& read(string&) override;
511 
512  //- Read a label : triggers not implemented error
513  virtual Istream& read(label&) override;
514 
515  //- Read a float : triggers not implemented error
516  virtual Istream& read(float&) override;
517 
518  //- Read a double : triggers not implemented error
519  virtual Istream& read(double&) override;
520 
521  //- Read binary block : triggers not implemented error
522  virtual Istream& read(char* data, std::streamsize) override;
523 
524  //- Low-level raw binary read : triggers not implemented error
525  virtual Istream& readRaw(char* data, std::streamsize count) override;
526 
527  //- Start of low-level raw binary read : no-op
528  virtual bool beginRawRead() override { return false; }
529 
530  //- End of low-level raw binary read : no-op
531  virtual bool endRawRead() override { return false; }
532 
533  //- Rewind the stream so that it may be read again. Same as seek(0)
534  virtual void rewind() override { ITstream::seek(0); }
535 
536 
537  // Output
538 
539  //- Print stream description to Ostream
540  void print(Ostream& os) const override;
541 
542  //- Concatenate tokens into a space-separated std::string.
543  //- The resulting string may contain quote characters.
544  std::string toString() const;
545 
546 
547  // Member Operators
548 
549  //- Return a non-const reference to const Istream
550  using Istream::operator();
551 
552  //- Copy assignment, with rewind()
553  void operator=(const ITstream& is);
554 
555  //- Copy assignment of tokens, with rewind()
556  void operator=(const UList<token>& toks);
557 
558  //- Move assignment of tokens, with rewind()
559  void operator=(List<token>&& toks);
560 
561 
562  // Additional constructors and methods (as per v2012 and earlier)
563  #ifdef Foam_IOstream_extras
564 
565  //- Construct from components, copying the tokens
566  ITstream
567  (
568  const string& name,
569  const UList<token>& tokens,
571  )
572  :
574  {}
575 
576  //- Construct from components, transferring the tokens
577  ITstream
578  (
579  const string& name,
580  List<token>&& tokens,
582  )
583  :
584  ITstream(name, std::move(tokens), IOstreamOption(fmt))
585  {}
586 
587  #endif /* Foam_IOstream_extras */
588 
589 
590  // Housekeeping
591 
592  //- Same as front()
593  FOAM_DEPRECATED_STRICT(2022-11, "front()")
594  const token& peekFirst() const { return front(); }
595 
596  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
597  void append(const token& t, bool) { add_tokens(t); }
598 
599  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
600  void append(token&& t, bool) { add_tokens(std::move(t)); }
601 
602  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
603  void append(const UList<token>& t, bool) { add_tokens(t); }
604 
605  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
606  void append(List<token>&& t, bool) { add_tokens(std::move(t)); }
608  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
609  void push_back(const token& t, bool) { add_tokens(t); }
610 
611  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
612  void push_back(token&& t, bool) { add_tokens(std::move(t)); }
613 
614  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
615  void push_back(const UList<token>& t, bool) { add_tokens(t); }
617  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
618  void push_back(List<token>&& t, bool) { add_tokens(std::move(t)); }
619 };
620 
621 
622 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
623 
624 } // End namespace Foam
625 
626 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
627 
628 #include "ITstreamI.H"
629 
630 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
631 
632 #endif
633 
634 // ************************************************************************* //
virtual bool beginRawRead() override
Start of low-level raw binary read : no-op.
Definition: ITstream.H:673
void add_tokens(const token &tok)
Copy append a token at the current tokenIndex, incrementing the index.
Definition: ITstream.C:674
static const token undefinedToken
An undefined token.
Definition: token.H:557
A class for handling file names.
Definition: fileName.H:72
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
label endLineNumber() const
The line number of the last token in stream.
Definition: ITstream.H:395
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:52
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool empty() const noexcept
True if List is empty (ie, size() is zero)
Definition: UList.H:697
A token holds an item read from Istream.
Definition: token.H:65
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Definition: UListI.H:265
T & front()
Access first element of the list, position [0].
Definition: UListI.H:230
label remove(const labelRange &range)
Remove a (start,size) subset from the list and move remaining elements down.
Definition: ITstream.C:559
const token & front() const noexcept
Failsafe peek at the token at the front of the tokenList.
Definition: ITstream.H:424
A simple container for options an IOstream can normally have.
std::string toString() const
Concatenate tokens into a space-separated std::string. The resulting string may contain quote charact...
Definition: ITstream.C:275
label startLineNumber() const
The line number of the first token in stream.
Definition: ITstream.H:387
label tokenIndex() const noexcept
The current token index when reading, or the insertion point.
Definition: ITstream.H:472
label nRemainingTokens() const noexcept
Number of tokens remaining.
Definition: ITstream.H:492
List< token > tokenList
List of token, used for dictionary primitive entry (for example)
Definition: tokenList.H:32
scalar range
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
dimensionedScalar pos(const dimensionedScalar &ds)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
virtual Istream & read(token &tok) override
Return next token from stream.
Definition: ITstream.C:418
virtual Istream & readRaw(char *data, std::streamsize count) override
Low-level raw binary read : triggers not implemented error.
Definition: ITstream.C:660
A class for handling words, derived from Foam::string.
Definition: word.H:63
const tokenList & tokens() const noexcept
The token contents (read-only access)
Definition: ITstream.H:406
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
bool hasPutback() const noexcept
True if putback token is in use.
Definition: ITstream.H:417
const token & peekFirst() const
Same as front()
Definition: ITstream.H:761
void push_back(const token &t, bool)
Definition: ITstream.H:776
const token & currentToken() const noexcept
Read access to the token at the current tokenIndex.
Definition: ITstream.H:451
#define FOAM_DEPRECATED_STRICT(since, replacement)
Definition: stdFoam.H:53
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
void append(const token &t, bool)
Definition: ITstream.H:764
const direction noexcept
Definition: scalarImpl.H:255
virtual const fileName & name() const override
The name of the input token stream.
Definition: ITstream.H:377
label size() const noexcept
The number of elements in the container.
Definition: UList.H:702
OBJstream os(runTime.globalPath()/outputName)
label lineNumber() const noexcept
Const access to the current stream line number.
Definition: IOstream.H:390
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
Definition: ITstream.H:296
const Type * findCompound(label pos=0) const
Find compoundToken of specified Type, starting at the specified position. The position -1 indicates t...
Definition: ITstreamI.H:22
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
Definition: UListI.H:28
limits reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL))
const token & peek() const noexcept
Failsafe peek at what the next read would return, including handling of any putback.
Definition: ITstream.C:313
virtual ~ITstream()=default
Destructor.
bool hasPutback() const noexcept
True if putback token is in use.
Definition: Istream.H:81
labelRange find(const token::punctuationToken delimOpen, const token::punctuationToken delimClose, label pos=0) const
Find range containing matching delimiter pair, starting at the specified position. The position -1 indicates to continue from the present tokenIndex() position.
Definition: ITstream.C:471
streamFormat
Data format (ascii | binary)
T & back()
Access last element of the list, position [size()-1].
Definition: UListI.H:244
Rudimentary functionality similar to std::span for holding memory view.
Definition: stdFoam.H:365
static ITstream & empty_stream()
Return reference to an empty ITstream, for functions needing to return an ITstream reference but whic...
Definition: ITstream.C:63
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
label n
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
Definition: UListI.H:258
void print(Ostream &os) const override
Print stream description to Ostream.
Definition: ITstream.C:250
bool skip(label n=1) noexcept
Move tokenIndex relative to the current position.
Definition: ITstream.C:371
virtual bool endRawRead() override
End of low-level raw binary read : no-op.
Definition: ITstream.H:678
ITstream(const ITstream &is)
Copy construct.
Definition: ITstream.C:137
void operator=(const ITstream &is)
Copy assignment, with rewind()
Definition: ITstream.C:715
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
constexpr List() noexcept
Default construct.
Definition: ListI.H:116
void seek(label pos) noexcept
Move tokenIndex to the specified position and adjust the stream status (open/good/eof ...
Definition: ITstream.C:339
const token & back() const noexcept
Failsafe peek at the token at the back of the tokenList.
Definition: ITstream.H:434
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for token stream, returns 0.
Definition: ITstream.H:607
An input stream of tokens.
Definition: ITstream.H:52
Namespace for OpenFOAM.
virtual void rewind() override
Rewind the stream so that it may be read again. Same as seek(0)
Definition: ITstream.H:683
const token & peekToken(const label i) const
Failsafe read access to token at given position in the tokenList.
Definition: ITstream.H:467
ITstream extract(const labelRange &range)
Remove a (start,size) subset from the list and move remaining elements down.
Definition: ITstream.C:524