36 const Foam::word Foam::functionEntries::includeEntry::typeName
38 Foam::functionEntries::includeEntry::typeName_()
43 int Foam::functionEntries::includeEntry::debug(0);
50 namespace functionEntries
74 Foam::functionEntries::includeEntry::insertNamedArgs
76 dictionary& parentDict,
80 List<Tuple3<word, string, label>> namedArgs;
82 ISstream& iss =
dynamic_cast<ISstream&
>(is);
88 Tuple2<string, label> fNameArgs(
string::null, is.lineNumber());
89 iss.readList(fNameArgs.first());
93 List<Tuple2<wordRe, label>>
args;
101 dictionary& subDict(parentDict.scopedDict(dAk.first()));
104 if (subDict.found(dAk.second()))
106 keyType tmpName(dAk.second());
108 subDict.changeKeyword(dAk.second(), tmpName);
112 IStringStream entryStream
132 void Foam::functionEntries::includeEntry::removeInsertNamedArgs
134 dictionary& parentDict,
135 const List<Tuple3<word, string, label>>& namedArgs
141 parentDict.remove(namedArgs[i].
first());
145 dictionary& subDict(parentDict.scopedDict(dAk.first()));
146 keyType tmpName(dAk.second());
148 subDict.changeKeyword(tmpName, dAk.second());
214 includeFileName(is.
name().
path(), rawFName, parentDict)
221 insertNamedArgs(parentDict, is)
245 parentDict.
read(ifs);
248 if (foamFileDict.size() != 0)
253 parentDict += parentDictTmp;
261 ) <<
"Cannot open include file "
262 << (ifs.
name().size() ? ifs.
name() : rawFName)
263 <<
" while reading dictionary " << parentDict.
name()
269 removeInsertNamedArgs(parentDict, namedArgs);
286 includeFileName(is.
name().
path(), rawFName, parentDict)
293 insertNamedArgs(
const_cast<dictionary&
>(parentDict), is)
306 entry.read(parentDict, ifs);
313 ) <<
"Cannot open include file "
314 << (ifs.
name().size() ? ifs.
name() : rawFName)
315 <<
" while reading dictionary " << parentDict.
name()
321 removeInsertNamedArgs(
const_cast<dictionary&
>(parentDict), namedArgs);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into member function selection tables.
static constexpr const char * foamFile
Keyword for the FoamFile header sub-dictionary.
streamFormat format() const
Return current stream format.
virtual const fileName & name() const
Return the name of the stream.
versionNumber version() const
Return the stream version.
virtual const fileName & name() const
Return the name of the stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
T & first()
Return the first element of the list.
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.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
void clear()
Clear the dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
A keyword and a list of tokens is an 'entry'.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
A class for handling file names.
bool isAbsolute() const
Return true if file name is absolute.
fileName path() const
Return directory path name (part before last /)
Specify an include file when reading dictionaries.
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
static fileName includeFileName(Istream &, const dictionary &)
Read the include fileName from Istream, expand and return.
static bool log
Report which file is included to stdout.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
static const string null
An empty string.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
addToMemberFunctionSelectionTable(functionEntry, includeFvConstraintEntry, execute, dictionaryIstream)
string & inplaceExpandEntry(string &s, const dictionary &dict, const bool allowEnvVars, const bool allowEmpty, const char sigil='$')
Inplace expand occurrences of variables according to the dictionary.
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void dictArgList(const Tuple2< string, label > &argString, word &configName, List< Tuple2< wordRe, label >> &args, List< Tuple3< word, string, label >> &namedArgs)
Parse dictionary substitution argument list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
string expandArg(const string &arg, dictionary &dict, const label lineNumber)
Expand arg within the dict context and return.
Foam::argList args(argc, argv)