token.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-2019 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::token
29 
30 Description
31  A token holds an item read from Istream.
32 
33 SourceFiles
34  tokenI.H
35  token.C
36  tokenIO.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef token_H
41 #define token_H
42 
43 #include "label.H"
44 #include "uLabel.H"
45 #include "scalar.H"
46 #include "word.H"
47 #include "InfoProxy.H"
48 #include "refCount.H"
49 #include "typeInfo.H"
50 
51 #define NoHashTableC
52 #include "runTimeSelectionTables.H"
53 
54 #include <iostream>
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 // Forward Declarations
62 class token;
63 Ostream& operator<<(Ostream& os, const token& tok);
64 
65 
66 /*---------------------------------------------------------------------------*\
67  Class token Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class token
71 {
72 public:
73 
74  //- Enumeration defining the types of token.
75  // Since these values are also used to tag content in Pstream,
76  // the maximum number of types is limited to 30.
77  enum tokenType
78  {
79  UNDEFINED = 0,
80 
81  // Fundamental types
82  FLAG,
84  BOOL,
88 
89  // Pointer types
90  WORD,
94  COMPOUND,
95 
96  ERROR
97  };
98 
99 
100  //- Stream or output control flags (1-byte width)
101  enum flagType
102  {
103  NO_FLAG = 0,
104  ASCII = 1,
105  BINARY = 2
106  };
107 
108 
109  //- Standard punctuation tokens (a character)
110  enum punctuationToken : char
111  {
112  NULL_TOKEN = '\0',
113  SPACE = ' ',
114  TAB = '\t',
115  NL = '\n',
116 
118  BEGIN_LIST = '(',
119  END_LIST = ')',
120  BEGIN_SQR = '[',
121  END_SQR = ']',
122  BEGIN_BLOCK = '{',
123  END_BLOCK = '}',
124  COLON = ':',
125  COMMA = ',',
126  HASH = '#',
127  DOLLAR = '$',
128  ATSYM = '@',
129  SQUOTE = '\'',
130  DQUOTE = '"',
131 
132  ASSIGN = '=',
133  ADD = '+',
134  SUBTRACT = '-',
135  MULTIPLY = '*',
136  DIVIDE = '/',
137 
139  END_STRING = DQUOTE
140  };
141 
142 
143  //- Abstract base class for complex tokens
144  class compound
145  :
146  public refCount
147  {
148  bool empty_;
149 
150  //- No copy construct
151  compound(const compound&) = delete;
152 
153  //- No copy assignment
154  compound& operator=(const compound&) = delete;
155 
156  public:
157 
158  //- Runtime type information
159  TypeName("compound");
160 
161  //- Declare run-time constructor selection table
163  (
164  autoPtr,
165  compound,
166  Istream,
167  (Istream& is),
168  (is)
169  );
170 
171 
172  // Constructors
173 
174  //- Construct null
175  compound()
176  :
177  empty_(false)
178  {}
179 
180 
181  // Selectors
182 
183  //- Select null constructed
184  static autoPtr<compound> New(const word& type, Istream& is);
185 
186  //- Return true if name is a known (registered) compound type
187  static bool isCompound(const word& name);
188 
189 
190  //- Destructor
191  virtual ~compound() = default;
192 
193 
194  // Member Functions
195 
196  bool empty() const
197  {
198  return empty_;
199  }
200 
201  bool& empty()
202  {
203  return empty_;
204  }
205 
206  virtual label size() const = 0;
207 
208  virtual void write(Ostream& os) const = 0;
209 
210 
211  // Operators
212 
213  //- Output operator
214  friend Ostream& operator<<(Ostream& os, const compound& ct);
215  };
216 
217 
218  //- A templated class for holding compound tokens
219  template<class T>
220  class Compound
221  :
222  public token::compound,
223  public T
224  {
225  public:
226 
227  //- Runtime type information
228  TypeName("Compound<T>");
229 
230  Compound(Istream& is)
231  :
232  T(is)
233  {}
234 
235  label size() const
236  {
237  return T::size();
238  }
239 
240  void write(Ostream& os) const
241  {
242  operator<<(os, static_cast<const T&>(*this));
243  }
244  };
245 
246 
247  //- An undefined token
248  static const token undefinedToken;
249 
250 
251 private:
252 
253  //- A %union of token types
254  union content
255  {
256  // Fundamental values. Largest first for any {} initialization.
257  int64_t int64Val;
258  int32_t int32Val;
259 
260  int flagVal; // bitmask - stored as int, not enum
261  punctuationToken punctuationVal;
262  label labelVal;
263  floatScalar floatVal;
264  doubleScalar doubleVal;
265 
266  // Pointers
267  word* wordPtr;
268  string* stringPtr;
269  mutable compound* compoundPtr;
270  };
271 
272 
273  // Private Data
274 
275  //- The data content (as a union).
276  // For memory alignment this should appear as the first member.
277  content data_;
278 
279  //- The token type
280  tokenType type_;
281 
282  //- Line number in the file the token was read from
283  label lineNumber_;
284 
285 
286  // Private Member Functions
287 
288  //- Set as UNDEFINED and zero the union content without any checking
289  inline void setUndefined();
290 
291  // Parse error, expected 'expected', found ...
292  void parseError(const char* expected) const;
293 
294 
295 public:
296 
297  // Static Data Members
298 
299  //- The type name is "token"
300  static constexpr const char* const typeName = "token";
301 
302 
303  // Constructors
304 
305  //- Construct null, initialized to an UNDEFINED token.
306  inline constexpr token() noexcept;
307 
308  //- Copy construct
309  inline token(const token& t);
310 
311  //- Move construct. The original token is left as UNDEFINED.
312  inline token(token&& t);
313 
314  //- Construct punctuation character token
315  inline explicit token(punctuationToken p, label lineNumber=0);
316 
317  //- Construct label token
318  inline explicit token(const label val, label lineNumber=0);
319 
320  //- Construct float token
321  inline explicit token(const floatScalar val, label lineNumber=0);
322 
323  //- Construct double token
324  inline explicit token(const doubleScalar val, label lineNumber=0);
325 
326  //- Copy construct word token
327  inline explicit token(const word& w, label lineNumber=0);
328 
329  //- Copy construct string token
330  inline explicit token(const string& str, label lineNumber=0);
331 
332  //- Move construct word token
333  inline explicit token(word&& w, label lineNumber=0);
334 
335  //- Move construct string token
336  inline explicit token(string&& str, label lineNumber=0);
337 
338  //- Construct from Istream
339  explicit token(Istream& is);
340 
341 
342  //- Destructor
343  inline ~token();
344 
345 
346  // Static Member Functions
347 
348  //- Create a bool token.
349  inline static token boolean(bool on);
350 
351  //- Create a token with stream flags, no sanity check
352  //
353  // \param bitmask the flags to set
354  inline static token flag(int bitmask);
355 
356  //- True if the character is a punctuation separator (eg, in ISstream).
357  // Since it could also start a number, SUBTRACT is not included as
358  // a separator.
359  //
360  // \param c the character to test, passed as int for consistency with
361  // isdigit, isspace etc.
362  inline static bool isseparator(int c);
363 
364 
365  // Member Functions
366 
367  // Status
368 
369  //- Return the name of the token type
370  word name() const;
371 
372  //- Return the token type
373  inline tokenType type() const;
374 
375  //- Change the token type, for similar types.
376  // This can be used to change between string-like variants
377  // (eg, STRING, VARIABLE, etc)
378  // To change types entirely (eg, STRING to DOUBLE_SCALAR),
379  // use the corresponding assignment operator.
380  //
381  // \return true if the change was successful or no change was required
382  inline bool setType(const tokenType variant);
383 
384  //- The line number for the token
385  inline label lineNumber() const;
386 
387  //- The line number for the token
388  inline label& lineNumber();
389 
390  //- True if token is not UNDEFINED or ERROR
391  inline bool good() const;
392 
393  //- Token is UNDEFINED
394  inline bool undefined() const;
395 
396  //- Token is ERROR
397  inline bool error() const;
398 
399  //- Token is BOOL
400  inline bool isBool() const;
401 
402  //- Token is FLAG
403  inline bool isFlag() const;
404 
405  //- Token is PUNCTUATION
406  inline bool isPunctuation() const;
407 
408  //- Token is PUNCTUATION and isseparator
409  inline bool isSeparator() const;
410 
411  //- Token is LABEL
412  inline bool isLabel() const;
413 
414  //- Token is FLOAT_SCALAR
415  inline bool isFloatScalar() const;
416 
417  //- Token is DOUBLE_SCALAR
418  inline bool isDoubleScalar() const;
419 
420  //- Token is FLOAT_SCALAR or DOUBLE_SCALAR
421  inline bool isScalar() const;
422 
423  //- Token is LABEL, FLOAT_SCALAR or DOUBLE_SCALAR
424  inline bool isNumber() const;
425 
426  //- Token is WORD
427  inline bool isWord() const;
428 
429  //- Token is STRING, VARIABLE or VERBATIM string
430  inline bool isString() const;
431 
432  //- Token is VARIABLE
433  inline bool isVariable() const;
434 
435  //- Token is VERBATIM string
436  inline bool isVerbatim() const;
437 
438  //- Token is WORD, STRING, VARIABLE or VERBATIM
439  inline bool isStringType() const;
440 
441  //- Token is COMPOUND
442  inline bool isCompound() const;
443 
444 
445  // Access
446 
447  //- Return boolean token value.
448  // Report FatalIOError and return false if token is not BOOL or LABEL
449  inline bool boolToken() const;
450 
451  //- Return flag bitmask value.
452  // Report FatalIOError and return NO_FLAG if token is not FLAG
453  inline int flagToken() const;
454 
455  //- Return punctuation character.
456  // Report FatalIOError and return \b \\0 if token is not PUNCTUATION
457  inline punctuationToken pToken() const;
458 
459  //- Return label value.
460  // Report FatalIOError and return \b 0 if token is not LABEL
461  inline label labelToken() const;
462 
463  //- Return float value.
464  // Report FatalIOError and return \b 0 if token is not FLOAT_SCALAR
465  inline floatScalar floatScalarToken() const;
466 
467  //- Return double value.
468  // Report FatalIOError and return \b 0 if token is not DOUBLE_SCALAR
469  inline doubleScalar doubleScalarToken() const;
470 
471  //- Return float or double value.
472  // Report FatalIOError and return \b 0 if token is not a
473  // FLOAT_SCALAR or DOUBLE_SCALAR
474  inline scalar scalarToken() const;
475 
476  //- Return label, float or double value.
477  // Report FatalIOError and return \b 0 if token is not a
478  // LABEL, FLOAT_SCALAR or DOUBLE_SCALAR
479  inline scalar number() const;
480 
481  //- Return const reference to the word contents.
482  // Report FatalIOError and return \b "" if token is not a WORD
483  inline const word& wordToken() const;
484 
485  //- Return const reference to the string contents.
486  // Report FatalIOError and return \b "" if token is not a
487  // STRING, VARIABLE, VERBATIM or an upcast WORD
488  inline const string& stringToken() const;
489 
490  //- Read access for compound token
491  inline const compound& compoundToken() const;
492 
493  //- Return reference to compound token and decrease its internal
494  //- refCound accordingly.
495  // The Istream is used for reference error messages only.
497 
498 
499  // Edit
500 
501  //- Reset token to UNDEFINED and clear any allocated storage
502  inline void reset();
503 
504  //- Clear token and set to be ERROR.
505  inline void setBad();
506 
507  //- Swap token contents: type, data, line-number
508  inline void swap(token& tok);
509 
510 
511  // Info
512 
513  //- Return info proxy for printing token information to a stream
514  InfoProxy<token> info() const
515  {
516  return *this;
517  }
518 
519 
520  // Member Operators
521 
522  // Assignment
523 
524  //- Copy assign
525  inline void operator=(const token& tok);
526 
527  //- Move assign
528  inline void operator=(token&& tok);
529 
530  //- Copy assign from punctuation
531  inline void operator=(const punctuationToken p);
532 
533  //- Copy assign from label
534  inline void operator=(const label val);
535 
536  //- Copy assign from float
537  inline void operator=(const floatScalar val);
538 
539  //- Copy assign from double
540  inline void operator=(const doubleScalar val);
541 
542  //- Copy assign from word
543  inline void operator=(const word& w);
544 
545  //- Copy assign from string
546  inline void operator=(const string& str);
547 
548  //- Move assign from word
549  inline void operator=(word&& w);
550 
551  //- Move assign from string
552  inline void operator=(string&& str);
553 
554  //- Assign compound with reference counting to token
555  inline void operator=(compound* compoundPtr);
556 
557 
558  // Equality
559 
560  inline bool operator==(const token& tok) const;
561  inline bool operator==(const punctuationToken p) const;
562  inline bool operator==(const label val) const;
563  inline bool operator==(const floatScalar val) const;
564  inline bool operator==(const doubleScalar val) const;
565  inline bool operator==(const std::string& s) const;
566 
567 
568  // Inequality
569 
570  inline bool operator!=(const token& tok) const;
571  inline bool operator!=(const punctuationToken p) const;
572  inline bool operator!=(const label val) const;
573  inline bool operator!=(const floatScalar val) const;
574  inline bool operator!=(const doubleScalar val) const;
575  inline bool operator!=(const std::string& s) const;
576 
577 
578  // IOstream Operators
579 
580  friend Ostream& operator<<(Ostream& os, const token& tok);
581 
582  friend Ostream& operator<<(Ostream& os, const punctuationToken& pt);
583  friend ostream& operator<<(ostream& os, const punctuationToken& pt);
584 
585  friend ostream& operator<<(ostream& os, const InfoProxy<token>& ct);
586 
587 
588  // Housekeeping
589 
590  //- Deprecated(2017-11) transfer word pointer to the token
591  // \deprecated(2017-11) - use move assign from word
592  void operator=(word*) = delete;
593 
594  //- Deprecated(2017-11) transfer string pointer to the token
595  // \deprecated(2017-11) - use move assign from string
596  void operator=(string*) = delete;
597 };
598 
599 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
600 
601 // IOstream Operators
602 
603 Istream& operator>>(Istream& is, token& tok);
604 Ostream& operator<<(Ostream& os, const token::punctuationToken& pt);
605 ostream& operator<<(ostream& os, const token::punctuationToken& pt);
606 Ostream& operator<<(Ostream& os, const token::compound& ct);
607 
608 ostream& operator<<(ostream& os, const InfoProxy<token>& ip);
609 
610 template<>
611 Ostream& operator<<(Ostream& os, const InfoProxy<token>& ip);
612 
613 
614 // Handling of compound types
615 
616 #define defineCompoundTypeName(Type, Name) \
617  defineTemplateTypeNameAndDebugWithName(token::Compound<Type>, #Type, 0);
618 
619 #define addCompoundToRunTimeSelectionTable(Type, Name) \
620  token::compound::addIstreamConstructorToTable<token::Compound<Type>> \
621  add##Name##IstreamConstructorToTable_;
622 
623 
624 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
625 
626 } // End namespace Foam
627 
628 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
629 
630 #include "tokenI.H"
631 #include "Istream.H"
632 
633 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
634 
635 #endif
636 
637 // ************************************************************************* //
Foam::token::SUBTRACT
Subtract or start of negative number.
Definition: token.H:133
Foam::token::isDoubleScalar
bool isDoubleScalar() const
Token is DOUBLE_SCALAR.
Definition: tokenI.H:486
Foam::token::flag
static token flag(int bitmask)
Create a token with stream flags, no sanity check.
Definition: tokenI.H:43
Foam::token::ASSIGN
Assignment/equals [isseparator].
Definition: token.H:131
Foam::token::isFlag
bool isFlag() const
Token is FLAG.
Definition: tokenI.H:404
Foam::token::Compound::Compound
Compound(Istream &is)
Definition: token.H:229
Foam::token::flagType
flagType
Stream or output control flags (1-byte width)
Definition: token.H:100
Foam::token::labelToken
label labelToken() const
Return label value.
Definition: tokenI.H:456
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
Foam::doubleScalar
double doubleScalar
Floating-point double precision scalar type.
Definition: doubleScalar.H:52
Foam::token::COMMA
Comma [isseparator].
Definition: token.H:124
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::token::isScalar
bool isScalar() const
Token is FLOAT_SCALAR or DOUBLE_SCALAR.
Definition: tokenI.H:504
Foam::token::compound
Abstract base class for complex tokens.
Definition: token.H:143
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::token::Compound
A templated class for holding compound tokens.
Definition: token.H:219
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
Foam::token::SQUOTE
Single quote.
Definition: token.H:128
Foam::token::Compound::size
label size() const
Definition: token.H:234
s
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))
Definition: gmvOutputSpray.H:25
typeInfo.H
Foam::token::isNumber
bool isNumber() const
Token is LABEL, FLOAT_SCALAR or DOUBLE_SCALAR.
Definition: tokenI.H:530
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::token::stringToken
const string & stringToken() const
Return const reference to the string contents.
Definition: tokenI.H:599
Foam::token::LABEL
label (integer) type
Definition: token.H:84
InfoProxy.H
Foam::token::isFloatScalar
bool isFloatScalar() const
Token is FLOAT_SCALAR.
Definition: tokenI.H:468
Foam::floatScalar
float floatScalar
Floating-point single precision scalar type.
Definition: floatScalar.H:52
Foam::token::isString
bool isString() const
Token is STRING, VARIABLE or VERBATIM string.
Definition: tokenI.H:570
Foam::token::END_STRING
End string with double quote.
Definition: token.H:138
Foam::token::boolToken
bool boolToken() const
Return boolean token value.
Definition: tokenI.H:392
Foam::token::PUNCTUATION
single character punctuation
Definition: token.H:82
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::token
A token holds an item read from Istream.
Definition: token.H:69
Foam::token::compound::write
virtual void write(Ostream &os) const =0
Foam::token::compoundToken
const compound & compoundToken() const
Read access for compound token.
Definition: tokenI.H:627
Foam::token::isSeparator
bool isSeparator() const
Token is PUNCTUATION and isseparator.
Definition: tokenI.H:440
Foam::token::ERROR
A token error encountered.
Definition: token.H:95
Foam::token::good
bool good() const
True if token is not UNDEFINED or ERROR.
Definition: tokenI.H:368
Foam::token::compound::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, compound, Istream,(Istream &is),(is))
Declare run-time constructor selection table.
Foam::token::isCompound
bool isCompound() const
Token is COMPOUND.
Definition: tokenI.H:621
Foam::token::compound::TypeName
TypeName("compound")
Runtime type information.
Foam::token::pToken
punctuationToken pToken() const
Return punctuation character.
Definition: tokenI.H:428
Foam::token::compound::empty
bool empty() const
Definition: token.H:195
Foam::token::isseparator
static bool isseparator(int c)
True if the character is a punctuation separator (eg, in ISstream).
Definition: tokenI.H:53
Foam::token::isLabel
bool isLabel() const
Token is LABEL.
Definition: tokenI.H:450
Foam::token::floatScalarToken
floatScalar floatScalarToken() const
Return float value.
Definition: tokenI.H:474
Foam::token::DIVIDE
Divide [isseparator].
Definition: token.H:135
Foam::token::FLOAT_SCALAR
float (single-precision) type
Definition: token.H:85
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::token::DQUOTE
Double quote.
Definition: token.H:129
Foam::token::number
scalar number() const
Return label, float or double value.
Definition: tokenI.H:536
Foam::token::BINARY
BINARY-mode stream.
Definition: token.H:104
Foam::token::info
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
Definition: token.H:513
Foam::token::BEGIN_SQR
Begin dimensions [isseparator].
Definition: token.H:119
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::token::ATSYM
At.
Definition: token.H:127
Foam::token::NO_FLAG
No flags.
Definition: token.H:102
Foam::token::VARIABLE
A dictionary $variable (string variant)
Definition: token.H:91
Foam::token::operator!=
bool operator!=(const token &tok) const
Definition: tokenI.H:875
Foam::token::ASCII
ASCII-mode stream.
Definition: token.H:103
Foam::token::compound::empty
bool & empty()
Definition: token.H:200
Foam::token::reset
void reset()
Reset token to UNDEFINED and clear any allocated storage.
Definition: tokenI.H:243
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::token::isVariable
bool isVariable() const
Token is VARIABLE.
Definition: tokenI.H:581
tokenI.H
Foam::token::BOOL
boolean type
Definition: token.H:83
Foam::token::compound::~compound
virtual ~compound()=default
Destructor.
Foam::token::operator<<
friend Ostream & operator<<(Ostream &os, const token &tok)
Foam::token::transferCompoundToken
compound & transferCompoundToken(const Istream &is)
Definition: token.C:90
Foam::token::END_STATEMENT
End entry [isseparator].
Definition: token.H:116
Foam::token::compound::isCompound
static bool isCompound(const word &name)
Return true if name is a known (registered) compound type.
Definition: token.C:80
Istream.H
Foam::token::Compound::write
void write(Ostream &os) const
Definition: token.H:239
Foam::token::NULL_TOKEN
Nul character.
Definition: token.H:111
Foam::token::END_BLOCK
End block [isseparator].
Definition: token.H:122
Foam::token::undefinedToken
static const token undefinedToken
An undefined token.
Definition: token.H:247
Foam::token::tokenType
tokenType
Enumeration defining the types of token.
Definition: token.H:76
Foam::token::DOLLAR
Dollar - start variable.
Definition: token.H:126
Foam::token::COMPOUND
Compound type such as List<label> etc.
Definition: token.H:93
Foam::token::NL
Newline [isspace].
Definition: token.H:114
Foam::token::isWord
bool isWord() const
Token is WORD.
Definition: tokenI.H:552
scalar.H
Foam::token::END_SQR
End dimensions [isseparator].
Definition: token.H:120
Foam::token::STRING
A string.
Definition: token.H:90
Foam::token::HASH
Hash - directive or verbatim string.
Definition: token.H:125
Foam::token::setType
bool setType(const tokenType variant)
Change the token type, for similar types.
Definition: tokenI.H:301
Foam::token::MULTIPLY
Multiply [isseparator].
Definition: token.H:134
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::token::operator==
bool operator==(const token &tok) const
Definition: tokenI.H:779
Foam::token::BEGIN_BLOCK
Begin block [isseparator].
Definition: token.H:121
Foam::token::wordToken
const word & wordToken() const
Return const reference to the word contents.
Definition: tokenI.H:558
Foam::token::compound::size
virtual label size() const =0
Foam::token::typeName
static constexpr const char *const typeName
The type name is "token".
Definition: token.H:299
Foam::token::compound::operator<<
friend Ostream & operator<<(Ostream &os, const compound &ct)
Output operator.
Foam::token::swap
void swap(token &tok)
Swap token contents: type, data, line-number.
Definition: tokenI.H:282
Foam::token::Compound::TypeName
TypeName("Compound<T>")
Runtime type information.
Foam::token::FLAG
stream flag (1-byte bitmask)
Definition: token.H:81
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::token::type
tokenType type() const
Return the token type.
Definition: tokenI.H:295
Foam::token::isBool
bool isBool() const
Token is BOOL.
Definition: tokenI.H:386
Foam::token::COLON
Colon [isseparator].
Definition: token.H:123
Foam::token::scalarToken
scalar scalarToken() const
Return float or double value.
Definition: tokenI.H:514
Foam::token::name
word name() const
Return the name of the token type.
Definition: tokenIO.C:126
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
label.H
Foam::token::isVerbatim
bool isVerbatim() const
Token is VERBATIM string.
Definition: tokenI.H:587
Foam::token::SPACE
Space [isspace].
Definition: token.H:112
Foam::token::WORD
A Foam::word.
Definition: token.H:89
Foam::token::DOUBLE_SCALAR
double (double-precision) type
Definition: token.H:86
Foam::token::compound::compound
compound()
Construct null.
Definition: token.H:174
Foam::token::doubleScalarToken
doubleScalar doubleScalarToken() const
Return double value.
Definition: tokenI.H:492
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:118
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::token::token
constexpr token() noexcept
Construct null, initialized to an UNDEFINED token.
Definition: tokenI.H:95
Foam::token::undefined
bool undefined() const
Token is UNDEFINED.
Definition: tokenI.H:374
Foam::token::flagToken
int flagToken() const
Return flag bitmask value.
Definition: tokenI.H:410
Foam::token::compound::New
static autoPtr< compound > New(const word &type, Istream &is)
Select null constructed.
Definition: token.C:56
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::token::lineNumber
label lineNumber() const
The line number for the token.
Definition: tokenI.H:356
uLabel.H
Foam::TAB
The TAB Method for Numerical Calculation of Spray Droplet Breakup.
Definition: TAB.H:65
Foam::token::isPunctuation
bool isPunctuation() const
Token is PUNCTUATION.
Definition: tokenI.H:422
Foam::token::UNDEFINED
An undefined token-type.
Definition: token.H:78
Foam::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:117
refCount.H
Foam::error
Class to handle errors and exceptions in a simple, consistent stream-based manner.
Definition: error.H:64
Foam::token::VERBATIMSTRING
Verbatim string content.
Definition: token.H:92
Foam::token::isStringType
bool isStringType() const
Token is WORD, STRING, VARIABLE or VERBATIM.
Definition: tokenI.H:593
Foam::token::BEGIN_STRING
Begin string with double quote.
Definition: token.H:137
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::token::punctuationToken
punctuationToken
Standard punctuation tokens (a character)
Definition: token.H:109
Foam::token::operator=
void operator=(const token &tok)
Copy assign.
Definition: tokenI.H:648
Foam::token::ADD
Addition [isseparator].
Definition: token.H:132
Foam::token::setBad
void setBad()
Clear token and set to be ERROR.
Definition: tokenI.H:639