Go to the documentation of this file.
63 Ostream&
operator<<(Ostream& os,
const token& tok);
212 virtual label
size()
const = 0;
248 operator<<(os, static_cast<const T&>(*
this));
295 inline void setUndefined();
298 void parseError(
const char* expected)
const;
306 static constexpr
const char*
const typeName =
"token";
312 inline constexpr
token() noexcept;
355 inline static
token boolean(
bool on);
397 inline
bool good() const;
403 inline
bool error() const;
406 inline
bool isBool() const;
409 inline
bool isFlag() const;
433 inline
bool isWord() const;
488 inline scalar
number() const;
556 inline void operator=(
const string& str);
565 inline void operator=(compound* compoundPtr);
572 inline bool operator==(
const label val)
const;
575 inline bool operator==(
const std::string&
s)
const;
582 inline bool operator!=(
const label val)
const;
585 inline bool operator!=(
const std::string&
s)
const;
632 Ostream&
operator<<(Ostream& os,
const token::compound& ct);
634 ostream&
operator<<(ostream& os,
const InfoProxy<token>& ip);
637 Ostream&
operator<<(Ostream& os,
const InfoProxy<token>& ip);
642 #define defineCompoundTypeName(Type, Name) \
643 defineTemplateTypeNameAndDebugWithName(token::Compound<Type>, #Type, 0);
645 #define addCompoundToRunTimeSelectionTable(Type, Name) \
646 token::compound::addIstreamConstructorToTable<token::Compound<Type>> \
647 add##Name##IstreamConstructorToTable_;
Subtract or start of negative number.
bool isDoubleScalar() const
Token is DOUBLE.
static token flag(int bitmask)
Create a token with stream flags, no sanity check.
Assignment/equals [isseparator].
bool isFlag() const
Token is FLAG.
flagType
Stream or output control flags (1-byte width)
label labelToken() const
Return label value.
double doubleScalar
A typedef for double.
bool isScalar() const
Token is FLOAT or DOUBLE.
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.
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 isNumber() const
Token is LABEL, FLOAT or DOUBLE.
Reference counter for various OpenFOAM components.
const string & stringToken() const
Return const reference to the string contents.
bool isFloatScalar() const
Token is FLOAT.
float floatScalar
A typedef for float.
bool isString() const
Token is STRING, VARIABLE or VERBATIM string.
End string with double quote.
bool boolToken() const
Return boolean token value.
bool isDirective() const
Token is DIRECTIVE (word variant)
A dictionary #directive (word variant)
single character punctuation
Istream & operator>>(Istream &, directionInfo &)
A token holds an item read from Istream.
virtual void write(Ostream &os) const =0
const compound & compoundToken() const
Read access for compound token.
bool isSeparator() const
Token is PUNCTUATION and isseparator.
A token error encountered.
bool good() const
True if token is not UNDEFINED or ERROR.
declareRunTimeSelectionTable(autoPtr, compound, Istream,(Istream &is),(is))
Declare run-time constructor selection table.
bool isCompound() const
Token is COMPOUND.
TypeName("compound")
Declare type-name, virtual type (with debug switch)
punctuationToken pToken() const
Return punctuation character.
static bool isseparator(int c)
True if the character is a punctuation separator (eg, in ISstream).
bool isLabel() const
Token is LABEL.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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
void reset()
Reset token to UNDEFINED and clear any allocated storage.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
bool isVariable() const
Token is VARIABLE (string variant)
floatScalar floatScalarToken() const
Return float value.
virtual ~compound()=default
Destructor.
friend Ostream & operator<<(Ostream &os, const token &tok)
compound & transferCompoundToken(const Istream &is)
static bool isCompound(const word &name)
Return true if name is a known (registered) compound type.
void write(Ostream &os) const
static const token undefinedToken
An undefined token.
tokenType
Enumeration defining the types of token.
Compound type such as List<label> etc.
bool isWord() const
Token is WORD or DIRECTIVE word.
End dimensions [isseparator].
bool isDouble() const
Token is DOUBLE.
Hash - directive or verbatim string.
bool operator==(const token &tok) const
floatScalar floatToken() const
Return float value.
Begin block [isseparator].
doubleScalar doubleToken() const
Return double value.
const word & wordToken() const
Return const reference to the word contents.
virtual label size() const =0
static constexpr const char *const typeName
The type name is "token".
friend Ostream & operator<<(Ostream &os, const compound &ct)
Output operator.
void swap(token &tok)
Swap token contents: type, data, line-number.
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
tokenType type() const
Return the token type.
bool isBool() const
Token is BOOL.
scalar scalarToken() const
Return float or double value.
bool setType(const tokenType tokType)
Change the token type, for similar types.
word name() const
Return the name of the token type.
Macros to ease declaration of run-time selection tables.
bool isVerbatim() const
Token is VERBATIM string (string variant)
doubleScalar doubleScalarToken() const
Return double value.
bool isFloat() const
Token is FLOAT.
compound()
Default construct.
const dimensionedScalar c
Speed of light in a vacuum.
constexpr token() noexcept
Default construct, initialized to an UNDEFINED token.
bool undefined() const
Token is UNDEFINED.
int flagToken() const
Return flag bitmask value.
static autoPtr< compound > New(const word &type, Istream &is)
Select null constructed.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label lineNumber() const
The line number for the token.
The TAB Method for Numerical Calculation of Spray Droplet Breakup.
bool isPunctuation() const
Token is PUNCTUATION.
Begin list [isseparator].
Class to handle errors and exceptions in a simple, consistent stream-based manner.
double (double-precision) type
bool isStringType() const
Token is WORD, DIRECTIVE, STRING, VARIABLE or VERBATIM.
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.