46 parentDict.
name().size()
78 global_(parentDict.topDict().global())
86 if (!ifs || !ifs.
good())
89 <<
"Included dictionary file " << fName
90 <<
" cannot be found for dictionary " << parentDict.
name()
119 <<
"Istream not OK for reading dictionary "
143 <<
"Istream not OK after reading dictionary " <<
name()
161 word varName = keyword(1, keyword.size()-1);
228 <<
"Can't write entry " << iter().keyword()
229 <<
" for dictionary " <<
name()
243 dict.write(os,
true);
258 const wordRe unsetPattern(
"<.*>");
265 if (iter().isStream())
269 bool isUnset =
false;
274 if (its[i].isWord() && unsetPattern.
match(its[i].wordToken()))
303 iter().keyword() +
'/' + subUnsetArgs[i].
first(),
326 if (foFiles[
f].ext().empty())
352 const word& configName,
394 if (!dictFile.empty())
425 const word& configType,
426 const string& argString,
447 <<
"configuration file name not specified"
449 <<
"Available configured objects:"
456 <<
"Cannot find configuration file "
457 << funcType <<
nl <<
nl
458 <<
"Available configured objects:"
468 ISstream& fileStream = fileStreamPtr();
478 if (funcsDict.
found(funcType) && funcsDict.
isDict(funcType))
480 funcDictPtr = &funcsDict.
subDict(funcType);
497 if (namedArgs[i].
first() ==
"field")
504 namedArgs[i].
first() ==
"fields"
505 || namedArgs[i].
first() ==
"objects"
512 if (fieldArgs.
size() == 1)
514 funcDict.
set(
"field", fieldArgs[0].
first());
517 if (fieldArgs.
size() >= 1)
519 funcDict.
set(
"fields", fieldArgs);
520 funcDict.
set(
"objects", fieldArgs);
528 namedArgs[i].
first() !=
"field"
529 && namedArgs[i].
first() !=
"fields"
530 && namedArgs[i].
first() !=
"objects"
531 && namedArgs[i].
first() !=
"funcName"
532 && namedArgs[i].
first() !=
"name"
539 dAk.
second() +
' ' + namedArgs[i].second() +
';'
548 funcDict.
set(
"region", region);
554 word entryName(string::validate<word>(argString));
559 namedArgs[i].
first() ==
"funcName"
560 || namedArgs[i].
first() ==
"name"
563 entryName = namedArgs[i].second();
564 entryName.
strip(
" \n");
570 bool hasUnsetError =
false;
575 unsetArgs[i].
first() !=
"fields"
576 && unsetArgs[i].
first() !=
"objects"
579 hasUnsetError =
true;
597 <<
"Essential value for keyword '" << unsetArgs[i].
first()
598 <<
"' not set" <<
nl;
602 <<
nl <<
"In " << configType <<
" entry:" <<
nl
603 <<
" " << argString.c_str() <<
nl
604 <<
nl <<
"In " << contextTypeAndValue.
first().c_str() <<
":" <<
nl
605 <<
" " << contextTypeAndValue.
second().c_str() <<
nl;
615 args[i].strip(
" \n");
620 namedArgs[i].second().strip(
" \n");
623 + namedArgs[i].
first() +
" = " + namedArgs[i].second();
627 unsetArgs[i].second().strip(
" \n");
630 + unsetArgs[i].
first() +
" = " + unsetArgs[i].second();
634 <<
nl <<
"The " << configType <<
" entry should be:" <<
nl
635 <<
" " << funcType <<
'(' <<
argList.c_str() <<
')'
642 funcArgsDict.
add(entryName, funcDict);
645 funcArgsDict.
write(os);
655 parentDict.
merge(funcArgsDict);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Template class for intrusive linked lists.
static constexpr const char * foamFile
Keyword for the FoamFile header sub-dictionary.
virtual const fileName & name() const
Return the name of the stream.
bool bad() const
Return true if stream is corrupted.
bool good() const
Return true if next operation might succeed.
bool eof() const
Return true if end of input seen.
Input from memory buffer stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &)
Put back token.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
Output to memory buffer stream.
string str() const
Return the string.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
An ordered pair of two objects of type <T> with first() and second() elements.
const Type & second() const
Return second.
const Type & first() const
Return first.
A 2-tuple for storing two objects of different types.
T * last()
Return the last entry.
T * first()
Return the first entry.
T & first()
Return the first element of the list.
Extract command arguments and options from the supplied argc and argv parameters.
label size() const
Return the number of arguments.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const fileName & name() const
Return the dictionary name.
includedDictionary(const fileName &fName, const dictionary &parentDict)
Construct an included dictionary for the given parent.
A list of keyword definitions, which are a keyword followed by any number of values (e....
dictionary()
Construct top-level dictionary null.
virtual bool global() const
Return true if the dictionary global,.
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
bool substituteKeyword(const word &keyword)
Substitute the given keyword prepended by '$' with the.
void set(entry *)
Assign a new entry, overwrite any existing entry.
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
bool remove(const word &)
Remove an entry specified by keyword.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
const dictionary & parent() const
Return the parent dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
static const dictionary null
Null dictionary.
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
bool merge(const dictionary &)
Merge entries from the given dictionary.
A keyword and a list of tokens is an 'entry'.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
static int disableFunctionEntries
A class for handling file names.
static const fileName null
An empty fileName.
static void clear()
Reset the inputMode to default (ie, merge)
static void clear()
Reset the inputSyntax to the default specified in etc/controlDict.
void strip(const string &)
Strip characters from the start and end of the string.
A token holds items read from Istream.
Tuple of a word and dictionary, used to read in per-field options for function objects in the followi...
A wordRe is a word, but can also have a regular expression for matching words.
bool compile() const
Compile the regular expression.
bool match(const std::string &, bool literalMatch=false) const
Smart match as regular expression or as a string.
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Functions to search 'etc' directories for configuration files etc.
#define WarningInFunction
Report a warning using Foam::Warning.
#define InfoInFunction
Report an information message using Foam::Info.
string expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void listConfigFiles(const fileName &dir, HashSet< word > &foMap)
void dictArgList(const string &argString, word &configName, wordReList &args, List< Tuple2< word, string >> &namedArgs)
Parse dictionary substitution argument list.
wordList listAllConfigFiles(const fileName &configFilesPath)
Return the list of configuration files in.
labelList second(const UList< labelPair > &p)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
bool readConfigFile(const word &configType, const string &argString, dictionary &parentDict, const fileName &configFilesPath, const Pair< string > &contextTypeAndValue, const word ®ion=word::null)
Read the specified configuration file.
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
fileName findConfigFile(const word &configName, const fileName &configFilesPath, const word ®ion=word::null)
Search for configuration file for given region.
Istream & operator>>(Istream &, directionInfo &)
Foam::List< Foam::Tuple2< Foam::word, Foam::string > > unsetConfigEntries(const dictionary &configDict)
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
Ostream & operator<<(Ostream &, const ensightPart &)
word name(const complex &)
Return a string representation of a complex.
Ostream & indent(Ostream &os)
Indent stream.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Foam::argList args(argc, argv)