jaulib v1.4.0-2-g788cf73
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau::io::IOStateCap Class Reference

Supporting std::basic_ios's iostate capabilities for all ByteStream implementations. More...

#include <byte_stream.hpp>

Inheritance diagram for jau::io::IOStateCap:
Collaboration diagram for jau::io::IOStateCap:

Public Member Functions

 IOStateCap () noexcept
 
 IOStateCap (const IOStateCap &o) noexcept=default
 
 IOStateCap (IOStateCap &&o) noexcept=default
 
virtual ~IOStateCap () noexcept=default
 
void addState (const iostate_t state) noexcept
 Adds given state flags to existing rdstate() bits.
 
virtual void assignState (const iostate_t state=iostate_t::goodbit) noexcept
 Assigns given state to current value.
 
bool bad () const noexcept
 Checks if a non-recoverable error has occurred.
 
void clear (const iostate_t state=iostate_t::goodbit) noexcept
 Clears state flags by assignment to the given value.
 
void clearStateFlags (const iostate_t clr) noexcept
 Clears given state flags from current value.
 
bool eof () const noexcept
 Checks if end-of-file has been reached.
 
bool fail () const noexcept
 Checks if an error has occurred.
 
bool good () const noexcept
 Checks if no error nor eof() has occurred i.e.
 
 operator bool () const noexcept
 Checks if no error has occurred, synonym of !fail().
 
bool operator! () const noexcept
 Checks if an error has occurred, synonym of fail().
 
IOStateCapoperator= (const IOStateCap &o) noexcept=default
 
IOStateCapoperator= (IOStateCap &&o) noexcept=default
 
virtual iostate_t rdstate () const noexcept
 Returns the current state flags.
 
void setstate (const iostate_t state) noexcept
 Sets state flags, by keeping its previous bits.
 
bool timeout () const noexcept
 Checks if a timeout (non-recoverable) has occurred.
 

Protected Member Functions

constexpr void addstate_impl (iostate_t state) const noexcept
 
constexpr iostate_t rdstate_impl () const noexcept
 

Detailed Description

Supporting std::basic_ios's iostate capabilities for all ByteStream implementations.

Definition at line 84 of file byte_stream.hpp.

Constructor & Destructor Documentation

◆ IOStateCap() [1/3]

jau::io::IOStateCap::IOStateCap ( )
inlinenoexcept

Definition at line 93 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ IOStateCap() [2/3]

jau::io::IOStateCap::IOStateCap ( const IOStateCap & o)
defaultnoexcept

◆ IOStateCap() [3/3]

jau::io::IOStateCap::IOStateCap ( IOStateCap && o)
defaultnoexcept

◆ ~IOStateCap()

virtual jau::io::IOStateCap::~IOStateCap ( )
virtualdefaultnoexcept

Member Function Documentation

◆ rdstate_impl()

iostate_t jau::io::IOStateCap::rdstate_impl ( ) const
inlineconstexprprotectednoexcept

Definition at line 89 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ addstate_impl()

void jau::io::IOStateCap::addstate_impl ( iostate_t state) const
inlineconstexprprotectednoexcept

Definition at line 90 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

IOStateCap & jau::io::IOStateCap::operator= ( const IOStateCap & o)
defaultnoexcept

◆ operator=() [2/2]

IOStateCap & jau::io::IOStateCap::operator= ( IOStateCap && o)
defaultnoexcept

◆ clear()

void jau::io::IOStateCap::clear ( const iostate_t state = iostate_t::goodbit)
inlinenoexcept

Clears state flags by assignment to the given value.

Deprecated
{ Use assignState() for clarity. }
See also
assignState()

Definition at line 110 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ assignState()

virtual void jau::io::IOStateCap::assignState ( const iostate_t state = iostate_t::goodbit)
inlinevirtualnoexcept

Assigns given state to current value.

Reimplemented in jau::io::ByteStream_Recorder.

Definition at line 113 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ clearStateFlags()

void jau::io::IOStateCap::clearStateFlags ( const iostate_t clr)
inlinenoexcept

Clears given state flags from current value.

Definition at line 116 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ rdstate()

virtual iostate_t jau::io::IOStateCap::rdstate ( ) const
inlinevirtualnoexcept

Returns the current state flags.

Method is marked virtual to allow implementations with asynchronous resources to determine or update the current iostate.

Method is used throughout all query members and addState(), hence they all will use the updated state from a potential override implementation.

Reimplemented in jau::io::ByteInStream_Feed, jau::io::ByteInStream_URL, and jau::io::ByteStream_Recorder.

Definition at line 127 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ setstate()

void jau::io::IOStateCap::setstate ( const iostate_t state)
inlinenoexcept

Sets state flags, by keeping its previous bits.

Deprecated
{ Use addState() for clarity. }
See also
addState()

Definition at line 136 of file byte_stream.hpp.

◆ addState()

void jau::io::IOStateCap::addState ( const iostate_t state)
inlinenoexcept

Adds given state flags to existing rdstate() bits.

Definition at line 139 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ good()

bool jau::io::IOStateCap::good ( ) const
inlinenoexcept

Checks if no error nor eof() has occurred i.e.

I/O operations are available.

Definition at line 142 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ eof()

bool jau::io::IOStateCap::eof ( ) const
inlinenoexcept

Checks if end-of-file has been reached.

Definition at line 145 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ fail()

bool jau::io::IOStateCap::fail ( ) const
inlinenoexcept

Checks if an error has occurred.

Definition at line 148 of file byte_stream.hpp.

Here is the caller graph for this function:

◆ operator!()

bool jau::io::IOStateCap::operator! ( ) const
inlinenoexcept

Checks if an error has occurred, synonym of fail().

Definition at line 151 of file byte_stream.hpp.

◆ operator bool()

jau::io::IOStateCap::operator bool ( ) const
inlineexplicitnoexcept

Checks if no error has occurred, synonym of !fail().

Definition at line 154 of file byte_stream.hpp.

◆ bad()

bool jau::io::IOStateCap::bad ( ) const
inlinenoexcept

Checks if a non-recoverable error has occurred.

Definition at line 157 of file byte_stream.hpp.

◆ timeout()

bool jau::io::IOStateCap::timeout ( ) const
inlinenoexcept

Checks if a timeout (non-recoverable) has occurred.

Definition at line 160 of file byte_stream.hpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: