59 "writeOptionalEntries",
101 hashedEntries_.insert(
e.keyword(), &
e);
103 if (
e.keyword().isPattern())
105 patterns_.prepend(&
e);
123 hashedEntries_.insert(
e.keyword(), &
e);
125 if (
e.keyword().isPattern())
127 patterns_.prepend(&
e);
196 if (&
p !=
this && !
p.
name().empty())
209 return first()->startLineNumber();
220 return last()->endLineNumber();
232 for (
const entry&
e : *
this)
247 for (
const entry&
e : *
this)
253 return ITstream::parse(
os.str());
280 err <<
"Entry '" << keyword <<
"' has "
281 << remaining <<
" excess tokens in stream" <<
nl <<
nl
291 <<
"--> FOAM FATAL IO ERROR:" <<
nl;
294 <<
"Entry '" << keyword <<
"' has "
295 << remaining <<
" excess tokens in stream" <<
nl <<
nl;
299 <<
"file: " << relativeName()
319 <<
"Entry '" << keyword
320 <<
"' had no tokens in stream" <<
nl <<
nl
327 <<
"--> FOAM FATAL IO ERROR:" <<
nl
328 <<
"Entry '" << keyword
329 <<
"' had no tokens in stream" <<
nl <<
nl;
333 <<
"file: " << relativeName()
343void Foam::dictionary::raiseBadInput
360 <<
"Entry '" << keyword <<
"' with invalid input" <<
nl
376 <<
"Entry '" << keyword <<
"' not found in dictionary "
377 << relativeName() <<
nl
391 return lookupEntry(keyword, matchOpt).stream();
401 if (keyword.size() < 2)
407 const word varName(keyword.substr(1),
false);
433 if (keyword.size() < 2)
439 const word varName(keyword.substr(1),
false);
447 for (
const entry&
e : finder.dict())
470 <<
"Entry '" << keyword <<
"' not found in dictionary "
471 << relativeName() <<
nl
475 return finder.
dict();
490 <<
"Entry '" << keyword <<
"' not found in dictionary "
491 << relativeName() <<
nl
495 return finder.
dict();
518 <<
"Entry '" << keyword
519 <<
"' is not a sub-dictionary in dictionary "
520 << relativeName() <<
nl
524 ptr = this->set(keyword,
dictionary())->dictPtr();
529 <<
"Failed to insert sub-dictionary '" << keyword
530 <<
"' in dictionary "
531 << relativeName() <<
nl
551 return finder.
dict();
557 <<
"Entry '" << keyword
558 <<
"' is not a sub-dictionary in dictionary "
559 << relativeName() <<
nl
566 <<
"Entry '" << keyword
567 <<
"' found but not a sub-dictionary in dictionary "
568 << relativeName() <<
endl;
587 return finder.
dict();
593 <<
"Entry '" << keyword
594 <<
"' found but not a sub-dictionary in dictionary "
595 << relativeName() <<
endl;
607 for (
const entry&
e : *
this)
609 list[
n++] =
e.keyword();
618 return hashedEntries_.sortedToc();
627 for (
const entry&
e : *
this)
629 if (
e.keyword().isPattern() ? patterns : !patterns)
631 list[
n++] =
e.keyword();
647 auto iter = hashedEntries_.find(entryPtr->
keyword());
649 if (mergeEntry && iter.good())
652 if (iter()->isDict() && entryPtr->
isDict())
654 iter()->dict().merge(entryPtr->
dict());
662 parent_type::replace(iter(), entryPtr);
664 hashedEntries_.erase(iter);
666 if (hashedEntries_.insert(entryPtr->
keyword(), entryPtr))
673 patterns_.prepend(entryPtr);
682 <<
"Problem replacing entry "<< entryPtr->
keyword()
683 <<
" in dictionary " << relativeName() <<
endl;
685 parent_type::remove(entryPtr);
692 if (hashedEntries_.insert(entryPtr->
keyword(), entryPtr))
697 parent_type::append(entryPtr);
701 patterns_.prepend(entryPtr);
710 <<
"Attempt to add entry " << entryPtr->
keyword()
711 <<
" which already exists in dictionary "
712 << relativeName() <<
endl;
721 return add(
e.
clone(*this).ptr(), mergeEntry);
793 finder.
dict().clear();
796 return add(entryPtr,
true);
802 return set(
e.
clone(*this).ptr());
817 <<
"Attempted merge to self, for dictionary "
818 << relativeName() <<
nl
822 bool changed =
false;
826 auto fnd = hashedEntries_.find(
e.keyword());
832 if (fnd()->isDict() &&
e.isDict())
834 if (fnd()->
dict().merge(
e.dict()))
859 parent_type::clear();
860 hashedEntries_.clear();
872 parent_type::transfer(
dict);
873 hashedEntries_.transfer(
dict.hashedEntries_);
874 patterns_.transfer(
dict.patterns_);
875 regexps_.transfer(
dict.regexps_);
894 for (
const entry&
e : rhs)
906 <<
"Attempted addition to self, for dictionary "
907 << relativeName() <<
nl
911 for (
const entry&
e : rhs)
923 <<
"Attempted |= merging to self, for dictionary "
924 << relativeName() <<
nl
928 for (
const entry&
e : rhs)
943 <<
"Attempted addition to self, for dictionary "
944 << relativeName() <<
nl
948 for (
const entry&
e : rhs)
950 set(
e.
clone(*this).ptr());
tmp< GeometricField< Type, PatchField, GeoMesh > > clone() const
Clone.
const_iterator_pair< const_key_iterator, this_type > keys() const
A const iterator begin/end pair for iterating over keys.
Template class for intrusive linked lists.
const word & name() const noexcept
Return the object name.
label lineNumber() const noexcept
Const access to the current stream line number.
An input stream of tokens.
label nRemainingTokens() const noexcept
Number of tokens remaining.
static bool constructed
Global value for constructed job info.
void resize(const label len)
Adjust allocated size of list.
The output stream for calculating SHA1 digests.
Generic output stream using a standard (STL) stream.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
static fileName envRelativePath(const fileName &input, const bool caseTag=false)
static word envExecutable()
Name of the executable from environment variable.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual bool merge() const
A keyword and a list of tokens is a 'dictionaryEntry'.
virtual fileName relativeName() const
Return scoped dictionary name relative to the current case.
Generic const/non-const dictionary entry searcher.
bool good() const noexcept
True if entry was found.
dict_reference dict() const
Reference the found entry as a dictionary.
bool isDict() const noexcept
True if found entry is a dictionary.
reference ref() const
A reference to the entry (Error if not found)
dict_pointer dictPtr() const noexcept
Pointer to the found entry as a dictionary, nullptr otherwise.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
void transfer(dictionary &dict)
Transfer the contents of the argument and annul the argument.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
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.
void checkITstream(const ITstream &is, const word &keyword) const
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
const dictionary & topDict() const
Return the top of the tree.
void operator<<=(const dictionary &rhs)
Unconditionally include entries from the given dictionary.
static refPtr< OSstream > reportingOutput
Output location when reporting default values.
bool substituteKeyword(const word &keyword, bool mergeEntry=false)
Substitute the given keyword (which is prefixed by '$')
dictionary()
Default construct, a top-level empty dictionary.
autoPtr< dictionary > clone() const
Construct and return clone.
static int writeOptionalEntries
Report optional keywords and values if not present in dictionary.
tokenList tokens() const
Return the dictionary as a list of tokens.
void operator|=(const dictionary &rhs)
Conditionally include entries from the given dictionary.
label endLineNumber() const
Return line number of last token in dictionary.
bool substituteScopedKeyword(const word &keyword, bool mergeEntry=false)
Substitute the given scoped keyword (which is prefixed by '$')
wordList sortedToc() const
Return the sorted table of contents.
const entry & lookupEntry(const word &keyword, enum keyType::option matchOpt) const
Search for an entry (const access) with the given keyword.
void clear()
Clear the dictionary.
virtual ~dictionary()
Destructor.
wordList toc() const
Return the table of contents.
label startLineNumber() const
Return line number of first token in dictionary.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
void operator=(const dictionary &rhs)
Copy assignment.
SHA1Digest digest() const
Return the SHA1 digest of the dictionary contents.
void operator+=(const dictionary &rhs)
Include entries from the given dictionary.
A keyword and a list of tokens is an 'entry'.
virtual bool isDict() const noexcept
Return true if this entry is a dictionary.
virtual const fileName & name() const =0
Return the entry name.
const keyType & keyword() const noexcept
Return keyword.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary.
A class for handling file names.
static fileName concat(const std::string &s1, const std::string &s2, const char delim='/')
Join two strings with a path separator ('/' by default).
Sums a given list of (at least two or more) fields and outputs the result into a new field,...
A class for handling keywords in dictionaries.
option
Enumeration for the data type and search/match modes (bitmask)
@ REGEX
Regular expression.
bool isPattern() const noexcept
The keyType is treated as a pattern, not as literal string.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
Lookup type of boundary radiation properties.
A class for managing references or pointers (no reference counting)
transferModelList & transfer()
Transfer.
A class for handling character strings derived from std::string.
A token holds an item read from Istream.
bool set() const
Are all the vector set.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
constexpr char nl
The newline '\n' character (0x0a)
#define registerInfoSwitch(Name, Type, SwitchVar)