A wrapped std::ifstream
with possible compression handling (igzstream) that behaves much like a std::unique_ptr
.
More...
Public Member Functions | |
ifstreamPointer () noexcept=default | |
Default construct (empty) More... | |
ifstreamPointer (const ifstreamPointer &)=delete | |
No copy construct. More... | |
ifstreamPointer (ifstreamPointer &&)=default | |
Move construct. More... | |
void | operator= (const ifstreamPointer &)=delete |
No copy assignment. More... | |
ifstreamPointer & | operator= (ifstreamPointer &&)=default |
Move assignment. More... | |
~ifstreamPointer ()=default | |
Destructor. More... | |
ifstreamPointer (const fileName &pathname) | |
Construct from pathname. More... | |
std::istream * | get () noexcept |
The stream pointer (ifstream or igzstream) More... | |
const std::istream * | get () const noexcept |
The stream pointer (ifstream or igzstream) More... | |
IOstreamOption::compressionType | whichCompression () const |
Which compression type? More... | |
std::istream * | release () noexcept |
Return managed pointer and release ownership. More... | |
void | reset (std::istream *ptr) noexcept |
Replace the managed pointer. More... | |
std::istream & | operator* () |
Reference to the stream (no nullptr checking) More... | |
const std::istream & | operator* () const |
Const-reference to the stream (no nullptr checking) More... | |
std::istream * | operator-> () noexcept |
Pointer dereference. More... | |
const std::istream * | operator-> () const noexcept |
Pointer dereference. More... | |
Static Public Member Functions | |
static bool | supports_gz () |
True if compiled with libz support. More... | |
Protected Member Functions | |
void | reopen_gz (const std::string &pathname) |
Special 'rewind' method for compressed stream. More... | |
A wrapped std::ifstream
with possible compression handling (igzstream) that behaves much like a std::unique_ptr
.
operator bool
to avoid inheritance ambiguity with std::ios::operator bool
.Definition at line 70 of file fstreamPointer.H.
|
defaultnoexcept |
Default construct (empty)
|
delete |
No copy construct.
|
default |
Move construct.
|
default |
Destructor.
|
explicit |
Construct from pathname.
Attempts to read the specified file. If that fails, try as a compressed file (.gz ending).
Definition at line 59 of file fstreamPointers.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, Foam::isFile(), Foam::mode(), and Foam::nl.
|
protected |
Special 'rewind' method for compressed stream.
Definition at line 231 of file fstreamPointers.C.
Referenced by IFstream::rewind().
|
delete |
No copy assignment.
|
default |
Move assignment.
|
static |
True if compiled with libz support.
Definition at line 36 of file fstreamPointers.C.
|
inlinenoexcept |
The stream pointer (ifstream or igzstream)
Definition at line 149 of file fstreamPointer.H.
Referenced by IFstream::rewind(), and IFstream::stdStream().
|
inlinenoexcept |
The stream pointer (ifstream or igzstream)
Definition at line 154 of file fstreamPointer.H.
Foam::IOstreamOption::compressionType whichCompression | ( | ) | const |
Which compression type?
Definition at line 361 of file fstreamPointers.C.
Referenced by STLCore::detectBinaryHeader(), STLCore::readBinaryHeader(), and IFstream::rewind().
|
inlinenoexcept |
Return managed pointer and release ownership.
Definition at line 167 of file fstreamPointer.H.
Referenced by STLCore::readBinaryHeader().
|
inlinenoexcept |
Replace the managed pointer.
Definition at line 172 of file fstreamPointer.H.
|
inline |
Reference to the stream (no nullptr checking)
Definition at line 180 of file fstreamPointer.H.
|
inline |
Const-reference to the stream (no nullptr checking)
Definition at line 185 of file fstreamPointer.H.
|
inlinenoexcept |
Pointer dereference.
Definition at line 190 of file fstreamPointer.H.
|
inlinenoexcept |
Pointer dereference.
Definition at line 195 of file fstreamPointer.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.