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,
78 const dictionary&
dict
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
177 else if (eptr->isDict())
183 if (toks.empty() ? (altType ==
'-') : (altType ==
'+'))
188 toks = ITstream::parse(altValue);
197 if (eptr->stream().empty() ? (altType ==
'-') : (altType ==
'+'))
202 tokenList toks(ITstream::parse(altValue));
271 return tokens.
first().lineNumber();
284 return tokens.
last().lineNumber();
302 <<
"Attempt to return primitive entry " << info()
303 <<
" as a sub-dictionary"
313 <<
"Attempt to return primitive entry " << info()
314 <<
" 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
Get the name of the stream.
virtual void rewind()
Rewind the stream so that it may be read again.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T & first()
Return the first element of the list.
void size(const label n)
Older name for setAddressableSize.
T & last()
Return the last element of the list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const entry * findScoped(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for a scoped entry (const access) with the given keyword.
wordList toc() const
Return the table of contents.
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.
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...
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
virtual label endLineNumber() const
Return line number of last token in dictionary.
virtual ITstream & stream() const
Return token stream for this primitive entry.
virtual const dictionary & dict() const
This entry is not a dictionary,.
virtual label startLineNumber() const
Return line number of first token in dictionary.
A token holds an item read from Istream.
@ BEGIN_BLOCK
Begin block [isseparator].
bool append() const noexcept
True if output format uses an append mode.
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='$')
string getEnv(const std::string &envName)
Get environment value for given envName.
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< token > tokenList
List of tokens, used for a IOdictionary entry.
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)