41 std::string::size_type& pos,
42 std::string::size_type endPos = std::string::npos
45 while (pos != std::string::npos)
47 pos =
s.find(
':', pos);
48 if (pos != std::string::npos)
53 const char altType =
s[pos+1];
54 if (altType ==
'+' || altType ==
'-')
64 pos = std::string::npos;
75bool Foam::primitiveEntry::expandVariable
77 const string& varName,
93 expanded.assign(varName, 1, varName.size()-2);
103 std::string::size_type altPos = 0;
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
183 if (toks.empty() ? (altType ==
'-') : (altType ==
'+'))
197 if (eptr->
stream().
empty() ? (altType ==
'-') : (altType ==
'+'))
295 <<
"Attempt to return primitive entry " << info()
296 <<
" as a sub-dictionary"
306 <<
"Attempt to return primitive entry " << info()
307 <<
" as a sub-dictionary"
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
An input stream of tokens.
virtual const fileName & name() const override
The name of the input token stream.
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
void add_tokens(const token &tok)
Copy append a token at the current tokenIndex, incrementing the index.
void seek(label pos) noexcept
Move tokenIndex to the specified position and adjust the stream status (open/good/eof ....
const tokenList & tokens() const noexcept
The token contents (read-only access).
ITstream(const ITstream &is)
Copy construct.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
tokenList tokens() const
Return the dictionary as a list of tokens.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
A keyword and a list of tokens is an 'entry'.
entry(const keyType &keyword)
Construct from keyword.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
virtual bool isDict() const noexcept
True if this entry is a dictionary.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary, otherwise Fatal.
static fileName concat(const std::string &s1, const std::string &s2, const char delim='/')
Join two strings with a path separator ('/' by default).
A class for handling keywords in dictionaries.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
primitiveEntry(const keyType &key)
Construct from keyword and no tokens.
virtual ITstream * streamPtr() const noexcept
Return pointer to token stream for this primitive entry.
InfoProxy< primitiveEntry > info() const noexcept
Return info proxy, to print token information to a stream.
virtual ITstream & stream() const
Return token stream for this primitive entry.
virtual const dictionary & dict() const
This entry is not a dictionary, calling this function generates a FatalError.
A token holds an item read from Istream.
@ BEGIN_BLOCK
Begin block [isseparator].
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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 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.
string getEnv(const std::string &envName)
Get environment value for given envName.
errorManip< error > abort(error &err)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
List< token > tokenList
List of token, used for dictionary primitive entry (for example).
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
static char findParameterAlternative(const std::string &s, std::string::size_type &pos, std::string::size_type endPos=std::string::npos)