Public Member Functions | |
exprString ()=default | |
Default construct. More... | |
exprString (const exprString &rhs)=default | |
Copy construct. More... | |
exprString (exprString &&rhs)=default | |
Move construct. More... | |
exprString (const std::string &s, bool doValidate=true) | |
Copy construct from std::string. More... | |
exprString (std::string &&s, bool doValidate=true) | |
Move construct from std::string. More... | |
exprString (const char *s, bool doValidate=true) | |
Construct as copy of character array. More... | |
exprString (const std::string &str, const dictionary &dict, const bool stripComments=true) | |
exprString (std::string &&str, const dictionary &dict, const bool stripComments=true) | |
exprString (Istream &is, const dictionary &dict, const bool stripComments=true) | |
~exprString ()=default | |
Destructor. More... | |
bool | valid () const |
Check for unexpanded '$' entries. Fatal if any exist. More... | |
void | expand (const dictionary &dict, const bool stripComments=true) |
void | trim () |
Inplace trim leading and trailing whitespace. More... | |
bool | readEntry (const word &keyword, const dictionary &dict, bool mandatory=true, const bool stripComments=true) |
exprString & | operator= (const exprString &str)=default |
Copy assign. More... | |
exprString & | operator= (exprString &&str)=default |
Move assign. More... | |
exprString & | operator= (const char *str) |
Copy assign from c-string. No expansions, no comment stripping. More... | |
exprString & | operator= (const std::string &str) |
Copy assign from string. No expansions, no comment stripping. More... | |
exprString & | operator= (std::string &&str) |
Move assign from string. No expansions, no comment stripping. More... | |
bool | writeEntry (const word &keyword, Ostream &os, bool writeEmpty=false) const |
![]() | |
string ()=default | |
Default construct. More... | |
string (const std::string &str) | |
Copy construct from std::string. More... | |
string (std::string &&str) | |
Move construct from std::string. More... | |
string (const char *str) | |
Construct as copy of character array. More... | |
string (const char *str, const size_type len) | |
Construct as copy with a maximum number of characters. More... | |
string (const char c) | |
Construct from a single character. More... | |
string (const size_type len, const char c) | |
Construct fill copies of a single character. More... | |
string (Istream &is) | |
Construct from Istream. More... | |
bool | match (const std::string &text) const |
Test for equality. More... | |
string & | replace (const std::string &s1, const std::string &s2, size_type pos=0) |
string & | replaceAll (const std::string &s1, const std::string &s2, size_type pos=0) |
string & | replaceAny (const std::string &s1, const char c2, size_type pos=0) |
string & | expand (const bool allowEmpty=false) |
bool | removeRepeated (const char character) |
Remove repeated characters. More... | |
bool | removeStart (const std::string &text) |
Remove the given text from the start of the string. More... | |
bool | removeStart (const char c) |
Remove leading character, unless string is a single character. More... | |
bool | removeEnd (const std::string &text) |
Remove the given text from the end of the string. More... | |
bool | removeEnd (const char c) |
Remove trailing character, unless string is a single character. More... | |
void | swap (std::string &str) |
Swap contents. Self-swapping is a no-op. More... | |
bool | operator() (const std::string &text) const |
Test for equality. Allows use as a predicate. More... | |
bool | starts_with (const std::string &s) const |
True if string starts with the given prefix (cf. C++20) More... | |
bool | starts_with (const char c) const |
True if string starts with the given character (cf. C++20) More... | |
bool | ends_with (const std::string &s) const |
True if string ends with the given suffix (cf. C++20) More... | |
bool | ends_with (const char c) const |
True if string ends with the given character (cf. C++20) More... | |
size_type | count (const char c) const |
bool | startsWith (const std::string &s) const |
Deprecated(2019-11) More... | |
bool | endsWith (const std::string &s) const |
Deprecated(2019-11) More... | |
bool | removeTrailing (const char c) |
Deprecated(2019-11) More... | |
Static Public Member Functions | |
static void | inplaceExpand (std::string &str, const dictionary &dict, const bool stripComments=true) |
static exprString | getEntry (const word &keyword, const dictionary &dict, const bool stripComments=true) |
static exprString | getOptional (const word &keyword, const dictionary &dict, const bool stripComments=true) |
static exprString | toExpr (const std::string &str) |
Copy convert string to exprString. More... | |
static exprString | toExpr (std::string &&str) |
Move convert string to exprString. More... | |
![]() | |
template<class StringType > | |
static bool | valid (const std::string &str) |
Does the string contain valid characters only? More... | |
template<class StringType > | |
static bool | stripInvalid (std::string &str) |
Strip invalid characters from the given string. More... | |
template<class StringType > | |
static StringType | validate (const std::string &str) |
Return a valid String from the given string. More... | |
Additional Inherited Members | |
![]() | |
static const char *const | typeName = "string" |
The type name "string". More... | |
static int | debug |
The debug flag. More... | |
static const string | null |
An empty string. More... | |
![]() | |
std::string::size_type | find_ext () const |
Find position of a file extension dot, return npos on failure. More... | |
word | ext () const |
Return file name extension (part after last .) More... | |
bool | ext (const word &ending) |
Append a '.' and the ending. More... | |
bool | hasPath () const |
Return true if it contains a '/' character. More... | |
bool | hasExt () const |
Return true if it has an extension or simply ends with a '.'. More... | |
bool | hasExt (const char *ending) const |
Return true if the extension is the same as the given ending. More... | |
bool | hasExt (const std::string &ending) const |
Return true if the extension is the same as the given ending. More... | |
bool | hasExt (const wordRe &ending) const |
Return true if the extension matches the given ending. More... | |
bool | removeExt () |
Remove extension, returning true if string changed. More... | |
bool | removePath () |
Remove leading path, returning true if string changed. More... | |
![]() | |
static std::string::size_type | find_ext (const std::string &str) |
Find position of a file extension dot, return npos on failure. More... | |
template<class PrimitiveType > | |
static std::string::size_type | string_printf (std::string &output, const char *fmt, const PrimitiveType &val) |
A printf-style formatter for a primitive. More... | |
template<class PrimitiveType > | |
static std::string::size_type | string_printf (std::string &output, const std::string &fmt, const PrimitiveType &val) |
A printf-style formatter for a primitive. More... | |
Definition at line 60 of file exprString.H.
|
default |
Default construct.
|
default |
Copy construct.
|
default |
Move construct.
|
inlineexplicit |
Copy construct from std::string.
Definition at line 34 of file exprStringI.H.
|
inlineexplicit |
Move construct from std::string.
Definition at line 51 of file exprStringI.H.
|
inlineexplicit |
Construct as copy of character array.
Definition at line 68 of file exprStringI.H.
|
inline |
Copy construct and expand with dictionary variables, and strip C/C++ comments from the input
Definition at line 85 of file exprStringI.H.
References dict, Foam::stringOps::expand(), and Foam::stringOps::removeComments().
|
inline |
Move construct and expand with dictionary variables, and strip C/C++ comments from the input
Definition at line 98 of file exprStringI.H.
References dict, Foam::stringOps::expand(), and Foam::stringOps::removeComments().
|
inline |
Construct from Istream and expand with dictionary variables, and strip C/C++ comments from the input
Definition at line 111 of file exprStringI.H.
References dict, Foam::stringOps::expand(), and Foam::stringOps::removeComments().
|
default |
Destructor.
|
static |
Inplace expansion with dictionary variables, and strip C/C++ comments from the input.
Definition at line 35 of file exprString.C.
References dict, Foam::stringOps::inplaceExpand(), and Foam::stringOps::inplaceRemoveComments().
|
static |
Get and expand expression with dictionary entries, optionally strip C/C++ comments from the input.
Expansion behaviour as per inplaceExpand
keyword | Lookup key. Uses LITERAL (not REGEX) |
Definition at line 52 of file exprString.C.
References dict, Foam::glTF::key(), and exprString::readEntry().
|
static |
Get and expand expression with dictionary entries, optionally strip C/C++ comments from the input.
Expansion behaviour as per inplaceExpand
keyword | Lookup key. Uses LITERAL (not REGEX) |
Definition at line 67 of file exprString.C.
References dict, Foam::glTF::key(), and exprString::readEntry().
|
inlinestatic |
Copy convert string to exprString.
No expansions, know what you are doing.
Definition at line 143 of file exprStringI.H.
Referenced by exprDriver::addVariables().
|
inlinestatic |
Move convert string to exprString.
No expansions, know what you are doing.
Definition at line 154 of file exprStringI.H.
|
inline |
Check for unexpanded '$' entries. Fatal if any exist.
Definition at line 125 of file exprStringI.H.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::ListOps::find(), and Foam::nl.
void expand | ( | const dictionary & | dict, |
const bool | stripComments = true |
||
) |
Inplace expansion with dictionary variables, and strip C/C++ comments from the input
Definition at line 83 of file exprString.C.
References dict, and Foam::stringOps::inplaceExpand().
void trim | ( | ) |
Inplace trim leading and trailing whitespace.
Definition at line 96 of file exprString.C.
References Foam::stringOps::inplaceTrim().
bool readEntry | ( | const word & | keyword, |
const dictionary & | dict, | ||
bool | mandatory = true , |
||
const bool | stripComments = true |
||
) |
Read/expand entry with dictionary variables, and strip C/C++ comments from the input
keyword | Lookup key. Uses LITERAL (not REGEX) |
Definition at line 103 of file exprString.C.
References clear(), dict, Foam::stringOps::expand(), and keyType::LITERAL.
Referenced by exprString::getEntry(), and exprString::getOptional().
|
default |
Copy assign.
|
default |
Move assign.
|
inline |
Copy assign from c-string. No expansions, no comment stripping.
Definition at line 167 of file exprStringI.H.
|
inline |
Copy assign from string. No expansions, no comment stripping.
Definition at line 180 of file exprStringI.H.
|
inline |
Move assign from string. No expansions, no comment stripping.
Definition at line 193 of file exprStringI.H.
Dictionary entry for expression string, normally suppressing empty strings. Generally used verbatim output (readability)
Definition at line 126 of file exprString.C.
References os(), and token::setType().