Go to the documentation of this file.
68 #define Foam_IOstream_extras
142 void setState(std::ios_base::iostate state) noexcept
150 ioState_ = std::ios_base::iostate(0);
172 ioState_(std::ios_base::iostate(0)),
174 sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
215 virtual bool check(
const char* operation)
const;
222 bool opened() const noexcept
228 bool closed() const noexcept
234 bool good() const noexcept
240 bool eof() const noexcept
242 return ioState_ & std::ios_base::eofbit;
246 bool fail() const noexcept
248 return ioState_ & (std::ios_base::badbit | std::ios_base::failbit);
252 bool bad() const noexcept
254 return ioState_ & std::ios_base::badbit;
258 explicit operator bool() const noexcept
299 template<
class T = label>
300 typename std::enable_if<std::is_integral<T>::value,
bool>
::type
308 template<
class T = scalar>
309 typename std::enable_if<std::is_floating_point<T>::value,
bool>
::type
340 virtual ios_base::fmtflags
flags()
const = 0;
376 virtual ios_base::fmtflags
flags(
const ios_base::fmtflags
f) = 0;
379 ios_base::fmtflags
setf(
const ios_base::fmtflags
f)
387 const ios_base::fmtflags
f,
388 const ios_base::fmtflags mask
395 void unsetf(
const ios_base::fmtflags
f)
424 Ostream&
operator<<(Ostream&
os,
const InfoProxy<IOstream>& ip);
unsigned char sizeofLabel_
The sizeof (label), possibly read from the header.
unsigned char sizeofScalar_
The sizeof (scalar), possibly read from the header.
IOstream(const IOstream &)=default
Copy construct.
A helper class for outputting values to Ostream.
A class for handling file names.
void setLabelByteSize(unsigned nbytes) noexcept
Set the sizeof (label) in bytes associated with the stream.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
IOstream &(* IOstreamManip)(IOstream &)
An IOstream manipulator.
virtual void print(Ostream &os) const
Print stream description to Ostream.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
An IOstream is an abstract base class for all input/output systems; be they streams,...
void setScalarByteSize(unsigned nbytes) noexcept
Set the sizeof (scalar) in bytes associated with the stream.
label lineNumber() const noexcept
Const access to the current stream line number.
IOstream & oct(IOstream &io)
virtual ~IOstream()=default
Destructor.
static unsigned int precision_
Default precision.
void setOpened() noexcept
Set stream opened.
bool closed() const noexcept
True if stream is closed.
void setGood() noexcept
Set stream state to be good.
bool good() const noexcept
True if next operation might succeed.
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes associated with the stream.
void setEof() noexcept
Set stream state as reached 'eof'.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
IOstream(IOstreamOption streamOpt=IOstreamOption())
Representation of a major/minor version number.
label lineNumber_
The file line.
IOstream & dec(IOstream &io)
std::ios_base::iostate ioState_
Mirror of internal stream io state.
bool eof() const noexcept
True if end of input seen.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
The IOstreamOption is a simple container for options an IOstream can normally have.
bool opened() const noexcept
True if stream has been opened.
InfoProxy< IOstream > info() const
Return info proxy.
bool operator!() const noexcept
Return true if the stream has failed.
virtual const fileName & name() const
Return the name of the stream.
void setFail() noexcept
Set stream state as 'failed'.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
void setClosed() noexcept
Set stream closed.
IOstream & fixed(IOstream &io)
streamFormat
Data format (ascii | binary)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
OBJstream os(runTime.globalPath()/outputName)
fileName relativeName() const
Return the name of the stream relative to the current case.
bool bad() const noexcept
True if stream is corrupted.
IOstream & scientific(IOstream &io)
streamAccess openClosed_
The stream open/closed state.
static fileName staticName_
Name for any generic stream - normally treat as readonly.
IOstream & hex(IOstream &io)
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
virtual ios_base::fmtflags flags() const =0
Return flags of stream.
void setState(std::ios_base::iostate state) noexcept
Set stream state.
static unsigned int defaultPrecision() noexcept
Return the default precision.
void unsetf(const ios_base::fmtflags f)
Unset flags of stream.
streamAccess
Enumeration for stream open/closed state.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes associated with the stream.
void setBad()
Set stream state to be 'bad'.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label & lineNumber() noexcept
Non-const access to the current stream line number.
A character and a pointer to a character string.
bool fail() const noexcept
True if next operation will fail.