Go to the documentation of this file.
45 case token::tokenType::UNDEFINED:
46 os <<
"undefined token";
49 case token::tokenType::BOOL:
50 os <<
"bool '" << (tok.
boolToken() ?
"true" :
"false") <<
'\'';
53 case token::tokenType::FLAG:
54 os <<
"flag '" << int(tok.
flagToken()) <<
'\'';
57 case token::tokenType::PUNCTUATION:
58 os <<
"punctuation '" << tok.
pToken() <<
'\'';
61 case token::tokenType::LABEL:
65 case token::tokenType::FLOAT:
69 case token::tokenType::DOUBLE:
73 case token::tokenType::WORD:
74 os <<
"word '" << tok.
wordToken() <<
'\'';
77 case token::tokenType::DIRECTIVE:
78 os <<
"directive '" << tok.
wordToken() <<
'\'';
81 case token::tokenType::STRING:
85 case token::tokenType::VARIABLE:
89 case token::tokenType::VERBATIM:
93 case token::tokenType::COMPOUND:
99 os <<
"compound of type "
104 case token::tokenType::ERROR:
109 os <<
"unknown token type '" << int(tok.
type()) <<
'\'';
134 case token::tokenType::UNDEFINED:
return "undefined";
135 case token::tokenType::BOOL:
return "bool";
136 case token::tokenType::FLAG:
return "flag";
137 case token::tokenType::PUNCTUATION:
return "punctuation";
138 case token::tokenType::LABEL:
return "label";
139 case token::tokenType::FLOAT:
return "float";
140 case token::tokenType::DOUBLE:
return "double";
141 case token::tokenType::WORD:
return "word";
142 case token::tokenType::DIRECTIVE:
return "directive";
143 case token::tokenType::STRING:
return "string";
144 case token::tokenType::VERBATIM:
return "verbatim";
145 case token::tokenType::VARIABLE:
return "variable";
146 case token::tokenType::COMPOUND:
return "compound";
147 case token::tokenType::ERROR:
return "error";
153 return "unknown(" + std::to_string(
int(type_)) +
")";
170 case token::tokenType::UNDEFINED:
173 <<
"Undefined token" <<
endl;
176 case token::tokenType::FLAG:
180 case token::tokenType::PUNCTUATION:
181 os << tok.data_.punctuationVal;
184 case token::tokenType::BOOL:
185 case token::tokenType::LABEL:
186 os << tok.data_.labelVal;
189 case token::tokenType::FLOAT:
190 os << tok.data_.floatVal;
193 case token::tokenType::DOUBLE:
194 os << tok.data_.doubleVal;
198 case token::tokenType::DIRECTIVE:
199 case token::tokenType::VARIABLE:
200 case token::tokenType::VERBATIMSTRING:
204 case token::tokenType::WORD:
205 os << *tok.data_.wordPtr;
208 case token::tokenType::STRING:
209 os << *tok.data_.stringPtr;
212 case token::tokenType::COMPOUND:
213 os << *tok.data_.compoundPtr;
216 case token::tokenType::ERROR:
219 <<
"Error token" <<
endl;
225 <<
"Unknown token" <<
endl;
235 return os << char(pt);
241 return os << char(pt);
label labelToken() const
Return label value.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Abstract base class for complex tokens.
A class for handling words, derived from Foam::string.
A helper class for outputting values to Ostream.
label lineNumber() const noexcept
The line number for the token.
const string & stringToken() const
Return const reference to the string contents.
static OS & printTokenInfo(OS &os, const token &tok)
bool boolToken() const
Return boolean token value.
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
virtual void write(Ostream &os) const =0
Redirect write to underlying content.
const compound & compoundToken() const
Read access for compound token.
punctuationToken pToken() const
Return punctuation character.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
bool empty() const noexcept
Has compound been transferred?
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void reset()
Reset token to UNDEFINED and clear any allocated storage.
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
floatScalar floatToken() const
Return float value.
doubleScalar doubleToken() const
Return double value.
const word & wordToken() const
Return const reference to the word contents.
tokenType type() const noexcept
Return the token type.
word name() const
Return the name of the token type.
constexpr token() noexcept
Default construct, initialized to an UNDEFINED token.
int flagToken() const
Return flag bitmask value.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define WarningInFunction
Report a warning using Foam::Warning.
punctuationToken
Standard punctuation tokens (a character)
virtual Istream & read(token &)=0
Return next token from stream.