Base class for substitution models. More...
#include <substitutionModel.H>


Public Member Functions | |
| TypeName ("substitutionModel") | |
| Runtime type information. | |
| declareRunTimeSelectionTable (autoPtr, substitutionModel, dictionary,(const dictionary &dict, const Time &time),(dict, time)) | |
| substitutionModel (const dictionary &dict, const Time &time) | |
| Constructor. | |
| virtual | ~substitutionModel ()=default |
| Destructor. | |
| virtual bool | update () |
| Update model local data. | |
| virtual bool | valid (const word &keyName) const =0 |
| Return true of model applies to this keyName. | |
| virtual bool | apply (const word &key, string &buffer) const =0 |
| Apply substitutions to this string buffer. | |
| virtual wordList | keys () const =0 |
| Return a word list of the keys. | |
Static Public Member Functions | |
| static string | keyify (const word &w) |
| Return a key representation from a word. | |
| static word | cleanKey (const string &str) |
| Clean the key text. | |
| static wordList | getKeys (string &buffer) |
| Return all keys from a string buffer. | |
| static void | addBuiltinStr (const word &key, const string &value) |
| Add a builtin to the hash table - does not overwrite. | |
| template<class Type> | |
| static void | addBuiltin (const word &key, const Type &value) |
| Add a builtin to the hash table - does not overwrite. | |
| static bool | containsBuiltin (const word &key) |
| Return true if key is builtin. | |
| static void | setBuiltinStr (const word &key, const string &value) |
| Set a builtin to the hash table. | |
| template<class Type> | |
| static void | setBuiltin (const word &key, const Type &value) |
| Set a builtin to the hash table. | |
| static bool | replaceBuiltin (const word &key, string &str) |
| Replace key in string. | |
| static bool | replaceBuiltin (string &str) |
| Replace all occurrences of key in string. | |
| static void | writeBuiltins (Ostream &os) |
| Write all builtins to stream. | |
| static autoPtr< substitutionModel > | New (const dictionary &dict, const Time &time) |
| Return a reference to the selected substitution model. | |
Static Public Attributes | |
| static const word | KEY_BEGIN = "{{" |
| Keyword starting characters. | |
| static const word | KEY_END = "}}" |
| Keyword ending characters. | |
| static HashTable< string > | builtin_ |
| Built-in substitutions. | |
Protected Attributes | |
| const dictionary | dict_ |
| Construction dictionary. | |
| const Time & | time_ |
| Reference to the time database. | |
Base class for substitution models.
Provides a static hash table for builtin keyword-value pairs and functions to manipulate/interact.
Definition at line 52 of file substitutionModel.H.
| substitutionModel | ( | const dictionary & | dict, |
| const Time & | time ) |
|
virtualdefault |
Destructor.
|
static |
Return a key representation from a word.
Definition at line 38 of file substitutionModel.C.
References KEY_BEGIN, and KEY_END.
Referenced by environmentVariable::apply(), fileRegEx::apply(), functionObjectValue::apply(), userValue::apply(), getKeys(), dictionaryValue::processDict(), replaceBuiltin(), replaceBuiltin(), and writeBuiltins().

|
static |
Clean the key text.
Definition at line 44 of file substitutionModel.C.
References Foam::stringOps::trim(), and Foam::stringOps::upper().
Referenced by addBuiltinStr(), dictionaryValue::dictionaryValue(), environmentVariable::environmentVariable(), fileRegEx::fileRegEx(), functionObjectValue::functionObjectValue(), getKeys(), setBuiltinStr(), and userValue::userValue().


|
static |
Return all keys from a string buffer.
Also cleans the key strings in the buffer
Definition at line 50 of file substitutionModel.C.
References cleanKey(), k, KEY_BEGIN, KEY_END, keyify(), keys(), string::length(), Foam::pos(), and Foam::pos0().
Referenced by foamReport::parseTemplate().


Add a builtin to the hash table - does not overwrite.
Definition at line 84 of file substitutionModel.C.
References builtin_, and cleanKey().
Referenced by addBuiltin(), and foamReport::setStaticBuiltins().


|
static |
Add a builtin to the hash table - does not overwrite.
Definition at line 22 of file substitutionModelTemplates.C.
References addBuiltinStr(), and OStringStream::str().
Referenced by foamReport::setStaticBuiltins().


|
static |
Return true if key is builtin.
Definition at line 94 of file substitutionModel.C.
References builtin_.
Set a builtin to the hash table.
Definition at line 100 of file substitutionModel.C.
References builtin_, and cleanKey().
Referenced by setBuiltin(), and foamReport::setDynamicBuiltins().


|
static |
Set a builtin to the hash table.
Definition at line 31 of file substitutionModelTemplates.C.
References setBuiltinStr(), and OStringStream::str().
Referenced by foamReport::setDynamicBuiltins().


Replace key in string.
Definition at line 110 of file substitutionModel.C.
References builtin_, keyify(), and string::replaceAll().
Referenced by foamReport::apply(), dictionaryValue::apply(), and fileRegEx::apply().


|
static |
Replace all occurrences of key in string.
Definition at line 122 of file substitutionModel.C.
References builtin_, forAllConstIters, KEY_BEGIN, keyify(), and string::replaceAll().

|
static |
Write all builtins to stream.
Definition at line 138 of file substitutionModel.C.
References builtin_, keyify(), Foam::nl, and os().
Referenced by foamReport::write().


| TypeName | ( | "substitutionModel" | ) |
Runtime type information.
| declareRunTimeSelectionTable | ( | autoPtr | , |
| substitutionModel | , | ||
| dictionary | , | ||
| (const dictionary &dict, const Time &time) | , | ||
| (dict, time) | ) |
References dict.
|
static |
Return a reference to the selected substitution model.
Definition at line 26 of file substitutionModelNew.C.
References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, and Foam::Info.
Referenced by foamReport::read().


|
inlinevirtual |
Update model local data.
Reimplemented in functionObjectValue.
Definition at line 221 of file substitutionModel.H.
|
pure virtual |
Return true of model applies to this keyName.
Implemented in dictionaryValue, environmentVariable, fileRegEx, functionObjectValue, and userValue.
Apply substitutions to this string buffer.
Implemented in dictionaryValue, environmentVariable, fileRegEx, functionObjectValue, and userValue.
|
pure virtual |
Return a word list of the keys.
Implemented in dictionaryValue, environmentVariable, fileRegEx, functionObjectValue, and userValue.
Referenced by getKeys().

|
static |
Keyword starting characters.
Definition at line 61 of file substitutionModel.H.
Referenced by getKeys(), keyify(), and replaceBuiltin().
|
static |
Keyword ending characters.
Definition at line 66 of file substitutionModel.H.
|
static |
Built-in substitutions.
Definition at line 71 of file substitutionModel.H.
Referenced by addBuiltinStr(), containsBuiltin(), replaceBuiltin(), replaceBuiltin(), setBuiltinStr(), and writeBuiltins().
|
protected |
Construction dictionary.
Definition at line 158 of file substitutionModel.H.
Referenced by substitutionModel().
|
protected |
Reference to the time database.
Definition at line 163 of file substitutionModel.H.
Referenced by dictionaryValue::apply(), substitutionModel(), and functionObjectValue::update().