Public Member Functions | List of all members
ISstream Class Reference

Generic input stream using a standard (STL) stream. More...

Inheritance diagram for ISstream:
Inheritance graph
[legend]
Collaboration diagram for ISstream:
Collaboration graph
[legend]

Public Member Functions

 ISstream (std::istream &is, const string &streamName, IOstreamOption streamOpt=IOstreamOption())
 
 ISstream (std::istream &is, const string &streamName, IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver=IOstreamOption::currentVersion, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
virtual ~ISstream ()=default
 
virtual const fileNamename () const
 
virtual fileNamename ()
 
virtual ios_base::fmtflags flags () const
 
bool seekCommentEnd_Cstyle ()
 
bool continueReadUntilRightBrace (std::string &str, const bool stripComments=true)
 
ISstreamget (char &c)
 
int peek ()
 
ISstreamgetLine (std::string &str, char delim='\n')
 
std::streamsize getLine (std::nullptr_t, char delim='\n')
 
ISstreamputback (const char c)
 
virtual Istreamread (token &t)
 
virtual Istreamread (char &c)
 
virtual Istreamread (word &str)
 
virtual Istreamread (string &str)
 
virtual Istreamread (label &val)
 
virtual Istreamread (floatScalar &val)
 
virtual Istreamread (doubleScalar &val)
 
virtual Istreamread (char *buf, std::streamsize count)
 
virtual IstreamreadRaw (char *data, std::streamsize count)
 
virtual bool beginRawRead ()
 
virtual bool endRawRead ()
 
virtual void rewind ()
 
virtual ios_base::fmtflags flags (const ios_base::fmtflags flags)
 
virtual std::istream & stdStream ()
 
virtual const std::istream & stdStream () const
 
virtual void print (Ostream &os) const
 
- Public Member Functions inherited from Istream
 Istream (const Istream &)=default
 
virtual ~Istream ()=default
 
 Istream (IOstreamOption streamOpt=IOstreamOption())
 
 Istream (IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver=IOstreamOption::currentVersion, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
const tokenpeekBack () const noexcept
 
bool peekBack (token &tok)
 
void putBack (const token &tok)
 
bool getBack (token &tok)
 
bool readBegin (const char *funcName)
 
bool readEnd (const char *funcName)
 
char readBeginList (const char *funcName)
 
char readEndList (const char *funcName)
 
Istreamoperator() () const
 
- Public Member Functions inherited from IOstream
 IOstream (const IOstream &)=default
 
virtual ~IOstream ()=default
 
 IOstream (IOstreamOption streamOpt=IOstreamOption())
 
 IOstream (IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
fileName relativeName () const
 
virtual bool check (const char *operation) const
 
bool fatalCheck (const char *operation) const
 
bool opened () const noexcept
 
bool closed () const noexcept
 
bool good () const noexcept
 
bool eof () const noexcept
 
bool fail () const noexcept
 
bool bad () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
unsigned labelByteSize () const noexcept
 
unsigned scalarByteSize () const noexcept
 
void setLabelByteSize (unsigned nbytes) noexcept
 
void setScalarByteSize (unsigned nbytes) noexcept
 
template<class T = label>
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize () const noexcept
 
template<class T = scalar>
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize () const noexcept
 
label lineNumber () const noexcept
 
label & lineNumber () noexcept
 
label lineNumber (const label num) noexcept
 
void setEof () noexcept
 
void setFail () noexcept
 
void setBad ()
 
ios_base::fmtflags setf (const ios_base::fmtflags f)
 
ios_base::fmtflags setf (const ios_base::fmtflags f, const ios_base::fmtflags mask)
 
void unsetf (const ios_base::fmtflags f)
 
void print (Ostream &os, const int streamState) const
 
InfoProxy< IOstreaminfo () const
 
- Public Member Functions inherited from IOstreamOption
constexpr IOstreamOption (streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
constexpr IOstreamOption (streamFormat fmt, compressionType comp, versionNumber ver) noexcept
 
constexpr IOstreamOption (streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
 IOstreamOption (const IOstreamOption &opt, streamFormat fmt) noexcept
 
streamFormat format () const noexcept
 
streamFormat format (const streamFormat fmt) noexcept
 
streamFormat format (const word &formatName)
 
compressionType compression () const noexcept
 
compressionType compression (const compressionType comp) noexcept
 
compressionType compression (const word &compName)
 
versionNumber version () const noexcept
 
versionNumber version (const versionNumber ver) noexcept
 
versionNumber version (const token &tok)
 

Additional Inherited Members

- Public Types inherited from IOstream
enum  streamAccess : char { CLOSED = 0, OPENED }
 
- Public Types inherited from IOstreamOption
enum  streamFormat : char { ASCII = 0, BINARY }
 
enum  compressionType : char { UNCOMPRESSED = 0, COMPRESSED }
 
- Static Public Member Functions inherited from IOstream
static unsigned int defaultPrecision () noexcept
 
static unsigned int defaultPrecision (unsigned int prec) noexcept
 
- Static Public Member Functions inherited from IOstreamOption
static streamFormat formatEnum (const word &formatName, const streamFormat deflt=streamFormat::ASCII)
 
static streamFormat formatEnum (const word &key, const dictionary &dict, const streamFormat deflt=streamFormat::ASCII)
 
static compressionType compressionEnum (const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
 
static compressionType compressionEnum (const word &key, const dictionary &dict, const compressionType deflt=compressionType::UNCOMPRESSED)
 
- Static Public Attributes inherited from IOstream
static unsigned int precision_
 
- Static Public Attributes inherited from IOstreamOption
static const Enum< streamFormatformatNames
 
static const versionNumber currentVersion
 
- Protected Member Functions inherited from Istream
bool hasPutback () const noexcept
 
- Protected Member Functions inherited from IOstream
void setOpened () noexcept
 
void setClosed () noexcept
 
void setState (std::ios_base::iostate state) noexcept
 
void setGood () noexcept
 
- Protected Attributes inherited from IOstream
std::ios_base::iostate ioState_
 
streamAccess openClosed_
 
unsigned char sizeofLabel_
 
unsigned char sizeofScalar_
 
label lineNumber_
 
- Static Protected Attributes inherited from IOstream
static fileName staticName_
 

Detailed Description

Generic input stream using a standard (STL) stream.

Source files

Definition at line 51 of file ISstream.H.

Constructor & Destructor Documentation

◆ ISstream() [1/2]

ISstream ( std::istream &  is,
const string streamName,
IOstreamOption  streamOpt = IOstreamOption() 
)
inline

Definition at line 25 of file ISstreamI.H.

◆ ISstream() [2/2]

Definition at line 87 of file ISstream.H.

◆ ~ISstream()

virtual ~ISstream ( )
virtualdefault

Member Function Documentation

◆ name() [1/2]

virtual const fileName& name ( ) const
inlinevirtual

◆ name() [2/2]

virtual fileName& name ( )
inlinevirtual

Reimplemented from IOstream.

Definition at line 115 of file ISstream.H.

◆ flags() [1/2]

std::ios_base::fmtflags flags ( ) const
virtual

Implements IOstream.

Reimplemented in dummyISstream.

Definition at line 1071 of file ISstream.C.

◆ seekCommentEnd_Cstyle()

bool seekCommentEnd_Cstyle ( )

Definition at line 72 of file ISstream.C.

References Foam::constant::universal::c, and ISstream::get().

Referenced by Foam::readUntilBalancedDelimiter(), and Foam::readVariable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ continueReadUntilRightBrace()

bool continueReadUntilRightBrace ( std::string &  str,
const bool  stripComments = true 
)

Definition at line 506 of file ISstream.C.

References token::BEGIN_BLOCK, token::END_BLOCK, and Foam::readUntilBalancedDelimiter().

Here is the call graph for this function:

◆ get()

Foam::ISstream & get ( char &  c)
inline

Definition at line 49 of file ISstreamI.H.

References Foam::constant::universal::c, IOstream::good(), IOstream::lineNumber_, and IOstream::setState().

Referenced by Foam::ReadHex(), Foam::readToNewline(), Foam::readUntilBalancedDelimiter(), Foam::readVariable(), Foam::readVerbatim(), and ISstream::seekCommentEnd_Cstyle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peek()

int peek ( )
inline

◆ getLine() [1/2]

Foam::ISstream & getLine ( std::string &  str,
char  delim = '\n' 
)
inline

◆ getLine() [2/2]

std::streamsize getLine ( std::nullptr_t  ,
char  delim = '\n' 
)
inline

Definition at line 83 of file ISstreamI.H.

References Foam::BitOps::count(), and Foam::max().

Here is the call graph for this function:

◆ putback()

Foam::ISstream & putback ( const char  c)
inline

Definition at line 99 of file ISstreamI.H.

References Foam::constant::universal::c.

Referenced by Foam::readUntilBalancedDelimiter(), Foam::readVariable(), and Foam::readVerbatim().

Here is the caller graph for this function:

◆ read() [1/8]

Foam::Istream & read ( token t)
virtual

◆ read() [2/8]

Foam::Istream & read ( char &  c)
virtual

Implements Istream.

Reimplemented in dummyISstream.

Definition at line 801 of file ISstream.C.

References Foam::constant::universal::c.

◆ read() [3/8]

Foam::Istream & read ( word str)
virtual

◆ read() [4/8]

Foam::Istream & read ( string str)
virtual

Implements Istream.

Reimplemented in ensightReadFile, and dummyISstream.

Definition at line 888 of file ISstream.C.

References Foam::constant::universal::c, token::DQUOTE, errLen, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::PtrListOps::get(), and token::NL.

Here is the call graph for this function:

◆ read() [5/8]

Foam::Istream & read ( label &  val)
virtual

Implements Istream.

Reimplemented in ensightReadFile, and dummyISstream.

Definition at line 989 of file ISstream.C.

◆ read() [6/8]

Foam::Istream & read ( floatScalar val)
virtual

Implements Istream.

Reimplemented in dummyISstream.

Definition at line 997 of file ISstream.C.

◆ read() [7/8]

Foam::Istream & read ( doubleScalar val)
virtual

Implements Istream.

Reimplemented in dummyISstream.

Definition at line 1005 of file ISstream.C.

◆ read() [8/8]

Foam::Istream & read ( char *  buf,
std::streamsize  count 
)
virtual

Implements Istream.

Reimplemented in ensightReadFile, and dummyISstream.

Definition at line 1013 of file ISstream.C.

References Foam::BitOps::count().

Here is the call graph for this function:

◆ readRaw()

Foam::Istream & readRaw ( char *  data,
std::streamsize  count 
)
virtual

Implements Istream.

Reimplemented in dummyISstream.

Definition at line 1023 of file ISstream.C.

References Foam::BitOps::count(), and Istream::read().

Here is the call graph for this function:

◆ beginRawRead()

bool beginRawRead ( )
virtual

Implements Istream.

Reimplemented in dummyISstream.

Definition at line 1032 of file ISstream.C.

References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and format().

Here is the call graph for this function:

◆ endRawRead()

bool endRawRead ( )
virtual

Implements Istream.

Reimplemented in dummyISstream.

Definition at line 1048 of file ISstream.C.

◆ rewind()

void rewind ( )
virtual

Implements Istream.

Reimplemented in UIListStream, IListStream, dummyISstream, and IFstream.

Definition at line 1057 of file ISstream.C.

Referenced by IStringStream::reset(), IFstream::rewind(), and simpleObjectRegistry::setValues().

Here is the caller graph for this function:

◆ flags() [2/2]

std::ios_base::fmtflags flags ( const ios_base::fmtflags  flags)
virtual

Implements IOstream.

Reimplemented in dummyISstream.

Definition at line 1077 of file ISstream.C.

References f().

Here is the call graph for this function:

◆ stdStream() [1/2]

virtual std::istream& stdStream ( )
inlinevirtual

Reimplemented in IFstream.

Definition at line 212 of file ISstream.H.

Referenced by FIRECore::getFireLabel(), FIRECore::getFirePoint(), FIRECore::getFireString(), and Foam::skipComments().

Here is the caller graph for this function:

◆ stdStream() [2/2]

virtual const std::istream& stdStream ( ) const
inlinevirtual

Reimplemented in IFstream.

Definition at line 218 of file ISstream.H.

◆ print()

void print ( Ostream os) const
virtual

Reimplemented from IOstream.

Reimplemented in UIListStream, IListStream, IStringStream, and IFstream.

Definition at line 30 of file SstreamsPrint.C.

References ISstream::name(), os(), and IOstream::print().

Referenced by IFstream::print(), and IStringStream::print().

Here is the call graph for this function:
Here is the caller graph for this function:

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