- was previously only within string expansions, but cover dictionaries
as well for consistency
ENH: replace the never-used fileName::caseName() functionality
- stringOps::inplaceReplaceVar() is more general
stringOps::inplaceReplaceVar(myfile, "FOAM_CASE");
STYLE: relax parameter passing when calling some POSIX 'query' functions.
- A std::string is sufficient since the functions use a plain C-string.
Eg, getEnv("SOMETHING").
Retain more stringent Foam::word for things like setEnv, since this
could be useful.
- there are some cases in which the C-style sprintf is much more
convenient, albeit problematic for buffer overwrites.
Provide a formatting version of Foam::name() for language
primitives that is buffer-safe.
Returns a Foam::word, so that further output will be unquoted, but
without any checking that the characters are indeed entirely valid
word characters.
Example use,
i = 1234;
s = Foam::name("%08d", i);
produces '00001234'
Alternative using string streams:
std::ostringstream buf;
buf.fill('0');
buf << setw(8) << i;
s = buf.str();
Note that the format specification can also be slightly more complex:
Foam::name("output%08d.vtk", i);
Foam::name("timing=%.2fs", time);
It remains the caller's responsibility to ensure that the format mask
is valid.
- syntax as per Bourne/Korn shell
${parameter:+altValue}
If parameter is unset or null, nothing is substituted.
Otherwise the \c altValue is substituted.
- syntax as per Bourne/Korn shell
${parameter:-defValue}
If parameter is unset or null, the \c defValue is substituted.
Otherwise, the value of parameter is substituted.