A class for handling keywords in dictionaries. More...
Public Member Functions | |
keyType () | |
Construct null. More... | |
keyType (const keyType &) | |
Copy constructor. More... | |
keyType (const word &) | |
Construct as word. More... | |
keyType (const functionName &) | |
Construct as functionName. More... | |
keyType (const variable &) | |
Construct as variable. More... | |
keyType (const string &) | |
Construct as pattern. More... | |
keyType (const char *) | |
Construct as word from character array. More... | |
keyType (const token &) | |
Construct from token. More... | |
keyType (Istream &) | |
Construct from Istream. More... | |
bool | isUndefined () const |
Return true if the type has not been defined. More... | |
bool | isFunctionName () const |
Return true if the keyword is a functionName. More... | |
bool | isVariable () const |
Return true if the keyword is a variable. More... | |
bool | isPattern () const |
Should be treated as a match rather than a literal string. More... | |
bool | match (const std::string &, bool literalMatch=false) const |
Smart match as regular expression or as a string. More... | |
void | operator= (const keyType &) |
Assignment operator. More... | |
void | operator= (const functionName &) |
Assign as functionName. More... | |
void | operator= (const variable &) |
Assign as variable. More... | |
void | operator= (const word &) |
Assign as word. More... | |
void | operator= (const string &) |
Assign as pattern. More... | |
void | operator= (const char *) |
Assign as word. More... | |
void | operator= (const std::string &)=delete |
Disallow assignments where we cannot determine string/word type. More... | |
void | operator= (const token &) |
Assign from token setting the appropriate type. More... | |
Public Member Functions inherited from variable | |
variable () | |
Construct null. More... | |
variable (const variable &) | |
Copy constructor. More... | |
variable (const word &) | |
Copy constructor of word. More... | |
variable (const string &, const bool doStripInvalid=true) | |
Copy constructor of string. More... | |
variable (const std::string &, const bool doStripInvalid=true) | |
Copy constructor of std::string. More... | |
variable (const char *, const bool doStripInvalid=true) | |
Copy constructor of character array. More... | |
variable (Istream &) | |
Construct from Istream. More... | |
void | operator= (const variable &) |
void | operator= (const word &) |
void | operator= (const string &) |
void | operator= (const std::string &) |
void | operator= (const char *) |
Public Member Functions inherited from word | |
word () | |
Construct null. More... | |
word (const word &) | |
Copy constructor. More... | |
word (const char *, const bool doStripInvalid=true) | |
Copy constructor of character array. More... | |
word (const char *, const size_type, const bool doStripInvalid) | |
Copy constructor with a maximum number of characters. More... | |
word (const string &, const bool doStripInvalid=true) | |
Copy constructor of string. More... | |
word (const std::string &, const bool doStripInvalid=true) | |
Copy constructor of std::string. More... | |
word (Istream &) | |
Construct from Istream. More... | |
word | capitalise () const |
Return the word with the first letter capitalised. More... | |
void | operator= (const word &) |
void | operator= (const string &) |
void | operator= (const std::string &) |
void | operator= (const char *) |
Public Member Functions inherited from string | |
string () | |
Construct null. More... | |
string (const std::string &) | |
Construct from std::string. More... | |
string (const string &) | |
Copy constructor. More... | |
string (string &&) | |
Move constructor. More... | |
string (const char *) | |
Construct as copy of character array. More... | |
string (const UList< char > &) | |
Construct as copy of UList of character. More... | |
string (const char *, const size_type) | |
Construct as copy of specified number of characters. More... | |
string (const char) | |
Construct from a single character. More... | |
string (const size_type, const char) | |
Construct from copies of a single character. More... | |
string (Istream &) | |
Construct from Istream. More... | |
size_type | count (const char) const |
Count and return the number of a given character in the string. More... | |
bool | match (const std::string &) const |
True when strings match literally. More... | |
string & | replace (const string &oldStr, const string &newStr, size_type start=0) |
Replace first occurrence of sub-string oldStr with newStr. More... | |
string & | replaceAll (const string &oldStr, const string &newStr, size_type start=0) |
Replace all occurrences of sub-string oldStr with newStr. More... | |
string & | expand (const bool allowEmpty=false) |
Expand initial tildes and all occurrences of environment variables. More... | |
bool | removeRepeated (const char) |
Remove repeated characters returning true if string changed. More... | |
string | removeRepeated (const char) const |
Return string with repeated characters removed. More... | |
bool | removeTrailing (const char) |
Remove trailing character returning true if string changed. More... | |
string | removeTrailing (const char) const |
Return string with trailing character removed. More... | |
bool | removeTrailing (const string &) |
Remove trailing string returning true if string changed. More... | |
string | removeTrailing (const string &) const |
Return string with trailing string removed. More... | |
void | strip (const string &) |
Strip characters from the start and end of the string. More... | |
string | operator() (const size_type i, const size_type n) const |
Return the sub-string from the i-th character for n characters. More... | |
string | operator() (const size_type n) const |
Return the sub-string from the first character for n characters. More... | |
void | operator= (const string &) |
void | operator= (string &&) |
template<class String > | |
Foam::string | quotemeta (const string &str, const char quote) |
Static Public Attributes | |
static const keyType | null |
An empty keyType. More... | |
Static Public Attributes inherited from variable | |
static const char *const | typeName = "variable" |
static int | debug |
static const variable | null |
An empty variable. More... | |
Static Public Attributes inherited from word | |
static const char *const | typeName = "word" |
static int | debug |
static const word | null |
An empty word. More... | |
Static Public Attributes inherited from string | |
static const char *const | typeName = "string" |
static int | debug |
static const string | null |
An empty string. More... | |
Friends | |
Istream & | operator>> (Istream &, keyType &) |
Ostream & | operator<< (Ostream &, const keyType &) |
Additional Inherited Members | |
Static Public Member Functions inherited from variable | |
static bool | valid (char) |
Is this character valid for a variable. More... | |
Static Public Member Functions inherited from word | |
static bool | valid (char) |
Is this character valid for a word. More... | |
Static Public Member Functions inherited from string | |
template<class String > | |
static bool | valid (const string &) |
Is this string type valid? More... | |
template<class String > | |
static bool | meta (const string &, const char quote='\\') |
Does this string have particular meta-characters? More... | |
template<class String > | |
static bool | stripInvalid (string &) |
Strip invalid characters from the given string. More... | |
template<class String > | |
static String | validate (const string &) |
Return a valid String from the given string. More... | |
template<class String > | |
static string | quotemeta (const string &, const char quote='\\') |
Return a String with quoted meta-characters from the given string. More... | |
A class for handling keywords in dictionaries.
A keyType is the keyword of a dictionary. It differs from word in that it accepts patterns (regular expressions).
|
inline |
Construct null.
Definition at line 28 of file keyTypeI.H.
Copy constructor.
Definition at line 35 of file keyTypeI.H.
Construct as word.
Definition at line 42 of file keyTypeI.H.
|
inlineexplicit |
Construct as functionName.
Definition at line 49 of file keyTypeI.H.
Construct as variable.
Definition at line 56 of file keyTypeI.H.
Construct as pattern.
Definition at line 63 of file keyTypeI.H.
|
inline |
Construct as word from character array.
Definition at line 70 of file keyTypeI.H.
Construct from token.
Definition at line 37 of file keyType.C.
References keyType::operator=().
Construct from Istream.
Definition at line 46 of file keyType.C.
References keyType::match().
|
inline |
Return true if the type has not been defined.
Definition at line 79 of file keyTypeI.H.
Referenced by Foam::operator>>().
|
inline |
Return true if the keyword is a functionName.
Definition at line 85 of file keyTypeI.H.
Referenced by entry::New().
|
inline |
Return true if the keyword is a variable.
Definition at line 91 of file keyTypeI.H.
Referenced by entry::New().
|
inline |
Should be treated as a match rather than a literal string.
Definition at line 97 of file keyTypeI.H.
Referenced by dictionary::add(), dictionary::changeKeyword(), keyType::match(), Foam::operator<<(), wordRe::operator=(), GeometricField< Type, PatchField, GeoMesh >::Boundary::readField(), and wordRe::wordRe().
bool match | ( | const std::string & | str, |
bool | literalMatch = false |
||
) | const |
Smart match as regular expression or as a string.
Optionally force a literal match only
Definition at line 58 of file keyType.C.
References keyType::isPattern(), and regExp::match().
Referenced by keyType::keyType().
|
inline |
Assignment operator.
Definition at line 105 of file keyTypeI.H.
References variable::operator=().
Referenced by keyType::keyType(), and keyType::operator=().
|
inline |
Assign as functionName.
Definition at line 119 of file keyTypeI.H.
References word::operator=().
|
inline |
Assign as variable.
Definition at line 126 of file keyTypeI.H.
References variable::operator=().
|
inline |
Assign as word.
Definition at line 112 of file keyTypeI.H.
References variable::operator=().
|
inline |
Assign as pattern.
Definition at line 133 of file keyTypeI.H.
References string::operator=().
|
inline |
Assign as word.
Definition at line 140 of file keyTypeI.H.
References word::operator=().
|
delete |
Disallow assignments where we cannot determine string/word type.
void operator= | ( | const token & | t | ) |
Assign from token setting the appropriate type.
Definition at line 78 of file keyType.C.
References clear(), Foam::exit(), FatalErrorInFunction, Foam::FatalIOError, token::functionNameToken(), token::isFunctionName(), token::isString(), token::isVariable(), token::isWord(), keyType::operator=(), token::stringToken(), token::variableToken(), and token::wordToken().
|
static |