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);
154 const entry* eptr = csearch(keyword, matchOpt).ptr();
163 checkITstream(is, keyword);
167 else if (writeOptionalEntries)
169 reportDefault(keyword, deflt);
184 const entry* eptr = csearch(keyword, matchOpt).ptr();
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 " 226 const entry* eptr = csearch(keyword, matchOpt).ptr();
232 ITstream& is = eptr->stream();
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 " 272 const entry* eptr = csearch(keyword, matchOpt).ptr();
278 ITstream& is = eptr->stream();
281 checkITstream(is, keyword);
285 raiseBadInput(is, keyword);
290 else if (writeOptionalEntries)
292 reportDefault(keyword, deflt,
true);
314 const entry* eptr = csearch(keyword, matchOpt).ptr();
318 ITstream& is = eptr->stream();
321 checkITstream(is, keyword);
328 <<
"Entry '" << keyword <<
"' not found in dictionary " 337 template<
class T,
class Predicate>
342 const Predicate& pred,
352 const entry* eptr = csearch(keyword, matchOpt).ptr();
356 ITstream& is = eptr->stream();
359 checkITstream(is, keyword);
363 raiseBadInput(is, keyword);
371 <<
"Entry '" << keyword <<
"' not found in dictionary " 384 std::initializer_list<std::pair<const char*,int>> compat,
395 const entry* eptr = csearchCompat(keyword, compat, matchOpt).ptr();
399 ITstream& is = eptr->stream();
402 checkITstream(is, keyword);
409 <<
"Entry '" << keyword <<
"' not found in dictionary " 437 template<
class T,
class Predicate>
442 const Predicate& pred,
447 return readCheck<T, Predicate>
462 std::initializer_list<std::pair<const char*,int>> compat,
467 const entry* eptr = csearchCompat(keyword, compat, matchOpt).ptr();
476 checkITstream(is, keyword);
480 else if (writeOptionalEntries)
482 reportDefault(keyword, deflt);
493 std::initializer_list<std::pair<const char*,int>> compat,
bool readCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val using any compatibility names if needed. FatalIOError if there are exc...
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 matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val using any compatibility names if needed. FatalIOError if it is found and there are excess tokens.
errorManipArg< error, int > exit(error &err, const int errNo=1)
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
bool readCheckIfPresent(const word &keyword, T &val, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
constexpr char nl
The newline '\n' character (0x0a)
T getCheck(const word &keyword, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T with additional checking FatalIOError if not found, or if the number of tokens is...
T getCheckOrAdd(const word &keyword, const T &deflt, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX)
Find and return a T, or return the given default value and add it to dictionary. FatalIOError if it i...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
label k
Boltzmann constant.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
bool readCheck(const word &keyword, T &val, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
static refPtr< OSstream > reportingOutput
Output location when reporting default values.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
T getCheckOrDefault(const word &keyword, const T &deflt, const Predicate &pred, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
Reading is optional [identical to LAZY_READ].
OSstream & stream(OSstream *alternative=nullptr)
Return OSstream for output operations.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
OBJstream os(runTime.globalPath()/outputName)
static int writeOptionalEntries
Report optional keywords and values if not present in dictionary.
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
T getCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T using any compatibility names if needed. FatalIOError if not found, or if there are excess tokens.
T getOrAdd(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX)
Find and return a T, or return the given default value and add it to dictionary. FatalIOError if it i...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
option
Enumeration for the data type and search/match modes (bitmask)
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
bool isNullDict() const noexcept
The dictionary is actually dictionary::null (root dictionary)
An input stream of tokens.
wordList sortedToc() const
Return the sorted table of contents.
A keyword and a list of tokens is an 'entry'.
T getOrDefaultCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value using any compatibility names if needed...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
readOption
Enumeration defining read preferences.