Public Member Functions | List of all members
OTstream Class Reference

A simple output token stream that can be used to build token lists. Always UNCOMPRESSED. More...

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

Public Member Functions

 OTstream (IOstreamOption streamOpt=IOstreamOption())
 
 OTstream (const OTstream &os)
 
 OTstream (OTstream &&os)
 
 ~OTstream ()=default
 
const DynamicList< token > & tokens () const
 
DynamicList< token > & tokens ()
 
virtual bool write (const token &tok)
 
virtual Ostreamwrite (const char c)
 
virtual Ostreamwrite (const char *str)
 
virtual Ostreamwrite (const word &str)
 
virtual Ostreamwrite (const string &str)
 
virtual OstreamwriteQuoted (const std::string &str, const bool quoted=true)
 
virtual Ostreamwrite (const int32_t val)
 
virtual Ostreamwrite (const int64_t val)
 
virtual Ostreamwrite (const floatScalar val)
 
virtual Ostreamwrite (const doubleScalar val)
 
virtual Ostreamwrite (const char *data, std::streamsize count)
 
virtual OstreamwriteRaw (const char *data, std::streamsize count)
 
virtual bool beginRawWrite (std::streamsize count)
 
virtual bool endRawWrite ()
 
virtual void indent ()
 
virtual ios_base::fmtflags flags () const
 
std::ios_base::fmtflags flags (const ios_base::fmtflags)
 
virtual void flush ()
 
virtual void endl ()
 
virtual char fill () const
 
virtual char fill (const char)
 
virtual int width () const
 
virtual int width (const int)
 
virtual int precision () const
 
virtual int precision (const int)
 
void reset ()
 
virtual void rewind ()
 
void print (Ostream &os) const
 
- Public Member Functions inherited from Ostream
 Ostream (const Ostream &)=default
 
virtual ~Ostream ()=default
 
 Ostream (IOstreamOption streamOpt=IOstreamOption())
 
 Ostream (IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver=IOstreamOption::currentVersion, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
virtual Ostreamwrite (const keyType &kw)
 
unsigned short indentSize () const noexcept
 
unsigned short indentSize (unsigned short val) noexcept
 
unsigned short indentLevel () const noexcept
 
unsigned short indentLevel (unsigned short val) noexcept
 
void incrIndent () noexcept
 
void decrIndent ()
 
virtual OstreamwriteKeyword (const keyType &kw)
 
virtual OstreambeginBlock (const keyType &kw)
 
virtual OstreambeginBlock ()
 
virtual OstreamendBlock ()
 
virtual OstreamendEntry ()
 
template<class T >
OstreamwriteEntry (const keyType &key, const T &value)
 
template<class T >
OstreamwriteEntryIfDifferent (const word &key, const T &value1, const T &value2)
 
Ostreamoperator() () const
 
unsigned short & indentLevel () noexcept
 
unsigned short & indentSize () noexcept
 
- 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)
 
virtual const fileNamename () const
 
virtual fileNamename ()
 
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)
 
- Public Member Functions inherited from DynamicList< token >
constexpr DynamicList () noexcept
 
 DynamicList (const label len)
 
 DynamicList (const label len, const T &val)
 
 DynamicList (const label len, const Foam::zero)
 
 DynamicList (const DynamicList< T, SizeMin > &lst)
 
 DynamicList (const DynamicList< T, AnySizeMin > &lst)
 
 DynamicList (const UList< T > &lst)
 
 DynamicList (const FixedList< T, N > &lst)
 
 DynamicList (std::initializer_list< T > lst)
 
 DynamicList (const IndirectListBase< T, Addr > &lst)
 
 DynamicList (DynamicList< T, SizeMin > &&lst)
 
 DynamicList (DynamicList< T, AnySizeMin > &&lst)
 
 DynamicList (List< T > &&lst)
 
 DynamicList (SortableList< T > &&lst)
 
 DynamicList (Istream &is)
 
label capacity () const noexcept
 
std::streamsize capacity_bytes () const noexcept
 
void setCapacity (const label len)
 
void setCapacity_nocopy (const label len)
 
void setCapacity_unsafe (const label len) noexcept
 
void reserve (const label len)
 
void reserve_nocopy (const label len)
 
void resize (const label len)
 
void resize (const label len, const T &val)
 
void resize_nocopy (const label len)
 
void setSize (const label n)
 
void setSize (const label n, const T &val)
 
void clear () noexcept
 
void clearStorage ()
 
label expandStorage () noexcept
 
void shrinkStorage ()
 
