Go to the documentation of this file.
35 void Foam::dictionary::reportDefault
45 <<
"No optional entry: " << keyword
46 <<
" Default: " << deflt <<
nl
53 os <<
"-- Executable: "
54 << dictionary::executableName()
71 os.writeQuoted(keyword,
true);
72 os <<
" Default: " << deflt;
84 template<
class Compare>
87 return hashedEntries_.sortedToc(comp);
113 readEntry<T>(keyword, val, matchOpt);
118 template<
class T,
class Predicate>
122 const Predicate& pred,
127 readCheck<T, Predicate>(keyword, val, pred, matchOpt);
136 std::initializer_list<std::pair<const char*,int>> compat,
141 readCompat<T>(keyword, compat, val, matchOpt);
163 checkITstream(is, keyword);
167 else if (writeOptionalEntries)
169 reportDefault(keyword, deflt);
193 checkITstream(is, keyword);
197 else if (writeOptionalEntries)
199 reportDefault(keyword, deflt,
true);
207 template<
class T,
class Predicate>
212 const Predicate& pred,
220 <<
"Entry '" << keyword <<
"' with invalid default in dictionary "
235 checkITstream(is, keyword);
239 raiseBadInput(is, keyword);
244 else if (writeOptionalEntries)
246 reportDefault(keyword, deflt);
253 template<
class T,
class Predicate>
258 const Predicate& pred,
266 <<
"Entry '" << keyword <<
"' with invalid default in dictionary "
281 checkITstream(is, keyword);
285 raiseBadInput(is, keyword);
290 else if (writeOptionalEntries)
292 reportDefault(keyword, deflt,
true);
316 checkITstream(is, keyword);
323 <<
"Entry '" << keyword <<
"' not found in dictionary "
332 template<
class T,
class Predicate>
337 const Predicate& pred,
349 checkITstream(is, keyword);
353 raiseBadInput(is, keyword);
361 <<
"Entry '" << keyword <<
"' not found in dictionary "
374 std::initializer_list<std::pair<const char*,int>> compat,
380 const const_searcher finder(csearchCompat(keyword, compat, matchOpt));
387 checkITstream(is, keyword);
394 <<
"Entry '" << keyword <<
"' not found in dictionary "
412 return readEntry<T>(keyword, val, matchOpt,
false);
416 template<
class T,
class Predicate>
421 const Predicate& pred,
426 return readCheck<T, Predicate>(keyword, val, pred, matchOpt,
false);
434 std::initializer_list<std::pair<const char*,int>> compat,
439 const const_searcher finder(csearchCompat(keyword, compat, matchOpt));
448 checkITstream(is, keyword);
452 else if (writeOptionalEntries)
454 reportDefault(keyword, deflt);
465 std::initializer_list<std::pair<const char*,int>> compat,
471 return readCompat<T>(keyword, compat, val, matchOpt,
false);
A keyword and a list of tokens is an 'entry'.
pointer ptr() const noexcept
A pointer to the entry (nullptr if not found)
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
A class for handling words, derived from Foam::string.
static refPtr< OSstream > reportingOutput
Output location when reporting default values.
T getOrAdd(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX)
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
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.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
Generic const/non-const dictionary entry searcher.
A class for handling keywords in dictionaries.
bool readIfPresentCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, T &val, enum keyType::option=keyType::REGEX) const
OSstream & stream(OSstream *alternative=nullptr)
An input stream of tokens.
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
T getCheckOrDefault(const word &keyword, const T &deflt, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
OBJstream os(runTime.globalPath()/outputName)
static int writeOptionalEntries
Report optional keywords and values if not present in dictionary.
bool good() const noexcept
True if entry was found.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool readCheck(const word &keyword, T &val, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
bool readCheckIfPresent(const word &keyword, T &val, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
label k
Boltzmann constant.
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
T getCheck(const word &keyword, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
wordList sortedToc() const
Return the sorted table of contents.
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)