exprString Class Reference
Inheritance diagram for exprString:
[legend]
Collaboration diagram for exprString:
[legend]

Public Member Functions

 exprString ()=default
 Construct null. 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...
 
exprStringexpand (const dictionary &dict, const bool stripComments=true)
 
bool valid () const
 Check for unexpanded '$' entries. Fatal if any exist. More...
 
exprStringoperator= (const exprString &str)=default
 Copy assign. More...
 
exprStringoperator= (exprString &&str)=default
 Move assign. More...
 
exprStringoperator= (const char *str)
 Copy assign from c-string. No expansions, no comment stripping. More...
 
exprStringoperator= (const std::string &str)
 Copy assign from string. No expansions, no comment stripping. More...
 
exprStringoperator= (std::string &&str)
 Move assign from string. No expansions, no comment stripping. More...
 
- Public Member Functions inherited from string
 string ()=default
 Construct null. 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...
 
stringreplace (const std::string &s1, const std::string &s2, size_type pos=0)
 
stringreplaceAll (const std::string &s1, const std::string &s2, size_type pos=0)
 
stringreplaceAny (const std::string &s1, const char c2, size_type pos=0)
 
stringexpand (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...
 
template<class String >
Foam::string quotemeta (const std::string &str, const char quote)
 

Static Public Member Functions

static void inplaceExpand (std::string &str, const dictionary &dict, const bool stripComments=true)
 
static exprString getExpression (const word &name, const dictionary &dict, const bool stripComments=false)
 
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...
 
- Static Public Member Functions inherited from string
template<class String >
static bool valid (const std::string &str)
 Does the string contain valid characters only? More...
 
template<class String >
static bool meta (const std::string &str, const char quote='\\')
 Does this string contain meta-characters? More...
 
template<class String >
static bool stripInvalid (std::string &str)
 Strip invalid characters from the given string. More...
 
template<class String >
static String validate (const std::string &str)
 Return a valid String from the given string. More...
 
template<class String >
static string quotemeta (const std::string &str, const char quote='\\')
 Return a String with quoted meta-characters from the given string. More...
 

Additional Inherited Members

- Static Public Attributes inherited from string
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...
 
- Protected Member Functions inherited from string
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 word &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 Protected Member Functions inherited from string
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...
 

Detailed Description

Definition at line 60 of file exprString.H.

Constructor & Destructor Documentation

◆ exprString() [1/9]

exprString ( )
default

Construct null.

◆ exprString() [2/9]

exprString ( const exprString rhs)
default

Copy construct.

◆ exprString() [3/9]

exprString ( exprString &&  rhs)
default

Move construct.

◆ exprString() [4/9]

exprString ( const std::string &  s,
bool  doValidate = true 
)
inlineexplicit

Copy construct from std::string.

Definition at line 34 of file exprStringI.H.

◆ exprString() [5/9]

exprString ( std::string &&  s,
bool  doValidate = true 
)
inlineexplicit

Move construct from std::string.

Definition at line 51 of file exprStringI.H.

◆ exprString() [6/9]

exprString ( const char *  s,
bool  doValidate = true 
)
inlineexplicit

Construct as copy of character array.

Definition at line 68 of file exprStringI.H.

◆ exprString() [7/9]

exprString ( const std::string &  str,
const dictionary dict,
const bool  stripComments = true 
)
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().

Here is the call graph for this function:

◆ exprString() [8/9]

exprString ( std::string &&  str,
const dictionary dict,
const bool  stripComments = true 
)
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().

Here is the call graph for this function:

◆ exprString() [9/9]

exprString ( Istream is,
const dictionary dict,
const bool  stripComments = true 
)
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().

Here is the call graph for this function:

◆ ~exprString()

~exprString ( )
default

Destructor.

Member Function Documentation

◆ inplaceExpand()

void inplaceExpand ( std::string &  str,
const dictionary dict,
const bool  stripComments = true 
)
static

Inplace expansion with dictionary variables, and strip C/C++ comments from the input.

Expansion behaviour
  • alternatives = True
  • environment = True
  • allow empty = True
  • subDict = False

Definition at line 35 of file exprString.C.

References dict, Foam::stringOps::inplaceExpand(), and Foam::stringOps::inplaceRemoveComments().

Here is the call graph for this function:

◆ getExpression()

Foam::expressions::exprString getExpression ( const word name,
const dictionary dict,
const bool  stripComments = false 
)
static

Get and expand expression with dictionary entries, optionally strip C/C++ comments from the input.

Expansion behaviour as per inplaceExpand

Definition at line 52 of file exprString.C.

References dict, Foam::stringOps::inplaceExpand(), and Foam::name().

Here is the call graph for this function:

◆ toExpr() [1/2]

Foam::expressions::exprString toExpr ( const std::string &  str)
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().

Here is the caller graph for this function:

◆ toExpr() [2/2]

Foam::expressions::exprString toExpr ( std::string &&  str)
inlinestatic

Move convert string to exprString.

No expansions, know what you are doing.

Definition at line 154 of file exprStringI.H.

◆ expand()

Foam::expressions::exprString & expand ( const dictionary dict,
const bool  stripComments = true 
)

Inplace expansion with dictionary variables, and strip C/C++ comments from the input

Definition at line 74 of file exprString.C.

References dict, and Foam::stringOps::inplaceExpand().

Here is the call graph for this function:

◆ valid()

bool valid ( ) const
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.

Here is the call graph for this function:

◆ operator=() [1/5]

exprString& operator= ( const exprString str)
default

Copy assign.

◆ operator=() [2/5]

exprString& operator= ( exprString &&  str)
default

Move assign.

◆ operator=() [3/5]

Foam::expressions::exprString & operator= ( const char *  str)
inline

Copy assign from c-string. No expansions, no comment stripping.

Definition at line 167 of file exprStringI.H.

◆ operator=() [4/5]

Foam::expressions::exprString & operator= ( const std::string &  str)
inline

Copy assign from string. No expansions, no comment stripping.

Definition at line 180 of file exprStringI.H.

◆ operator=() [5/5]

Foam::expressions::exprString & operator= ( std::string &&  str)
inline

Move assign from string. No expansions, no comment stripping.

Definition at line 193 of file exprStringI.H.


The documentation for this class was generated from the following files: