Go to the documentation of this file.
63 Ostream&
operator<<(Ostream& os,
const token& tok);
199 bool empty() const noexcept
205 bool&
empty() noexcept
211 virtual label
size()
const = 0;
263 virtual label
size()
const
271 operator<<(os, static_cast<const T&>(*
this));
318 inline void setUndefined() noexcept;
321 void parseError(const
char* expected) const;
335 inline constexpr
token() noexcept;
347 inline explicit
token(const label val, label lineNum=0) noexcept;
356 inline explicit
token(const
word& w, label lineNum=0);
359 inline explicit
token(const
string& str, label lineNum=0);
362 inline explicit
token(
word&& w, label lineNum=0);
365 inline explicit
token(
string&& str, label lineNum=0);
381 inline static
token boolean(
bool on) noexcept;
386 inline static
token flag(
int bitmask) noexcept;
423 inline
bool good() const noexcept;
429 inline
bool error() const noexcept;
432 inline
bool isBool() const noexcept;
435 inline
bool isFlag() const noexcept;
444 inline
bool isLabel() const noexcept;
447 inline
bool isFloat() const noexcept;
450 inline
bool isDouble() const noexcept;
453 inline
bool isScalar() const noexcept;
456 inline
bool isNumber() const noexcept;
459 inline
bool isWord() const noexcept;
465 inline
bool isString() const noexcept;
514 inline scalar
number() const;
584 inline void operator=(
const string& str);
603 inline bool operator==(
const label val)
const;
606 inline bool operator==(
const std::string&
s)
const;
613 inline bool operator!=(
const label val)
const;
616 inline bool operator!=(
const std::string&
s)
const;
663 Ostream&
operator<<(Ostream& os,
const token::compound& ct);
665 ostream&
operator<<(ostream& os,
const InfoProxy<token>& ip);
668 Ostream&
operator<<(Ostream& os,
const InfoProxy<token>& ip);
673 #define defineCompoundTypeName(Type, Name) \
674 defineTemplateTypeNameAndDebugWithName(token::Compound<Type>, #Type, 0);
676 #define addCompoundToRunTimeSelectionTable(Type, Name) \
677 token::compound::addIstreamConstructorToTable<token::Compound<Type>> \
678 add##Name##IstreamConstructorToTable_;
Subtract or start of negative number.
bool isDoubleScalar() const
Token is DOUBLE.
Assignment/equals [isseparator].
Compound(Istream &is)
Read construct from Istream.
flagType
Stream or output control flags (1-byte width)
label labelToken() const
Return label value.
double doubleScalar
A typedef for double.
bool isLabel() const noexcept
Token is LABEL.
Abstract base class for complex tokens.
A class for handling words, derived from Foam::string.
A templated class for holding compound tokens.
A helper class for outputting values to Ostream.
bool isBool() const noexcept
Token is BOOL.
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))
bool isDouble() const noexcept
Token is DOUBLE.
Reference counter for various OpenFOAM components.
label lineNumber() const noexcept
The line number for the token.
virtual void write(Ostream &os) const
Redirect write to underlying content.
const string & stringToken() const
Return const reference to the string contents.
virtual ~compound() noexcept=default
Destructor.
bool isFloatScalar() const
Token is FLOAT.
float floatScalar
A typedef for float.
bool isStringType() const noexcept
Token is WORD, DIRECTIVE, STRING, VARIABLE or VERBATIM.
End string with double quote.
bool boolToken() const
Return boolean token value.
A dictionary #directive (word variant)
static bool isseparator(int c) noexcept
True if the character is a punctuation separator (eg, in ISstream).
single character punctuation
Istream & operator>>(Istream &, directionInfo &)
A token holds an item read from Istream.
virtual void write(Ostream &os) const =0
Redirect write to underlying content.
bool isFloat() const noexcept
Token is FLOAT.
const compound & compoundToken() const
Read access for compound token.
A token error encountered.
declareRunTimeSelectionTable(autoPtr, compound, Istream,(Istream &is),(is))
Declare run-time constructor selection table.
TypeName("compound")
Declare type-name, virtual type (with debug switch)
punctuationToken pToken() const
Return punctuation character.
bool isVariable() const noexcept
Token is VARIABLE (string variant)
bool isWord() const noexcept
Token is WORD or DIRECTIVE word.
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
bool empty() const noexcept
Has compound been transferred?
scalar number() const
Return label, float or double value.
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
Begin dimensions [isseparator].
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A dictionary $variable (string variant)
bool operator!=(const token &tok) const
virtual label size() const
The size of the underlying content.
void reset()
Reset token to UNDEFINED and clear any allocated storage.
Compound(T &&val)
Move construct.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
floatScalar floatScalarToken() const
Return float value.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
bool isFlag() const noexcept
Token is FLAG.
friend Ostream & operator<<(Ostream &os, const token &tok)
static bool isCompound(const word &name)
Test if name is a known (registered) compound type.
bool isSeparator() const noexcept
Token is PUNCTUATION and isseparator.
static const token undefinedToken
An undefined token.
tokenType
Enumeration defining the types of token.
Compound type such as List<label> etc.
bool & empty() noexcept
Access to empty.
End dimensions [isseparator].
Hash - directive or verbatim string.
bool isScalar() const noexcept
Token is FLOAT or DOUBLE.
bool operator==(const token &tok) const
floatScalar floatToken() const
Return float value.
compound & transferCompoundToken()
Return reference to compound and mark internally as released.
Begin block [isseparator].
doubleScalar doubleToken() const
Return double value.
const word & wordToken() const
Return const reference to the word contents.
bool isDirective() const noexcept
Token is DIRECTIVE (word variant)
virtual label size() const =0
The size of the underlying content.
static constexpr const char *const typeName
The type name is "token".
friend Ostream & operator<<(Ostream &os, const compound &ct)
Output operator.
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
void swap(token &tok)
Swap token contents: type, data, line-number.
bool isVerbatim() const noexcept
Token is VERBATIM string (string variant)
tokenType type() const noexcept
Return the token type.
TypeName("Compound<T>")
Declare type-name, virtual type (with debug switch)
stream flag (1-byte bitmask)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
float (single-precision) type
Compound(const T &val)
Copy construct.
scalar scalarToken() const
Return float or double value.
word name() const
Return the name of the token type.
Macros to ease declaration of run-time selection tables.
static token flag(int bitmask) noexcept
Create a token with stream flags, no sanity check.
bool undefined() const noexcept
Token is UNDEFINED.
constexpr compound() noexcept
Default construct.
bool isString() const noexcept
Token is STRING, VARIABLE or VERBATIM string.
doubleScalar doubleScalarToken() const
Return double value.
bool isCompound() const noexcept
Token is COMPOUND.
const dimensionedScalar c
Speed of light in a vacuum.
int flagToken() const
Return flag bitmask value.
static autoPtr< compound > New(const word &type, Istream &is)
Construct compound from Istream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
The TAB Method for Numerical Calculation of Spray Droplet Breakup.
Begin list [isseparator].
bool setType(const tokenType tokType) noexcept
Change the token type, for similar types.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
double (double-precision) type
Begin string with double quote.
punctuationToken
Standard punctuation tokens (a character)
void operator=(const token &tok)
Copy assign.
void setBad()
Clear token and set to be ERROR.