- use ignore instead of seekg/tellg to swallow input (robuster)
- check for bad gcount() values
- wrap Foam::fileSize() compressed/uncompressed handling into IFstream.
- improve handling of compressed files in masterUncollatedFileOperation.
Previously read into a string via stream iterators.
Now read chunk-wise into a List of char for fewer reallocations.
- with ATOMIC, an intermediary file is created - eg, (fileAbc~tmp~)
where all of the output is written to. When the stream goes out of
scope, this intermediary file is moved/renamed to the actually
output name - eg, (fileAbc~tmp~) -> (fileAbc).
This adds some safety if the simulation crashes while writing the
file, since it will the partial (corrupt) file will be left
behind as (fileAbc~tmp~) and not as (fileAbc), which means it will
will be treated as a backup file and not loaded again on restart.
ENH: provided enumeration for APPEND/NON_APPEND
- clearer than using bool (with comments).
Since append mode is primarily only used by masterOFstream etc
this change is unlikely to affect user coding.
ENH: use file atomic for ensight file creation
- avoids corrupt (truncated) files being referenced by the ensight
case file if the simulation crashes while writing the ensight file.
- improves interface and data consistency.
Older signatures are still active (via the Foam_IOstream_extras
define).
- refine internals for IOstreamOption streamFormat, versionNumber
ENH: improve data alignment for IOstream and IOobject
- fit sizeof label/scalar into unsigned char
STYLE: remove dead code
- previously hidden as Detail::[IO]FstreamAllocator, now exposed
directly as [io]fstreamPointer, which allows reuse for
std::ifstream, std::ofstream wrapping, without the additional
ISstream, OSstream layers.
These stream pointers have some characteristics similar to a
unique_ptr.
- restrict direct gzstream usage to two files (fstreamPointers.C,
gzstream.C) which improves localization and makes it simpler to
enable/disable with the `HAVE_LIBZ` define.
The HAVE_LIBZ define is currently simply hard-coded in the
Make/options.
If compiled WITHOUT libz support:
- reading gz files : FatalError
- writing gz files : emit warning and downgrade to uncompressed
- warn if compression is specified in the case controlDict
and downgrade to uncompressed
ENH: minor updates to gzstream interface for C++11
- support construct/open with std::string for the file names.
CONFIG: provisioning for have_libz detection as wmake/script
- for convenience and symmetry with OStringStream
STYLE: void return value for stream rewind() methods
- this makes it easier to design bidirectional streams
- use allocator class to wrap the stream pointers instead of passing
them into ISstream, OSstream and using a dynamic cast to delete
then. This is especially important if we will have a bidirectional
stream (can't delete twice!).
STYLE:
- file stream constructors with std::string (C++11)
- for rewind, explicit about in|out direction. This is not currently
important, but avoids surprises with any future bidirectional access.
- combined string streams in StringStream.H header.
Similar to <sstream> include that has both input and output string
streams.
Previously Fstreams had stdStream() as a public member and the other
streams had stream() as a protected member.
All serial streams now have public method stdStream() and the stream()
method has been eliminated. This is not only more consistent, but also
avoids confusion (for the programmer, not the compiler) with the
ITstream::stream() method.
- regIOobject: don't re-register an unregister object on rename/assignment
- Hasher: split-off HasherInt with uint32_t specializations
- IOobject: writeBanner/writeDivider return Stream for easier chaining.
... also dropped some namespace bracketing while I was at it.
- removed the previously added fileName type(), isDir(), isFile() methods.
- added optional bool parameter to isFile() function to explicitly
enable/disable the check for gzip files.
- fixed minor bugginess where the default usage of isFile() would result in
false positive matches.
- be slightly more stringent and use isDir() and isFile() instead of
exists() function when we actually know the expected type.
- can use 'XX.empty()' instead of 'XX.size() == 0', 'XX.size() < 1' or
'XX.size() <= 0' or for simpler coding.
It also has the same number of characters as '!XX.size()' and /might/ be
more readable
- many size checking had 'XX.size() > 0', 'XX.size() != 0', or 'XX.size() >= 1'
when a simple 'XX.size()' suffices
- Istream and Ostream now retain backslashes when reading/writing strings.
The previous implementation simply discarded them, except when used to
escape a double-quote or a newline. It is now vitally important to retain
them, eg for quoting regular expression meta-characters.
The backslash continues to be used as an escape character for double-quote
and newline, but otherwise get passed through "as-is" without any other
special meaning (ie, they are *NOT* C-style strings). This helps avoid
'backslash hell'!
For example,
string: "match real dots \.+, question mark \? or any char .*"
C-style: "match real dots \\.+, question mark \\? or any char .*"
- combined subfiles in db/IOstreams, some had more copyright info than code
- OPstreamI.H contained only private methods, moved into OPstream.C
Are these really correct?
IOstreams/Istream.H:# include "HashTable.C"
token/token.H:#define NoHashTableC