mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: minor adjustments to token methods for more granularity
This commit is contained in:
@ -87,7 +87,7 @@ public:
|
|||||||
|
|
||||||
// Pointer types
|
// Pointer types
|
||||||
WORD, //!< A Foam::word
|
WORD, //!< A Foam::word
|
||||||
STRING, //!< A string
|
STRING, //!< A string (usually double-quoted)
|
||||||
DIRECTIVE, //!< A dictionary \c \#directive (word variant)
|
DIRECTIVE, //!< A dictionary \c \#directive (word variant)
|
||||||
VARIABLE, //!< A dictionary \c \$variable (string variant)
|
VARIABLE, //!< A dictionary \c \$variable (string variant)
|
||||||
VERBATIM, //!< Verbatim string content
|
VERBATIM, //!< Verbatim string content
|
||||||
@ -456,6 +456,9 @@ public:
|
|||||||
//- Token is LABEL
|
//- Token is LABEL
|
||||||
inline bool isLabel() const noexcept;
|
inline bool isLabel() const noexcept;
|
||||||
|
|
||||||
|
//- True if token is LABEL and equal to parameter
|
||||||
|
inline bool isLabel(const label val) const noexcept;
|
||||||
|
|
||||||
//- Token is FLOAT
|
//- Token is FLOAT
|
||||||
inline bool isFloat() const noexcept;
|
inline bool isFloat() const noexcept;
|
||||||
|
|
||||||
@ -477,7 +480,10 @@ public:
|
|||||||
//- Token is DIRECTIVE (word variant)
|
//- Token is DIRECTIVE (word variant)
|
||||||
inline bool isDirective() const noexcept;
|
inline bool isDirective() const noexcept;
|
||||||
|
|
||||||
//- Token is STRING, VARIABLE or VERBATIM string
|
//- Token is (quoted) STRING (string variant)
|
||||||
|
inline bool isQuotedString() const noexcept;
|
||||||
|
|
||||||
|
//- Token is STRING, VARIABLE or VERBATIM (string variant)
|
||||||
inline bool isString() const noexcept;
|
inline bool isString() const noexcept;
|
||||||
|
|
||||||
//- Token is VARIABLE (string variant)
|
//- Token is VARIABLE (string variant)
|
||||||
|
|||||||
@ -496,6 +496,16 @@ inline bool Foam::token::isLabel() const noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::token::isLabel(const label val) const noexcept
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
type_ == tokenType::LABEL
|
||||||
|
&& data_.labelVal == val
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::token::labelToken() const
|
inline Foam::label Foam::token::labelToken() const
|
||||||
{
|
{
|
||||||
if (type_ == tokenType::LABEL)
|
if (type_ == tokenType::LABEL)
|
||||||
@ -630,6 +640,12 @@ inline const Foam::word& Foam::token::wordToken() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::token::isQuotedString() const noexcept
|
||||||
|
{
|
||||||
|
return (type_ == tokenType::STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::token::isString() const noexcept
|
inline bool Foam::token::isString() const noexcept
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
@ -921,11 +937,7 @@ inline bool Foam::token::operator==(const std::string& s) const
|
|||||||
|
|
||||||
inline bool Foam::token::operator==(const label val) const noexcept
|
inline bool Foam::token::operator==(const label val) const noexcept
|
||||||
{
|
{
|
||||||
return
|
return isLabel(val);
|
||||||
(
|
|
||||||
type_ == tokenType::LABEL
|
|
||||||
&& data_.labelVal == val
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user