DynamicList< T, SizeMin > & shrink ()
 
void swap (DynamicList< T, AnySizeMin > &other)
 
void transfer (List< T > &list)
 
void transfer (DynamicList< T, AnySizeMin > &list)
 
void transfer (SortableList< T > &list)
 
DynamicList< T, SizeMin > & append (const T &val)
 
DynamicList< T, SizeMin > & append (T &&val)
 
DynamicList< T, SizeMin > & append (const UList< T > &lst)
 
DynamicList< T, SizeMin > & append (const FixedList< T, N > &lst)
 
DynamicList< T, SizeMin > & append (std::initializer_list< T > lst)
 
DynamicList< T, SizeMin > & append (const IndirectListBase< T, Addr > &lst)
 
DynamicList< T, SizeMin > & append (List< T > &&lst)
 
DynamicList< T, SizeMin > & append (DynamicList< T, SizeMin > &&lst)
 
DynamicList< T, SizeMin > & append (DynamicList< T, AnySizeMin > &&lst)
 
DynamicList< T, SizeMin > & append (SortableList< T > &&lst)
 
Foam::DynamicList< T, SizeMin > & append (const FixedList< T, N > &lst)
 
Foam::DynamicList< T, SizeMin > & append (const IndirectListBase< T, Addr > &lst)
 
Foam::DynamicList< T, SizeMin > & append (DynamicList< T, AnySizeMin > &&lst)
 
label appendUniq (const T &val)
 
T remove ()
 
T remove (const label idx, const bool fast=false)
 
label remove (const labelRange &range)
 
label remove (std::initializer_list< label > start_size)
 
label subset (const labelRange &range)
 
label subset (std::initializer_list< label > start_size)
 
Toperator() (const label i)
 
void operator= (const T &val)
 
void operator= (const Foam::zero)
 
void operator= (const UList< T > &lst)
 
void operator= (const FixedList< T, N > &lst)
 
void operator= (const DynamicList< T, SizeMin > &lst)
 
void operator= (const DynamicList< T, AnySizeMin > &lst)
 
void operator= (std::initializer_list< T > lst)
 
void operator= (const IndirectListBase< T, Addr > &lst)
 
void operator= (List< T > &&lst)
 
void operator= (DynamicList< T, SizeMin > &&lst)
 
void operator= (DynamicList< T, AnySizeMin > &&lst)
 
void operator= (SortableList< T > &&lst)
 
IstreamreadList (Istream &is)
 

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 Member Functions inherited from DynamicList< token >
static constexpr label min_size () noexcept
 
- 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 IOstream
void setOpened () noexcept
 
void setClosed () noexcept
 
void setState (std::ios_base::iostate state) noexcept
 
void setGood () noexcept
 
- Protected Attributes inherited from Ostream
unsigned short indentSize_ = 4
 
unsigned short indentLevel_ = 0
 
- 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 Ostream
static constexpr const unsigned short entryIndentation_ = 16
 
- Static Protected Attributes inherited from IOstream
static fileName staticName_
 

Detailed Description

A simple output token stream that can be used to build token lists. Always UNCOMPRESSED.

Note
Appending single characters to token list is fragile.
Source files

Definition at line 52 of file OTstream.H.

Constructor & Destructor Documentation

◆ OTstream() [1/3]

OTstream ( IOstreamOption  streamOpt = IOstreamOption())
inlineexplicit

Definition at line 62 of file OTstream.H.

References IOstream::setGood(), and IOstream::setOpened().

Here is the call graph for this function:

◆ OTstream() [2/3]

OTstream ( const OTstream os)
inline

Definition at line 72 of file OTstream.H.

References IOstream::setGood(), and IOstream::setOpened().

Here is the call graph for this function:

◆ OTstream() [3/3]

OTstream ( OTstream &&  os)
inline

Definition at line 82 of file OTstream.H.

References IOstream::setGood(), and IOstream::setOpened().

Here is the call graph for this function:

◆ ~OTstream()

~OTstream ( )
default

Member Function Documentation

◆ tokens() [1/2]

const DynamicList<token>& tokens ( ) const
inline

Definition at line 99 of file OTstream.H.

◆ tokens() [2/2]

DynamicList<token>& tokens ( )
inline

Definition at line 105 of file OTstream.H.

◆ write() [1/10]

bool write ( const token tok)
virtual

Implements Ostream.

Definition at line 27 of file OTstream.C.

References DynamicList< token >::append(), and token::good().

Here is the call graph for this function:

◆ write() [2/10]

Foam::Ostream & write ( const char  c)
virtual

