Go to the documentation of this file.
91 #include <type_traits>
105 #include "regExpFwd.H"
147 typedef typename std::conditional
151 typedef typename std::conditional
202 bool good() const noexcept
208 bool found() const noexcept
232 bool isDict() const noexcept
247 return eptr_->dict();
320 matchOpt(
bool recursive,
bool pattern)
363 void raiseBadInput(
const ITstream& is,
const word& keyword)
const;
367 static word executableName();
376 const bool added =
false
426 bool keepHeader = false
649 bool mandatory = true
673 template<class
T, class Predicate>
677 const Predicate& pred,
686 template<class
T, class Predicate>
691 const Predicate& pred,
701 template<class
T, class Predicate>
706 const Predicate& pred,
720 template<class
T, class Predicate>
725 const Predicate& pred,
727 bool mandatory = true
739 template<class
T, class Predicate>
744 const Predicate& pred,
799 const
bool mandatory = false
819 template<class Compare>
833 bool mergeEntry = false
841 bool mergeEntry = false
886 bool mergeEntry = false
1000 const
word& keyword,
1029 const
word& keyword,
1039 const
word& keyword,
1049 const
word& keyword,
1084 const
word& keyword,
1085 std::initializer_list<std::pair<const
char*,
int>> compat,
1098 const
word& keyword,
1099 std::initializer_list<std::pair<const
char*,
int>> compat,
1112 const
word& keyword,
1113 std::initializer_list<std::pair<const
char*,
int>> compat,
1126 const
word& keyword,
1127 std::initializer_list<std::pair<const
char*,
int>> compat,
1141 const
word& keyword,
1142 std::initializer_list<std::pair<const
char*,
int>> compat,
1158 const
word& keyword,
1159 std::initializer_list<std::pair<const
char*,
int>> compat,
1174 const
word& keyword,
1175 std::initializer_list<std::pair<const
char*,
int>> compat,
1195 const
word& keyword,
1196 std::initializer_list<std::pair<const
char*,
int>> compat,
1199 bool mandatory = true
1217 const
word& keyword,
1218 std::initializer_list<std::pair<const
char*,
int>> compat,
1260 const
word& keyword,
1265 return getOrDefault<T>(keyword, deflt, matchOpt);
1277 const word& keyword,
1282 return getOrAdd<T>(keyword, deflt, matchOpt);
1296 const word& keyword,
1297 std::initializer_list<std::pair<const char*,int>> compat,
1302 return getOrDefaultCompat<T>(keyword, compat, deflt, matchOpt);
1319 const
word& keyword,
1321 bool patternMatch = true
1324 return found(keyword, matchOpt(recursive, patternMatch));
1332 const
word& keyword,
1337 return findEntry(keyword, matchOpt(recursive, patternMatch));
1345 const
word& keyword,
1350 return findEntry(keyword, matchOpt(recursive, patternMatch));
1358 const
word& keyword,
1363 return findScoped(keyword, matchOpt(recursive, patternMatch));
1395 const
word& keyword,
1400 return lookupEntry(keyword, matchOpt(recursive, patternMatch));
1408 const
word& keyword,
1410 bool patternMatch = true
1413 return lookup(keyword, matchOpt(recursive, patternMatch));
1422 const
word& keyword,
1425 bool patternMatch = true
1428 return getOrDefault(keyword, matchOpt(recursive, patternMatch));
1437 const
word& keyword,
1440 bool patternMatch = true
1443 return getOrAdd(keyword, deflt, matchOpt(recursive, patternMatch));
1452 const
word& keyword,
1455 bool patternMatch = true
1460 (keyword, val, matchOpt(recursive, patternMatch));
1472 const
word& keyword,
1473 bool recursive = false,
1474 bool patternMatch = true
1477 return get<T>(keyword, matchOpt(recursive, patternMatch));
1480 #ifdef COMPAT_OPENFOAM_ORG
1487 const
word& keyword,
1488 bool recursive = false,
1489 bool patternMatch = true
1492 return get<T>(keyword, matchOpt(recursive, patternMatch));
1499 #undef defineDictionaryGetter
1500 #define defineDictionaryGetter(Func, Type) \
1504 const word& keyword, \
1505 enum keyType::option matchOpt = keyType::REGEX \
1508 return get<Type>(keyword, matchOpt); \
1518 #undef defineDictionaryGetter
A keyword and a list of tokens is an 'entry'.
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
pointer eptr_
The entry or nullptr.
pointer ptr() const noexcept
A pointer to the entry (nullptr if not found)
dict_type & dict_reference
A reference to a const/non-const dictionary.
bool changeKeyword(const keyType &oldKeyword, const keyType &newKeyword, bool overwrite=false)
Change the keyword for an entry,.
pointer operator->() const noexcept
A pointer to the entry (nullptr if not found)
Non-intrusive doubly-linked list.
A class for handling words, derived from Foam::string.
const entry * lookupScopedEntryPtr(const word &keyword, bool recursive, bool patternMatch) const
Deprecated(2018-10)
A class for handling file names.
dict_type * dict_pointer
A pointer to a const/non-const dictionary.
T lookupOrDefaultCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
static refPtr< OSstream > reportingOutput
Output location when reporting default values.
scalar getScalar(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get< scalar >(const word&, keyType::option)
T getOrAdd(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX)
static autoPtr< dictionary > New(Istream &is)
Construct top-level dictionary on freestore from Istream.
bool found() const noexcept
True if entry was found.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
void checkITstream(const ITstream &is, const word &keyword) const
T getCheckOrAdd(const word &keyword, const T &deflt, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX)
T getOrDefaultCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, const T &deflt, enum keyType::option=keyType::REGEX) const
const_searcher searchScoped(const word &keyword, enum keyType::option) const
Search using dot or slash scoping.
const dictionary * cfindScopedDict(const fileName &dictPath) const
Locate a sub-dictionary using slash-scoping.
string getString(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get< string >(const word&, keyType::option)
T lookupOrAddDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX)
bool foundCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option=keyType::REGEX) const
Search dictionary for given keyword and any compatibility names.
Istream & operator>>(Istream &, directionInfo &)
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
T getCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option=keyType::REGEX) const
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
const entry & lookupEntry(const word &keyword, enum keyType::option matchOpt) const
Search for an entry (const access) with the given keyword.
const fileName & name() const noexcept
The dictionary name.
dictionary & subDictOrAdd(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary for manipulation.
reference operator*() const
A reference to the entry (Error if not found)
bool substituteKeyword(const word &keyword, bool mergeEntry=false)
Substitute the given keyword (which is prefixed by '$')
void transfer(dictionary &dict)
Transfer the contents of the argument and annul the argument.
dict_reference context() const
The containing dictionary context.
bool getBool(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get< bool >(const word&, keyType::option)
List< keyType > keys(bool patterns=false) const
Return the list of available keys or patterns.
fileName getFileName(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get< fileName >(const word&, keyType::option)
Template class for non-intrusive linked lists.
Generic const/non-const dictionary entry searcher.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
A class for handling keywords in dictionaries.
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
friend class entry
Declare friendship with the entry class for IO.
void writeEntry(Ostream &os) const
Write sub-dictionary with its dictName as its header.
bool readIfPresentCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, T &val, enum keyType::option=keyType::REGEX) const
const dictionary * findScopedDict(const fileName &dictPath) const
Locate a sub-dictionary using slash-scoping.
const entry & lookupEntryCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option) const
Recursive search (eg, in dictionary)
An input stream of tokens.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const_searcher csearchScoped(const word &keyword, enum keyType::option) const
Search using scoping.
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
dictionary * makeScopedDict(const fileName &dictPath)
Locate existing or create sub-dictionary using slash-scoping.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
label startLineNumber() const
Return line number of first token in dictionary.
const_searcher csearch(const word &keyword, enum keyType::option=keyType::REGEX) const
Search dictionary for given keyword.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label endLineNumber() const
Return line number of last token in dictionary.
Searcher< true > const_searcher
Searcher with const access.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
dict_pointer dictPtr() const noexcept
Pointer to the found entry as a dictionary, nullptr otherwise.
T getCheckOrDefault(const word &keyword, const T &deflt, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
value_type * pointer
A pointer to a const/non-const entry.
dict_reference dict() const
Reference the found entry as a dictionary.
Lookup type of boundary radiation properties.
const dictionary & topDict() const
Return the top of the tree.
std::conditional< Const, const entry, entry >::type value_type
The const/non-const type for entries.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
void writeEntries(Ostream &os, const bool extraNewLine=false) const
Write dictionary entries.
Template class for intrusive linked lists.
Searcher()
Default construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
value_type & reference
A reference to a const/non-const entry.
word getWord(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get< word >(const word&, keyType::option)
static int writeOptionalEntries
Report optional keywords and values if not present in dictionary.
bool good() const noexcept
True if entry was found.
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
bool read(Istream &is)
Read dictionary from Istream. Discards the header.
label getLabel(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get< label >(const word&, keyType::option)
const_searcher csearchCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option=keyType::REGEX) const
Search dictionary for given keyword and any compatibility names.
const dictionary * subDictPtr(const word &keyword) const
Deprecated(2018-10)
bool readCheck(const word &keyword, T &val, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A HashTable similar to std::unordered_map.
bool isDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Check if entry is found and is a sub-dictionary.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const dictionary & parent() const noexcept
Return the parent dictionary.
entry * lookupEntryPtr(const word &keyword, bool recursive, bool patternMatch)
Deprecated(2018-10)
static int reportOptional() noexcept
Return the state of reporting optional (default) entries.
const entry * findScoped(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for a scoped entry (const access) with the given keyword.
bool remove(const word &keyword)
Remove an entry specified by keyword.
void write(Ostream &os, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
dict_pointer dict_
The dictionary context for the entry.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
ITstream & lookupCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option=keyType::REGEX) const
#define defineDictionaryGetter(Func, Type)
bool readCheckIfPresent(const word &keyword, T &val, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Searcher< false > searcher
Searcher with non-const access.
entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find for an entry (non-const access) with the given keyword.
label k
Boltzmann constant.
const dimensionedScalar e
Elementary charge.
bool readCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, T &val, enum keyType::option=keyType::REGEX, bool mandatory=true) const
autoPtr< dictionary > clone() const
Construct and return clone.
const_searcher search(const word &keyword, enum keyType::option=keyType::REGEX) const
Search dictionary for given keyword.
T getCheck(const word &keyword, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
bool substituteScopedKeyword(const word &keyword, bool mergeEntry=false)
Substitute the given scoped keyword (which is prefixed by '$')
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
void set(pointer eptr)
Assign the entry.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
tokenList tokens() const
Return the dictionary as a list of tokens.
wordList toc() const
Return the table of contents.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
SHA1Digest digest() const
Return the SHA1 digest of the dictionary contents.
const entry * findCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option) const
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
friend const_searcher
Declare friendship with the searcher classes.
bool isDict() const noexcept
True if found entry is a dictionary.
T lookupType(const word &keyword, bool recursive=false, bool patternMatch=true) const
Deprecated(2018-10) find and return a T.
bitSet operator|(const bitSet &a, const bitSet &b)
Bitwise-OR of two bitsets.
void clear()
Clear the dictionary.
wordList sortedToc() const
Return the sorted table of contents.
reference ref() const
A reference to the entry (Error if not found)
Intrusive doubly-linked list.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
option
Enumeration for the data type and search/match modes (bitmask)
bool isNullDict() const noexcept
The dictionary is actually dictionary::null (root dictionary)
A class for managing references or pointers (no reference counting)
std::conditional< Const, const dictionary, dictionary >::type dict_type
The const/non-const type for the context and sub-dictionaries.
word dictName() const
The local dictionary name (final part of scoped name)