- align Switch more with Enum.
Now have find(), found() static methods.
Constructors with failsafe option.
The find() method makes for clearer coding:
OLD
Switch sw(some_string, true); // NB: true = allowBad
if (sw.valid()) ...
NOW
Switch sw = Switch::find(some_string);
if (sw.good()) ...
or
if (Switch::found(some_string)) ...
- improve construct from dictionary to handle all valid token types.
Previously just read in a word.
- Remove asText() method - replaced by c_str() and str() several
versions ago.
- skip processing OSspecific/MSwindows since this can cause duplicate
doxygen entries
STYLE: adjust formatting in code templates
STYLE: use std::string methods without extra qualifications
- silently deprecate 'startsWith', 'endsWith' methods
(added in 2016: 2b14360662), in favour of
'starts_with', 'ends_with' methods, corresponding to C++20 and
allowing us to cull then in a few years.
- handle single character versions of starts_with, ends_with.
- add single character version of removeEnd and silently deprecate
removeTrailing which did the same thing.
- drop the const versions of removeRepeated, removeTrailing.
Unused and with potential confusion.
STYLE: use shrink_to_fit(), erase()
- this can be useful for preloading of libraries, or for utilities
that don't use system/controlDict.
The additional libraries can be specified individually:
myUtil -lib lib1 -lib lib2 -lib lib3
When specified like this, the options add up.
Or as a 'captured' list using OpenFOAM's standard arg list handling:
myUtil -lib '(' lib1 lib2 lib3 ')'
myUtil -lib \( lib1 lib2 lib3 \)
or as single argument list:
myUtil -lib '("lib1" "lib2" "lib3")'
When specified as a single argument, would normally take advantage
of the transparent handling of word vs fileName and omit the string
quotes:
myUtil -lib '(lib1 lib2 lib3)'
ENH: dlOpen error messages now propagated into dlLibraryTable
- this makes the context more relevant and also avoids the previous
annoyance of double warnings (one from the POSIX loader, and one
from dlLibraryTable)
STYLE: mark -noFunctionObjects and -withFunctionObjects as 'advanced'
- reduces clutter. Still visible with -help-full
- the behaviour of std::rename with overwriting an existing file is
implementation dependent:
- POSIX: it overwrites.
- Windows: it does not overwrite.
- for Windows need to use the ::MoveFileEx() routine for overwriting.
More investigation is needed for proper handling of very long names.
- reduces some dictionary clutter and probably looks less confusing
than having an ending that may not correspond to the current OS.
Eg, "fvOptions" instead of "libfvOptions.so", "libfvOptions.dylib" ...
- convenience dlOpen method for multiple files
- amalgamate dlSym() and dlSymFound() into a single dlSymFind() backend
with optional 'required' argument. This makes it possible to
query and assign at once.
- file-local static for saving the old action, which moves system
dependencies out of the header files.
- set/reset of signals as file-local functions
STYLE: use csignal header instead of signal.h
- similar to the global '/' operator, but taking raw strings and not
performing any stripping.
Was previously a local function within POSIX.C, but it is useful enough
to be in fileName itself.
- new regExpCxx wrapper for C++11 regex support with drop-in
compatibility with existing code.
- regExpPosix (was regExp), for future phase out in favour of regExpCxx.
- The regExp header will continue to be used for defining an
appropriate typedef corresponding to the preferred implementation.
- simplifies their use when reordering lists etc.
(word, fileName, keyType, wordRe)
- "unfriend" IO operators for string types. They require no internal access
- add compile/uncompile methods to keyType for symmetry with wordRe
- when outputting keyType/wordRe, be more explicit about them using
writeQuoted()
- more dictionary-like methods, enforce keyType::LITERAL for all
lookups to avoid any spurious keyword matching.
- new readEntry, readIfPresent methods
- The get() method replaces the now deprecate lookup() method.
- Deprecate lookupOrFailsafe()
Failsafe behaviour is now an optional parameter for lookupOrDefault,
which makes it easier to tailor behaviour at runtime.
- output of the names is now always flatted without line-breaks.
Thus,
os << flatOutput(someEnumNames.names()) << nl;
os << someEnumNames << nl;
both generate the same output.
- Constructor now uses C-string (const char*) directly instead of
Foam::word in its initializer_list.
- Remove special enum + initializer_list constructor form since
it can create unbounded lookup indices.
- Removd old hasEnum, hasName forms that were provided during initial
transition from NamedEnum.
- Added static_assert on Enum contents to restrict to enum or
integral values. Should not likely be using this class to enumerate
other things since it internally uses an 'int' for its values.
Changed volumeType accordingly to enumerate on its type (enum),
not the class itself.
- with the 'cwd' optimization switch it is possible to select the
preferred behaviour for the cwd() function.
A value of 0 causes cwd() to return the physical directory,
which is what getcwd() and `pwd -P` return.
Until now, this was always the standard behaviour.
With a value of 1, cwd() instead returns the logical directory,
which what $PWD contains and `pwd -L` returns.
If any of the sanity checks fail (eg, PWD points to something other
than ".", etc), a warning is emitted and the physical cwd() is
returned instead.
Apart from the optical difference in the output, this additional
control helps workaround file systems with whitespace or other
characters in the directory that normally cause OpenFOAM to balk.
Using a cleaner symlink elsewhere should skirt this issue.
Eg,
cd $HOME
ln -s "/mounted volume/user/workdir" workdir
cd workdir
# start working with OpenFOAM
- The problem is not 100% reproducible, but be somewhat conservative
and now only close(stdin) for pure background (daemon-like) use of
Foam::system(), where it can be useful.
Using Foam::system() for launching background processes is currently
only used for the doc browser.
- add additional control via a Foam::infoDetailLevel flag, which is
supported by a 'DetailLevel' macro. Eg,
DetailLevel << "some information" << nl
- When infoDetailLevel is zero, the stdout for all Foam::system() calls
are also redirected to stderr to prevent child output from
appearing on the parent.
- close stdin before exec in system call.
- convenient way to temporarily suspend the SIGFPE handler.
Eg,
// Normal code with SIGFPE enabled ...
sigFpe::set();
{
// Ignore SIGFPE in this scope ...
sigFpe::ignore noFpeHandling;
...
}
- link CGAL (clang version) without reference to mpfr,gmp libraries
- use offset address in printStack for Darwin as well
- alternative handling of feexcept on Darwin