# PhasicFlow: src/phasicFlow/streams/TStream/oTstream.hpp Source File

oTstream.hpp
Go to the documentation of this file.
#ifndef __oTstream_hpp__
#define __oTstream_hpp__
#include "tokenList.hpp"
#include "iOstream.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace pFlow
{
// helper functions declearation
inline bool validTokenForStream(const token tok);
inline bool isBeginToken(const token& tok);
inline bool isEndToken(const token& tok);
class oTstream
:
public iOstream
{
protected:
// - name of stream
word name_;
// - tokenList
tokenList tokenList_;
public:
// - emtpy stream with a name
oTstream(const word& nm);
// - copy construcotr
oTstream(const oTstream& src);
// - move construct
oTstream(oTstream&&) = default;
// - destructor
virtual ~oTstream() = default;
// give const access
const tokenList& tokens()const;
// give access
tokenList& tokens();
//- Write token to stream or otherwise handle it.
// return false if the token type was not handled by this method
virtual bool write(const token& tok);
//- Write single character. Whitespace is suppressed.
virtual iOstream& write(const char c);
//- Write the word-characters of a character string.
// Sends as a single char, or as word.
virtual iOstream& write(const char* str);
//- Write word
virtual iOstream& write(const word& str);
//- Write std::string surrounded by quotes.
// Optional write without quotes.
virtual iOstream& writeQuoted(const std::string& str, const bool quoted=true );
//- Write int64
virtual iOstream& write(const int64 val) override;
//- Write int32
virtual iOstream& write(const int32 val) override;
//- Write label
virtual iOstream& write(const label val) override;
//- Write uint32
virtual iOstream& write(const uint32 val) override;
//- Write uint16
virtual iOstream& write(const uint16 val) override;
//- Write float
virtual iOstream& write(const float val) override;
//- Write double
virtual iOstream& write(const double val) override;
// - append token to the stream
virtual void append(const token& tok);
// - append a list of tokens to the stream
virtual void append(const tokenList& tLisk);
//- Reset the output buffer and rewind the stream
void reset();
//- Rewind the output stream
virtual void rewind();
//- Add indentation characters
virtual void indent()
{}
//- Flush stream
virtual void flush()
{}
//- Add newline and flush stream
virtual void endl()
{}
//- Get the current padding character
// \return previous padding character
virtual char fill() const
{
return 0;
}
//- Set padding character for formatted field up to field width
virtual char fill(const char)
{
return 0;
}
//- Get width of output field
virtual int width() const
{
return 0;
}
//- Set width of output field
// \return previous width
virtual int width(const int)
{
return 0;
}
//- Get precision of output field
virtual int precision() const
{
return 0;
}
//- Set precision of output field
// \return old precision
virtual int precision(const int)
{
return 0;
}
//- Return flags of output stream
virtual ios_base::fmtflags flags() const
{
return ios_base::fmtflags(0);
}
//- Set flags of stream
ios_base::fmtflags flags(const ios_base::fmtflags)
{
return ios_base::fmtflags(0);
}
};
#include "helperTstream.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace pFlow
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
pFlow::oTstream::flags
ios_base::fmtflags flags(const ios_base::fmtflags)
Definition: oTstream.hpp:179
pFlow::oTstream
Definition: oTstream.hpp:23
pFlow::List< token >
pFlow::isBeginToken
bool isBeginToken(const token &tok)
pFlow::token
Definition: token.hpp:42
pFlow::oTstream::name_
word name_
Definition: oTstream.hpp:31
pFlow::oTstream::endl
virtual void endl()
Definition: oTstream.hpp:130
pFlow::isEndToken
bool isEndToken(const token &tok)
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:59
helperTstream.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::oTstream::append
virtual void append(const token &tok)
Definition: oTstream.cpp:153
pFlow::int64
long long int int64
Definition: builtinTypes.hpp:55
pFlow::oTstream::width
virtual int width(const int)
Definition: oTstream.hpp:154
pFlow::oTstream::indent
virtual void indent()
Definition: oTstream.hpp:122
pFlow::oTstream::precision
virtual int precision() const
Definition: oTstream.hpp:160
pFlow::oTstream::flush
virtual void flush()
Definition: oTstream.hpp:126
pFlow::oTstream::reset
void reset()
Definition: oTstream.cpp:168
pFlow::oTstream::fill
virtual char fill(const char)
Definition: oTstream.hpp:141
pFlow::oTstream::fill
virtual char fill() const
Definition: oTstream.hpp:135
pFlow::oTstream::tokens
const tokenList & tokens() const
Definition: oTstream.cpp:32
pFlow::validTokenForStream
bool validTokenForStream(const token tok)
pFlow
Definition: demComponent.hpp:28
pFlow::oTstream::oTstream
oTstream(const word &nm)
Definition: oTstream.cpp:6
tokenList.hpp
pFlow::uint16
unsigned short int uint16
Definition: builtinTypes.hpp:57
pFlow::oTstream::flags
virtual ios_base::fmtflags flags() const
Definition: oTstream.hpp:173
pFlow::oTstream::width
virtual int width() const
Definition: oTstream.hpp:147
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::oTstream::rewind
virtual void rewind()
Definition: oTstream.cpp:174
pFlow::oTstream::writeQuoted
virtual iOstream & writeQuoted(const std::string &str, const bool quoted=true)
Definition: oTstream.cpp:86
pFlow::oTstream::precision
virtual int precision(const int)
Definition: oTstream.hpp:167
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::oTstream::write
virtual bool write(const token &tok)
Definition: oTstream.cpp:44
pFlow::oTstream::~oTstream
virtual ~oTstream()=default
iOstream.hpp
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::oTstream::tokenList_
tokenList tokenList_
Definition: oTstream.hpp:34