A class for handling keywords in dictionaries. More...
Public Member Functions | |
keyType () | |
Construct null. More... | |
keyType (const keyType &) | |
Construct as copy. More... | |
keyType (const word &) | |
Construct as copy of word. Not treated as a regular expression. More... | |
keyType (const string &) | |
Construct as copy of string. Treat as regular expression. More... | |
keyType (const char *) | |
Construct as copy of character array. More... | |
keyType (const std::string &, const bool isPattern) | |
Construct as copy of std::string with specified treatment. More... | |
keyType (Istream &) | |
Construct from Istream. 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... | |
const keyType & | operator= (const keyType &) |
Assignment operator. More... | |
const keyType & | operator= (const word &) |
Assign as word, not as non regular expression. More... | |
const keyType & | operator= (const string &) |
Assign as regular expression. More... | |
const keyType & | operator= (const char *) |
Assign as word, not as non regular expression. More... | |
![]() | |
word () | |
Construct null. More... | |
word (const word &) | |
Construct as copy. More... | |
word (const char *, const bool doStripInvalid=true) | |
Construct as copy of character array. More... | |
word (const char *, const size_type, const bool doStripInvalid) | |
Construct as copy with a maximum number of characters. More... | |
word (const string &, const bool doStripInvalid=true) | |
Construct as copy of string. More... | |
word (const std::string &, const bool doStripInvalid=true) | |
Construct as copy of std::string. More... | |
word (Istream &) | |
Construct from Istream. More... | |
const word & | operator= (const word &) |
const word & | operator= (const string &) |
const word & | operator= (const std::string &) |
const word & | operator= (const char *) |
![]() | |
string () | |
Construct null. More... | |
string (const std::string &) | |
Construct from std::string. More... | |
string (const char *) | |
Construct as copy of character array. 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 (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 occurence of sub-string oldStr with newStr. More... | |
string & | replaceAll (const string &oldStr, const string &newStr, size_type start=0) |
Replace all occurences of sub-string oldStr with newStr. More... | |
string & | expand (const bool allowEmpty=false) |
Expand initial tildes and all occurences 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... | |
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... | |
template<class String > | |
Foam::string | quotemeta (const string &str, const char quote) |
Static Public Attributes | |
static const keyType | null |
An empty keyType. More... | |
![]() | |
static const char *const | typeName = "word" |
static int | debug |
static const word | null |
An empty word. More... | |
![]() | |
static const char *const | typeName = "string" |
static int | debug |
static const string | null |
An empty string. More... | |
Private Member Functions | |
void | operator= (const std::string &) |
Disallow assignments where we cannot determine string/word type. More... | |
Private Attributes | |
bool | isPattern_ |
Is the keyType a pattern (regular expression) More... | |
Friends | |
Istream & | operator>> (Istream &, keyType &) |
Ostream & | operator<< (Ostream &, const keyType &) |
Additional Inherited Members | |
![]() | |
static bool | valid (char) |
Is this character valid for a word. More... | |
![]() | |
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.
Construct as copy.
Definition at line 35 of file keyTypeI.H.
Construct as copy of word. Not treated as a regular expression.
Definition at line 42 of file keyTypeI.H.
Construct as copy of string. Treat as regular expression.
Definition at line 49 of file keyTypeI.H.
|
inline |
Construct as copy of character array.
Not treated as a regular expression
Definition at line 56 of file keyTypeI.H.
|
inline |
Construct as copy of std::string with specified treatment.
Definition at line 64 of file keyTypeI.H.
|
private |
Disallow assignments where we cannot determine string/word type.
|
inline |
Should be treated as a match rather than a literal string.
Definition at line 76 of file keyTypeI.H.
Referenced by dictionary::add(), dictionary::changeKeyword(), coordinateSystems::findIndex(), ZoneMesh< cellZone, polyMesh >::findIndex(), polyBoundaryMesh::findIndex(), coordinateSystems::findIndices(), ZoneMesh< cellZone, polyMesh >::findIndices(), polyBoundaryMesh::findIndices(), findMatches(), merge(), wordRe::operator=(), wordRe::wordRe(), Ostream::write(), and Ostream::writeKeyword().
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 52 of file keyType.C.
References regExp::match().
|
inline |
Assignment operator.
Definition at line 84 of file keyTypeI.H.
References s().
|
inline |
Assign as word, not as non regular expression.
Definition at line 93 of file keyTypeI.H.
References word::operator=(), and s().
|
inline |
Assign as regular expression.
Definition at line 101 of file keyTypeI.H.
References s().
|
inline |
Assign as word, not as non regular expression.
Definition at line 110 of file keyTypeI.H.
References s().
|
private |
|
static |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.