45 while (
pos != std::string::npos)
48 if (
pos != std::string::npos)
53 const char altType =
s[
pos+1];
54 if (altType ==
'+' || altType ==
'-')
64 pos = std::string::npos;
75 bool Foam::primitiveEntry::expandVariable
77 const string& varName,
78 const dictionary&
dict 93 expanded.assign(varName, 1, varName.size()-2);
110 altValue = expanded.substr(altPos + 2);
111 expanded.erase(altPos);
116 if (expanded.empty())
136 const word& lookupName = (expanded.empty() ? varName : expanded);
154 if (str.empty() ? (altType ==
'-') : (altType ==
'+'))
158 str = std::move(altValue);
160 else if (str.empty())
163 <<
"Illegal dictionary entry or environment variable name " 165 <<
"Known dictionary entries: " <<
dict.
toc() <<
nl 177 else if (eptr->isDict())
183 if (toks.empty() ? (altType ==
'-') : (altType ==
'+'))
197 if (eptr->stream().empty() ? (altType ==
'-') : (altType ==
'+'))
242 const UList<token>& tokens
295 <<
"Attempt to return primitive entry " << info()
296 <<
" as a sub-dictionary" 306 <<
"Attempt to return primitive entry " << info()
307 <<
" as a sub-dictionary" void add_tokens(const token &tok)
Copy append a token at the current tokenIndex, incrementing the index.
Begin block [isseparator].
A class for handling keywords in dictionaries.
entry(const keyType &keyword)
Construct from keyword.
virtual ITstream * streamPtr() const noexcept
Return pointer to token stream for this primitive entry.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static char findParameterAlternative(const std::string &s, std::string::size_type &pos, std::string::size_type endPos=std::string::npos)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
constexpr char nl
The newline '\n' character (0x0a)
A token holds an item read from Istream.
string getEnv(const std::string &envName)
Get environment value for given envName.
List< token > tokenList
List of token, used for dictionary primitive entry (for example)
wordList toc() const
Return the table of contents.
const entry * findScoped(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for a scoped entry (const access) with the given keyword.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
dimensionedScalar pos(const dimensionedScalar &ds)
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
graph_traits< Graph >::vertices_size_type size_type
errorManip< error > abort(error &err)
virtual ITstream & stream() const
Return token stream for this primitive entry.
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping. Does not use environment values...
virtual const fileName & name() const override
The name of the input token stream.
virtual const dictionary & dict() const
This entry is not a dictionary, calling this function generates a FatalError.
static fileName concat(const std::string &s1, const std::string &s2, const char delim='/')
Join two strings with a path separator ('/' by default).
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
primitiveEntry(const keyType &key)
Construct from keyword and no tokens.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void seek(label pos) noexcept
Move tokenIndex to the specified position and adjust the stream status (open/good/eof ...
An input stream of tokens.
A keyword and a list of tokens is an 'entry'.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...