tokenI.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-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include <algorithm>
30
31// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
32
33inline Foam::token Foam::token::boolean(bool on) noexcept
34{
35 token tok;
36 tok.type_ = tokenType::BOOL;
37 tok.data_.labelVal = on;
38
39 return tok;
40}
41
42
43inline Foam::token Foam::token::flag(int bitmask) noexcept
44{
45 token tok;
46 tok.type_ = tokenType::FLAG;
47 tok.data_.flagVal = bitmask;
48
49 return tok;
50}
51
52
53inline bool Foam::token::isseparator(int c) noexcept
54{
55 // NOTE: keep synchronized with ISstream::read(token&)
56
57 switch (c)
58 {
59 case token::END_STATEMENT :
60 case token::BEGIN_LIST :
61 case token::END_LIST :
62 case token::BEGIN_SQR :
63 case token::END_SQR :
64 case token::BEGIN_BLOCK :
65 case token::END_BLOCK :
66 case token::COLON :
67 case token::COMMA :
68 case token::ASSIGN :
69 case token::PLUS :
70 // Excluded token::MINUS since it could start a number
71 case token::MULTIPLY :
72 case token::DIVIDE :
73 {
74 return true;
75 }
76
77 default:
78 break;
79 }
80
81 return false;
82}
83
84
85// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
86
87inline void Foam::token::setUndefined() noexcept
88{
90 data_.int64Val = 0; // bit-wise zero for union content
91 // leave lineNumber untouched - may still be needed
92}
93
94
95// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
96
97inline constexpr Foam::token::token() noexcept
98:
99 data_(), // bit-wise zero for union content
100 type_(tokenType::UNDEFINED),
101 line_(0)
102{}
103
104
105inline Foam::token::token(const token& tok)
106:
107 data_(tok.data_), // bit-wise copy of union content
108 type_(tok.type_),
109 line_(tok.line_)
110{
111 // Fundamental: values already handled by bit-wise copy
112 // Pointer: duplicate content or increase refCount
113
114 switch (type_)
115 {
116 case tokenType::WORD:
118 {
119 data_.wordPtr = new word(*tok.data_.wordPtr);
120 break;
121 }
122
127 {
128 data_.stringPtr = new string(*tok.data_.stringPtr);
129 break;
130 }
131
133 {
134 // Identical pointers, but increase the refCount
135 data_.compoundPtr = tok.data_.compoundPtr;
136 data_.compoundPtr->refCount::operator++();
137 break;
138 }
139
140 default:
141 break;
142 }
143}
144
145
147:
148 data_(tok.data_), // bit-wise copy of union content
149 type_(tok.type_),
150 line_(tok.line_)
151{
152 tok.setUndefined(); // zero the union content without any checking
153 tok.line_ = 0;
154}
155
156
158:
159 data_(),
160 type_(tokenType::PUNCTUATION),
161 line_(lineNum)
162{
163 data_.punctuationVal = p;
164}
165
166
167inline Foam::token::token(const label val, label lineNum) noexcept
168:
169 data_(),
170 type_(tokenType::LABEL),
171 line_(lineNum)
172{
173 data_.labelVal = val;
174}
175
176
177inline Foam::token::token(const floatScalar val, label lineNum) noexcept
178:
179 data_(),
180 type_(tokenType::FLOAT),
181 line_(lineNum)
182{
183 data_.floatVal = val;
184}
185
186
187inline Foam::token::token(const doubleScalar val, label lineNum) noexcept
188:
189 data_(),
190 type_(tokenType::DOUBLE),
191 line_(lineNum)
192{
193 data_.doubleVal = val;
194}
195
196
197inline Foam::token::token(const word& w, label lineNum)
198:
199 data_(),
200 type_(tokenType::WORD),
201 line_(lineNum)
202{
203 data_.wordPtr = new word(w);
204}
205
206
207inline Foam::token::token(const string& str, label lineNum)
208:
209 data_(),
210 type_(tokenType::STRING),
211 line_(lineNum)
212{
213 data_.stringPtr = new string(str);
214}
215
216
217inline Foam::token::token(word&& w, label lineNum)
218:
219 data_(),
220 type_(tokenType::WORD),
221 line_(lineNum)
222{
223 data_.wordPtr = new word(std::move(w));
224}
225
226
227inline Foam::token::token(string&& str, label lineNum)
228:
229 data_(),
230 type_(tokenType::STRING),
231 line_(lineNum)
232{
233 data_.stringPtr = new string(std::move(str));
234}
235
236
237inline Foam::token::token(token::compound* ptr, label lineNum)
238:
239 data_(),
240 type_(tokenType::COMPOUND),
241 line_(lineNum)
242{
243 data_.compoundPtr = ptr;
244}
245
246
247// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
248
250{
251 reset();
252}
253
254
255// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
256
258{
259 switch (type_)
260 {
261 case tokenType::WORD:
262 case tokenType::DIRECTIVE:
263 {
264 delete data_.wordPtr;
265 break;
266 }
267
268 case tokenType::STRING:
269 case tokenType::EXPRESSION:
270 case tokenType::VARIABLE:
271 case tokenType::VERBATIM:
272 {
273 delete data_.stringPtr;
274 break;
275 }
276
277 case tokenType::COMPOUND:
278 {
279 if (data_.compoundPtr->unique())
280 {
281 delete data_.compoundPtr;
282 }
283 else
284 {
285 data_.compoundPtr->refCount::operator--();
286 }
287 break;
288 }
289
290 default:
291 break;
292 }
293
294 setUndefined();
295}
296
297
298inline void Foam::token::swap(token& tok)
299{
300 if (this == &tok)
301 {
302 return; // Self-swap is a no-op
303 }
304
305 std::swap(data_, tok.data_);
306 std::swap(type_, tok.type_);
307 std::swap(line_, tok.line_);
308}
309
310
312{
313 return type_;
314}
315
316
317inline bool Foam::token::setType(token::tokenType tokType) noexcept
318{
319 if (type_ == tokType)
320 {
321 // No change required
322 return true;
323 }
324
325 switch (tokType)
326 {
327 case tokenType::BOOL:
328 case tokenType::LABEL:
329 {
330 switch (type_)
331 {
332 case tokenType::BOOL:
333 case tokenType::LABEL:
334 type_ = tokType;
335 return true;
336 break;
337
338 default:
339 break;
340 }
341 }
342 break;
343
344 case tokenType::WORD:
345 case tokenType::DIRECTIVE:
346 {
347 switch (type_)
348 {
349 case tokenType::WORD:
350 case tokenType::DIRECTIVE:
351 type_ = tokType;
352 return true;
353 break;
354
355 default:
356 break;
357 }
358 }
359 break;
360
361 case tokenType::STRING:
362 case tokenType::EXPRESSION:
363 case tokenType::VARIABLE:
364 case tokenType::VERBATIM:
365 {
366 switch (type_)
367 {
368 // could also go from WORD to STRING etc - to be decided
369 case tokenType::STRING:
370 case tokenType::EXPRESSION:
371 case tokenType::VARIABLE:
372 case tokenType::VERBATIM:
373 type_ = tokType;
374 return true;
375 break;
376
377 default:
378 break;
379 }
380 }
381 break;
382
383 default:
384 break;
385 }
386
387 return false;
388}
389
390
391inline Foam::label Foam::token::lineNumber() const noexcept
392{
393 return line_;
394}
395
396
397inline Foam::label Foam::token::lineNumber(const label lineNum) noexcept
398{
399 label old(line_);
400 line_ = lineNum;
401 return old;
402}
403
404
405inline bool Foam::token::good() const noexcept
406{
407 return (type_ != tokenType::UNDEFINED && type_ != tokenType::ERROR);
408}
409
410
412{
413 return (type_ == tokenType::UNDEFINED);
414}
415
416
417inline bool Foam::token::error() const noexcept
418{
419 return (type_ == tokenType::ERROR);
420}
421
422
423inline bool Foam::token::isBool() const noexcept
424{
425 return (type_ == tokenType::BOOL);
426}
427
428
429inline bool Foam::token::boolToken() const
430{
431 if (type_ == tokenType::BOOL || type_ == tokenType::LABEL)
432 {
433 return data_.labelVal;
434 }
435
436 parseError("bool");
437 return false;
438}
439
440
441inline bool Foam::token::isFlag() const noexcept
442{
443 return (type_ == tokenType::FLAG);
444}
445
446
447inline int Foam::token::flagToken() const
448{
449 if (type_ == tokenType::FLAG)
450 {
451 return data_.flagVal;
452 }
453
454 parseError("flag bitmask");
455 return NO_FLAG;
456}
457
458
460{
461 return (type_ == tokenType::PUNCTUATION);
462}
463
464
465inline bool Foam::token::isPunctuation(const punctuationToken p) const noexcept
466{
467 return
468 (
469 type_ == tokenType::PUNCTUATION
470 && data_.punctuationVal == p
471 );
472}
473
474
476{
477 return
478 (
479 type_ == tokenType::PUNCTUATION
480 && isseparator(data_.punctuationVal)
481 );
482}
483
484
486{
487 if (type_ == tokenType::PUNCTUATION)
488 {
489 return data_.punctuationVal;
490 }
491
492 parseError("punctuation character");
493 return punctuationToken::NULL_TOKEN;
494}
495
496
498{
499 return (type_ == tokenType::LABEL);
500}
501
502
503inline bool Foam::token::isLabel(const label val) const noexcept
504{
505 return
506 (
507 type_ == tokenType::LABEL
508 && data_.labelVal == val
509 );
510}
511
512
513inline Foam::label Foam::token::labelToken() const
514{
515 if (type_ == tokenType::LABEL)
516 {
517 return data_.labelVal;
518 }
519
520 parseError("label");
521 return 0;
522}
523
524
526{
527 return (type_ == tokenType::FLOAT);
528}
529
530
532{
533 if (type_ == tokenType::FLOAT)
534 {
535 return data_.floatVal;
536 }
537
538 parseError("float");
539 return 0;
540}
541
542
544{
545 return (type_ == tokenType::DOUBLE);
546}
547
548
550{
551 if (type_ == tokenType::DOUBLE)
552 {
553 return data_.doubleVal;
554 }
555
556 parseError("double");
557 return 0;
558}
559
560
562{
563 return
564 (
565 type_ == tokenType::FLOAT
566 || type_ == tokenType::DOUBLE
567 );
568}
569
570
571inline Foam::scalar Foam::token::scalarToken() const
572{
573 if (type_ == tokenType::FLOAT)
574 {
575 return data_.floatVal;
576 }
577 else if (type_ == tokenType::DOUBLE)
578 {
579 return data_.doubleVal;
580 }
581
582 parseError("scalar");
583 return 0;
584}
585
586
588{
589 return (type_ == tokenType::LABEL || isScalar());
590}
591
592
593inline Foam::scalar Foam::token::number() const
594{
595 if (isLabel())
596 {
597 return labelToken();
598 }
599 if (isScalar())
600 {
601 return scalarToken();
602 }
603
604 parseError("number (label or scalar)");
605 return 0;
606}
607
608
609inline bool Foam::token::isWord() const noexcept
610{
611 return
612 (
613 type_ == tokenType::WORD
614 || type_ == tokenType::DIRECTIVE
615 );
616}
617
618
619inline bool Foam::token::isWord(const std::string& s) const
620{
621 return (isWord() && s == *data_.wordPtr);
622}
623
624
626{
627 return (type_ == tokenType::DIRECTIVE);
628}
629
630
632{
633 if
634 (
635 type_ == tokenType::WORD
636 || type_ == tokenType::DIRECTIVE
637 )
638 {
639 return *data_.wordPtr;
640 }
641
642 parseError("word");
643 return word::null;
644}
645
646
648{
649 return (type_ == tokenType::STRING);
650}
651
652
654{
655 return
656 (
657 type_ == tokenType::STRING
658 || type_ == tokenType::EXPRESSION
659 || type_ == tokenType::VARIABLE
660 || type_ == tokenType::VERBATIM
661 );
662}
663
664
666{
667 return (type_ == tokenType::EXPRESSION);
668}
669
670
672{
673 return (type_ == tokenType::VARIABLE);
674}
675
676
678{
679 return (type_ == tokenType::VERBATIM);
680}
681
682
684{
685 return (isWord() || isString());
686}
687
688
690{
691 if
692 (
693 type_ == tokenType::STRING
694 || type_ == tokenType::EXPRESSION
695 || type_ == tokenType::VARIABLE
696 || type_ == tokenType::VERBATIM
697 )
698 {
699 return *data_.stringPtr;
700 }
701 else if
702 (
703 type_ == tokenType::WORD
704 || type_ == tokenType::DIRECTIVE
705 )
706 {
707 // Foam::word derives from Foam::string, no need to cast.
708 return *data_.wordPtr;
709 }
710
711 parseError("string");
712 return string::null;
713}
714
715
717{
718 return (type_ == tokenType::COMPOUND);
719}
720
721
723{
724 if (type_ == tokenType::COMPOUND)
725 {
726 return *data_.compoundPtr;
727 }
728
729 parseError("compound");
730 return *data_.compoundPtr; // This is questionable.
731}
732
733
735{
736 reset();
737 type_ = tokenType::ERROR;
738}
739
740
741// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
742
743inline void Foam::token::operator=(const token& tok)
744{
745 if (this == &tok)
746 {
747 return; // Self-assignment is a no-op
748 }
749
750 reset();
751
752 type_ = tok.type_;
753 data_ = tok.data_; // bit-wise copy of union content
754 line_ = tok.line_;
755
756 // Fundamental: values already handled by bit-wise copy
757 // Pointer: duplicate content or increase refCount
758
759 switch (type_)
760 {
761 case tokenType::WORD:
762 case tokenType::DIRECTIVE:
763 {
764 data_.wordPtr = new word(*tok.data_.wordPtr);
765 }
766 break;
767
768 case tokenType::STRING:
769 case tokenType::EXPRESSION:
770 case tokenType::VARIABLE:
771 case tokenType::VERBATIM:
772 {
773 data_.stringPtr = new string(*tok.data_.stringPtr);
774 }
775 break;
776
777 case tokenType::COMPOUND:
778 {
779 // Identical pointers, but increase the refCount
780 data_.compoundPtr = tok.data_.compoundPtr;
781 data_.compoundPtr->refCount::operator++();
782 }
783 break;
784
785 default:
786 break;
787 }
788}
789
790
792{
793 if (this == &tok)
794 {
795 return; // Self-assignment is a no-op
796 }
797
798 reset();
799 line_ = 0;
800 swap(tok);
801}
802
803
805{
806 reset();
807 type_ = tokenType::PUNCTUATION;
808 data_.punctuationVal = p;
809}
810
811
812inline void Foam::token::operator=(const label val)
813{
814 reset();
815 type_ = tokenType::LABEL;
816 data_.labelVal = val;
817}
818
819
821{
822 reset();
823 type_ = tokenType::FLOAT;
824 data_.floatVal = val;
825}
826
827
829{
830 reset();
831 type_ = tokenType::DOUBLE;
832 data_.doubleVal = val;
833}
834
835
836inline void Foam::token::operator=(const word& w)
837{
838 reset();
839 type_ = tokenType::WORD;
840 data_.wordPtr = new word(w);
841}
842
843
844inline void Foam::token::operator=(const string& str)
845{
846 reset();
847 type_ = tokenType::STRING;
848 data_.stringPtr = new string(str);
849}
850
851
853{
854 reset();
855 type_ = tokenType::WORD;
856 data_.wordPtr = new word(std::move(w));
857}
858
859
860inline void Foam::token::operator=(string&& s)
861{
862 reset();
863 type_ = tokenType::STRING;
864 data_.stringPtr = new string(std::move(s));
865}
866
867
869{
870 reset();
871 type_ = tokenType::COMPOUND;
872 data_.compoundPtr = ptr;
873}
874
875
877{
878 reset();
879 type_ = tokenType::COMPOUND;
880 data_.compoundPtr = ptr.release();
881}
882
883
884inline bool Foam::token::operator==(const token& tok) const
885{
886 if (type_ != tok.type_)
887 {
888 return false;
889 }
890
891 switch (type_)
892 {
893 case tokenType::UNDEFINED:
894 return true;
895
896 case tokenType::BOOL:
897 return data_.labelVal == tok.data_.labelVal;
898
899 case tokenType::FLAG:
900 return data_.flagVal == tok.data_.flagVal;
901
902 case tokenType::PUNCTUATION:
903 return data_.punctuationVal == tok.data_.punctuationVal;
904
905 case tokenType::LABEL:
906 return data_.labelVal == tok.data_.labelVal;
907
908 case tokenType::FLOAT:
909 return equal(data_.floatVal, tok.data_.floatVal);
910
911 case tokenType::DOUBLE:
912 return equal(data_.doubleVal, tok.data_.doubleVal);
913
914 case tokenType::WORD:
915 case tokenType::DIRECTIVE:
916 return *data_.wordPtr == *tok.data_.wordPtr;
917
918 case tokenType::STRING:
919 case tokenType::EXPRESSION:
920 case tokenType::VARIABLE:
921 case tokenType::VERBATIM:
922 return *data_.stringPtr == *tok.data_.stringPtr;
923
924 case tokenType::COMPOUND:
925 return data_.compoundPtr == tok.data_.compoundPtr;
926
927 case tokenType::ERROR:
928 return true;
929 }
930
931 return false;
932}
933
934
935inline bool Foam::token::operator==(const punctuationToken p) const noexcept
936{
937 return isPunctuation(p);
938}
939
940
941inline bool Foam::token::operator==(const std::string& s) const
942{
943 return
944 (
945 isWord()
946 ? s == *data_.wordPtr
947 : isString() && s == *data_.stringPtr
948 );
949}
950
951
952inline bool Foam::token::operator==(const label val) const noexcept
953{
954 return isLabel(val);
955}
956
957
958inline bool Foam::token::operator==(const floatScalar val) const noexcept
959{
960 return
961 (
962 type_ == tokenType::FLOAT
963 && equal(data_.floatVal, val)
964 );
965}
966
967
968inline bool Foam::token::operator==(const doubleScalar val) const noexcept
969{
970 return
971 (
972 type_ == tokenType::DOUBLE
973 && equal(data_.doubleVal, val)
974 );
975}
976
977
978inline bool Foam::token::operator!=(const token& tok) const
979{
980 return !operator==(tok);
981}
982
983
984inline bool Foam::token::operator!=(const punctuationToken p) const noexcept
985{
986 return !isPunctuation(p);
987}
988
989
990inline bool Foam::token::operator!=(const label val) const noexcept
991{
992 return !operator==(val);
993}
994
995
996inline bool Foam::token::operator!=(const floatScalar val) const noexcept
997{
998 return !operator==(val);
999}
1000
1001
1002inline bool Foam::token::operator!=(const doubleScalar val) const noexcept
1003{
1004 return !operator==(val);
1005}
1006
1007
1008inline bool Foam::token::operator!=(const std::string& s) const
1009{
1010 return !operator==(s);
1011}
1012
1013
1014// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
friend bool operator!=(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:106
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:97
A class for handling character strings derived from std::string.
Definition: string.H:79
static const string null
An empty string.
Definition: string.H:169
Abstract base class for complex tokens.
Definition: token.H:171
A token holds an item read from Istream.
Definition: token.H:69
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
Definition: tokenI.H:587
floatScalar floatToken() const
Return float value.
Definition: tokenI.H:531
tokenType
Enumeration defining the types of token.
Definition: token.H:77
@ VARIABLE
Definition: token.H:98
@ WORD
Foam::word.
Definition: token.H:90
@ EXPRESSION
Definition: token.H:96
@ UNDEFINED
An undefined token-type.
Definition: token.H:78
@ COMPOUND
Compound type such as List<label> etc.
Definition: token.H:92
@ VERBATIM
Definition: token.H:100
@ DIRECTIVE
Definition: token.H:94
@ STRING
Foam::string (usually double-quoted)
Definition: token.H:91
label lineNumber() const noexcept
The line number for the token.
Definition: tokenI.H:391
bool isBool() const noexcept
Token is BOOL.
Definition: tokenI.H:423
bool isSeparator() const noexcept
Token is PUNCTUATION and isseparator.
Definition: tokenI.H:475
bool isPunctuation() const noexcept
Token is PUNCTUATION.
Definition: tokenI.H:459
bool isExpression() const noexcept
Token is EXPRESSION (string variant)
Definition: tokenI.H:665
punctuationToken
Standard punctuation tokens (a character)
Definition: token.H:121
bool isLabel() const noexcept
Token is LABEL.
Definition: tokenI.H:497
const string & stringToken() const
Return const reference to the string contents.
Definition: tokenI.H:689
punctuationToken pToken() const
Return punctuation character.
Definition: tokenI.H:485
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
Definition: tokenI.H:405
void setBad()
Clear token and set to be ERROR.
Definition: tokenI.H:734
label labelToken() const
Return label value.
Definition: tokenI.H:513
bool isDouble() const noexcept
Token is DOUBLE.
Definition: tokenI.H:543
static bool isseparator(int c) noexcept
True if the character is a punctuation separator (eg, in ISstream).
Definition: tokenI.H:53
bool isString() const noexcept
Token is string-variant (STRING, EXPRESSION, VARIABLE, VERBATIM)
Definition: tokenI.H:653
constexpr token() noexcept
Default construct, initialized to an UNDEFINED token.
Definition: tokenI.H:97
void swap(token &tok)
Swap token contents: type, data, line-number.
Definition: tokenI.H:298
bool boolToken() const
Return boolean token value.
Definition: tokenI.H:429
bool isScalar() const noexcept
Token is FLOAT or DOUBLE.
Definition: tokenI.H:561
const compound & compoundToken() const
Read access for compound token.
Definition: tokenI.H:722
bool isDirective() const noexcept
Token is DIRECTIVE (word variant)
Definition: tokenI.H:625
bool isFlag() const noexcept
Token is FLAG.
Definition: tokenI.H:441
int flagToken() const
Return flag bitmask value.
Definition: tokenI.H:447
doubleScalar doubleToken() const
Return double value.
Definition: tokenI.H:549
bool undefined() const noexcept
Token is UNDEFINED.
Definition: tokenI.H:411
tokenType type() const noexcept
Return the token type.
Definition: tokenI.H:311
bool isQuotedString() const noexcept
Token is (quoted) STRING (string variant)
Definition: tokenI.H:647
bool isCompound() const noexcept
Token is COMPOUND.
Definition: tokenI.H:716
bool error() const noexcept
Token is ERROR.
Definition: tokenI.H:417
bool isFloat() const noexcept
Token is FLOAT.
Definition: tokenI.H:525
bool isStringType() const noexcept
Definition: tokenI.H:683
bool isVariable() const noexcept
Token is VARIABLE (string variant)
Definition: tokenI.H:671
void reset()
Reset token to UNDEFINED and clear any allocated storage.
Definition: tokenI.H:257
const word & wordToken() const
Return const reference to the word contents.
Definition: tokenI.H:631
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
Definition: tokenI.H:609
scalar scalarToken() const
Return float or double value.
Definition: tokenI.H:571
bool isVerbatim() const noexcept
Token is VERBATIM string (string variant)
Definition: tokenI.H:677
~token()
Destructor.
Definition: tokenI.H:249
static token boolean(bool on) noexcept
Create a bool token.
Definition: tokenI.H:33
static token flag(int bitmask) noexcept
Create a token with stream flags, no sanity check.
Definition: tokenI.H:43
void operator=(const token &tok)
Copy assign.
Definition: tokenI.H:743
scalar number() const
Return label, float or double value.
Definition: tokenI.H:593
virtual topoSetSource::sourceType setType() const
The source category is a cellSet.
A class for handling words, derived from Foam::string.
Definition: word.H:68
static const word null
An empty word.
Definition: word.H:80
volScalarField & p
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))
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
bool equal(const T &s1, const T &s2)
Compare two values for equality.
Definition: doubleFloat.H:46
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
float floatScalar
A typedef for float.
Definition: scalarFwd.H:45
const direction noexcept
Definition: Scalar.H:223