Implements Ostream.

Definition at line 39 of file OTstream.C.

References append(), Foam::constant::universal::c, and Foam::isspace().

Here is the call graph for this function:

◆ write() [3/10]

Foam::Ostream & write ( const char *  str)
virtual

Implements Ostream.

Definition at line 51 of file OTstream.C.

References Foam::vtk::write().

Here is the call graph for this function:

◆ write() [4/10]

Foam::Ostream & write ( const word str)
virtual

Implements Ostream.

Definition at line 70 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ write() [5/10]

Foam::Ostream & write ( const string str)
virtual

Implements Ostream.

Definition at line 78 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ writeQuoted()

Foam::Ostream & writeQuoted ( const std::string &  str,
const bool  quoted = true 
)
virtual

Implements Ostream.

Definition at line 87 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ write() [6/10]

Foam::Ostream & write ( const int32_t  val)
virtual

Implements Ostream.

Definition at line 105 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ write() [7/10]

Foam::Ostream & write ( const int64_t  val)
virtual

Implements Ostream.

Definition at line 113 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ write() [8/10]

Foam::Ostream & write ( const floatScalar  val)
virtual

Implements Ostream.

Definition at line 121 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ write() [9/10]

Foam::Ostream & write ( const doubleScalar  val)
virtual

Implements Ostream.

Definition at line 129 of file OTstream.C.

References append().

Here is the call graph for this function:

◆ write() [10/10]

Foam::Ostream & write ( const char *  data,
std::streamsize  count 
)
virtual

Implements Ostream.

Definition at line 137 of file OTstream.C.

References Foam::abort(), IOstreamOption::BINARY, Foam::FatalError, FatalErrorInFunction, format(), and NotImplemented.

Here is the call graph for this function:

◆ writeRaw()

Foam::Ostream & writeRaw ( const char *  data,
std::streamsize  count 
)
virtual

Implements Ostream.

Definition at line 153 of file OTstream.C.

References NotImplemented.

◆ beginRawWrite()

bool beginRawWrite ( std::streamsize  count)
virtual

Implements Ostream.

Definition at line 167 of file OTstream.C.

References Foam::abort(), IOstreamOption::BINARY, Foam::FatalError, FatalErrorInFunction, format(), and NotImplemented.

Here is the call graph for this function:

◆ endRawWrite()

virtual bool endRawWrite ( )
inlinevirtual

Implements Ostream.

Definition at line 162 of file OTstream.H.

◆ indent()

virtual void indent ( )
inlinevirtual

Implements Ostream.

Definition at line 168 of file OTstream.H.

◆ flags() [1/2]

virtual ios_base::fmtflags flags ( ) const
inlinevirtual

Implements IOstream.

Definition at line 175 of file OTstream.H.

◆ flags() [2/2]

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

Implements IOstream.

Definition at line 181 of file OTstream.H.

◆ flush()

virtual void flush ( )
inlinevirtual

Implements Ostream.

Definition at line 187 of file OTstream.H.

◆ endl()

virtual void endl ( )
inlinevirtual

Implements Ostream.

Definition at line 191 of file OTstream.H.

◆ fill() [1/2]

virtual char fill ( ) const
inlinevirtual

Implements Ostream.

Definition at line 196 of file OTstream.H.

◆ fill() [2/2]

virtual char fill ( const char  )
inlinevirtual

Implements Ostream.

Definition at line 202 of file OTstream.H.

◆ width() [1/2]

virtual int width ( ) const
inlinevirtual

Implements Ostream.

Definition at line 208 of file OTstream.H.

◆ width() [2/2]

virtual int width ( const int  )
inlinevirtual

Implements Ostream.

Definition at line 215 of file OTstream.H.

◆ precision() [1/2]

virtual int precision ( ) const
inlinevirtual

Implements Ostream.

Definition at line 221 of file OTstream.H.

◆ precision() [2/2]

virtual int precision ( const int  )
inlinevirtual

Implements Ostream.

Definition at line 228 of file OTstream.H.

◆ reset()

void reset ( )
inline

Definition at line 237 of file OTstream.H.

References OTstream::rewind().

Here is the call graph for this function:

◆ rewind()

virtual void rewind ( )
inlinevirtual

Definition at line 243 of file OTstream.H.

References DynamicList::clear(), IOstream::setGood(), and IOstream::setOpened().

Referenced by OTstream::reset().

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

◆ print()

void print ( Ostream os) const
virtual

Reimplemented from IOstream.

Definition at line 182 of file OTstream.C.

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

Here is the call graph for this function:

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