Output token stream. More...
Public Member Functions | |
oTstream (const word &nm) | |
emtpy stream with a name More... | |
oTstream (const oTstream &src) | |
copy construcotr More... | |
oTstream (oTstream &&)=default | |
move construct More... | |
virtual | ~oTstream ()=default |
destructor More... | |
const tokenList & | tokens () const |
tokenList & | tokens () |
virtual bool | write (const token &tok) |
Write token to stream or otherwise handle it. More... | |
virtual iOstream & | write (const char c) |
Write single character. Whitespace is suppressed. More... | |
virtual iOstream & | write (const char *str) |
Write the word-characters of a character string. More... | |
virtual iOstream & | write (const word &str) |
Write word. More... | |
virtual iOstream & | writeQuoted (const std::string &str, const bool quoted=true) |
Write std::string surrounded by quotes. More... | |
virtual iOstream & | write (const int64 val) override |
Write int64. More... | |
virtual iOstream & | write (const int32 val) override |
Write int32. More... | |
virtual iOstream & | write (const int8 val) override |
Write int8. More... | |
virtual iOstream & | write (const uint64 val) override |
Write uint64. More... | |
virtual iOstream & | write (const uint32 val) override |
Write uint32. More... | |
virtual iOstream & | write (const uint8 val) override |
Write uint8. More... | |
virtual iOstream & | write (const float val) override |
Write float. More... | |
virtual iOstream & | write (const double val) override |
Write double. More... | |
virtual iOstream & | write (const size_t val) override |
Write double. More... | |
void | seek (size_t pos) override |
iOstream & | write (const char *binaryData, std::streamsize count) override |
Write a block of binray data. More... | |
virtual void | append (const token &tok) |
append token to the stream More... | |
virtual void | append (const tokenList &tLisk) |
append a list of tokens to the stream More... | |
void | reset () |
Reset the output buffer and rewind the stream. More... | |
virtual void | rewind () |
Rewind the output stream. More... | |
virtual void | indent () |
Add indentation characters. More... | |
virtual void | startOfBinaryStreaming () |
Add a new line and flush stream. More... | |
virtual void | endOfBinaryStreaming () |
Reach end of file add a new line and flush stream. More... | |
virtual void | flush () |
Flush stream. More... | |
virtual void | endl () |
Add newline and flush stream. More... | |
virtual char | fill () const |
Get the current padding character. More... | |
virtual char | fill (const char) |
Set padding character for formatted field up to field width. More... | |
virtual int | width () const |
Get width of output field. More... | |
virtual int | width (const int) |
Set width of output field. More... | |
virtual int | precision () const |
Get precision of output field. More... | |
virtual int | precision (const int) |
Set precision of output field. More... | |
virtual ios_base::fmtflags | flags () const |
Return flags of output stream. More... | |
ios_base::fmtflags | flags (const ios_base::fmtflags) |
Set flags of stream. More... | |
![]() | |
iOstream () | |
Default. More... | |
iOstream (writeFormat wF) | |
Construct from writeFormat. More... | |
iOstream (const iOstream &)=default | |
Copy construct. More... | |
virtual | ~iOstream ()=default |
Destructor. More... | |
virtual iOstream & | writeBinaryBlockFlag () |
Write the flag to indicate the start of a binary block. More... | |
unsigned short | indentSize () const |
Return indent level. More... | |
unsigned short & | indentSize () |
Access to indent size. More... | |
unsigned short | indentLevel () const |
Return indent level. More... | |
unsigned short & | indentLevel () |
Access to indent level. More... | |
void | incrIndent () |
Increment the indent level. More... | |
void | decrIndent () |
Decrement the indent level. More... | |
virtual iOstream & | beginBlock (const word &kw) |
Write begin block group with a name Increments indentation, adds newline. More... | |
virtual iOstream & | beginBlock () |
Write begin block group without a name Increments indentation, adds newline. More... | |
virtual iOstream & | endBlock () |
Write end block group Decrements indentation, adds newline. More... | |
virtual iOstream & | beginList () |
Write begin list "(". More... | |
virtual iOstream & | beginList (const word &kw) |
Write begin list with keyword "kw (". More... | |
virtual iOstream & | endList () |
Write end list ")". More... | |
virtual iOstream & | beginSquare () |
Write begin list "[". More... | |
virtual iOstream & | beginSquare (const word &kw) |
Write begin list with keyword "kw [". More... | |
virtual iOstream & | endSquare () |
Write end list "]". More... | |
virtual iOstream & | endEntry () |
Write end entry (';') followed by newline. More... | |
virtual iOstream & | newLine () |
Write a newLine to stream. More... | |
virtual iOstream & | space (int32 n=1) |
Write space to stream. More... | |
virtual iOstream & | writeWordKeyword (const word &kw) |
Write the keyword followed by an appropriate indentation. More... | |
template<class T > | |
iOstream & | writeWordEntry (const word &key, const T &value) |
Write a keyword/value entry. More... | |
iOstream & | operator() () const |
Return a non-const reference to const iOstream Needed for write functions where the stream argument is temporary: e.g. More... | |
![]() | |
IOstream () | |
Default. More... | |
IOstream (writeFormat wF) | |
Construct and set write format. More... | |
IOstream (const IOstream &)=default | |
Copy. More... | |
virtual | ~IOstream ()=default |
Destructor. More... | |
virtual const word & | name () const |
Return the name of the stream. More... | |
virtual word & | name () |
Return non-const access to the name of the stream. More... | |
virtual bool | check (const char *operation) const |
Check IOstream status for given operation. More... | |
bool | fatalCheck (const char *operation) const |
Check IOstream status for given operation. More... | |
bool | opened () const |
Return true if stream has been opened. More... | |
bool | closed () const |
Return true if stream is closed. More... | |
bool | isBinary () const |
Return true if stream format is binray. More... | |
bool | good () const |
Return true if next operation might succeed. More... | |
bool | eof () const |
Return true if end of input seen. More... | |
bool | fail () const |
Return true if next operation will fail. More... | |
bool | bad () const |
Return true if stream is corrupted. More... | |
operator bool () const | |
Return true if the stream has not failed. More... | |
bool | operator! () const |
Return true if the stream has failed. More... | |
int32 | lineNumber () const |
Const access to the current stream line number. More... | |
int32 & | lineNumber () |
Non-const access to the current stream line number. More... | |
int32 | lineNumber (const int32 num) |
Set the stream line number return the previous value. More... | |
void | setEof () |
Set stream to have reached eof. More... | |
void | setFail () |
Set stream to have failed. More... | |
void | setBad () |
Set stream to be bad. More... | |
ios_base::fmtflags | setf (const ios_base::fmtflags f) |
Set flags of stream. More... | |
ios_base::fmtflags | setf (const ios_base::fmtflags f, const ios_base::fmtflags mask) |
Set flags of given field of stream. More... | |
void | unsetf (const ios_base::fmtflags f) |
Unset flags of stream. More... | |
Protected Attributes | |
word | name_ |
name of stream More... | |
tokenList | tokenList_ |
tokenList More... | |
![]() | |
unsigned short | indentSize_ = 4 |
Number of spaces per indent level. More... | |
unsigned short | indentLevel_ = 0 |
Current indent level. More... | |
![]() | |
streamAccess | openClosed_ |
Is stream open or closed. More... | |
writeFormat | writeFormat_ = ASCII |
write format More... | |
ios_base::iostate | ioState_ |
state More... | |
int32 | lineNumber_ |
The file line. More... | |
Additional Inherited Members | |
![]() | |
enum | streamAccess : char { CLOSED = 0, OPENED } |
enum | writeFormat : char { ASCII = 0, BINARY } |
![]() | |
static unsigned int | defaultPrecision () |
Return the default precision. More... | |
static unsigned int | defaultPrecision (unsigned int prec) |
Reset the default precision return the previous value. More... | |
![]() | |
static unsigned int | precision_ = 6 |
Default precision, only works for ASCII. More... | |
![]() | |
void | setOpened () |
Set stream opened. More... | |
void | setClosed () |
Set stream closed. More... | |
void | setState (ios_base::iostate state) |
Set stream state. More... | |
void | setWriteFormat (writeFormat wF) |
void | setGood () |
Set stream to be good. More... | |
![]() | |
static constexpr const unsigned short | entryIndentation_ = 16 |
Indentation of the entry from the start of the keyword. More... | |
![]() | |
static word | staticName_ |
Name for any generic stream - normally treat as readonly. More... | |
Output token stream.
It is based on OpenFOAM stream, with some modifications/simplifications to be tailored to our needs.
Definition at line 48 of file oTstream.hpp.
emtpy stream with a name
Definition at line 6 of file oTstream.cpp.
copy construcotr
Definition at line 19 of file oTstream.cpp.
|
virtualdefault |
destructor
pFlow::tokenList & tokens | ( | ) | const |
Definition at line 32 of file oTstream.cpp.
References oTstream::tokenList_.
Referenced by dataEntry::dataEntry().
tokenList& tokens | ( | ) |
|
virtual |
Write token to stream or otherwise handle it.
return false if the token type was not handled by this method
Implements iOstream.
Definition at line 44 of file oTstream.cpp.
References token::good().
|
virtual |
Write single character. Whitespace is suppressed.
Implements iOstream.
Definition at line 56 of file oTstream.cpp.
|
virtual |
Write the word-characters of a character string.
Sends as a single char, or as word.
Implements iOstream.
Definition at line 68 of file oTstream.cpp.
|
virtual |
|
virtual |
Write std::string surrounded by quotes.
Optional write without quotes.
Implements iOstream.
Definition at line 86 of file oTstream.cpp.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Implements iOstream.
Definition at line 176 of file oTstream.cpp.
References notImplementedFunction.
|
overridevirtual |
Write a block of binray data.
Implements iOstream.
Definition at line 167 of file oTstream.cpp.
References notImplementedFunction.
|
virtual |
append token to the stream
Definition at line 181 of file oTstream.cpp.
References pFlow::validTokenForStream().
|
virtual |
append a list of tokens to the stream
Definition at line 188 of file oTstream.cpp.
void reset | ( | ) |
Reset the output buffer and rewind the stream.
Definition at line 196 of file oTstream.cpp.
|
virtual |
Rewind the output stream.
Definition at line 202 of file oTstream.cpp.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Reach end of file add a new line and flush stream.
Implements iOstream.
Definition at line 167 of file oTstream.hpp.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Get the current padding character.
Implements iOstream.
Definition at line 180 of file oTstream.hpp.
|
inlinevirtual |
Set padding character for formatted field up to field width.
Implements iOstream.
Definition at line 186 of file oTstream.hpp.
|
inlinevirtual |
|
inlinevirtual |
Set width of output field.
Implements iOstream.
Definition at line 199 of file oTstream.hpp.
|
inlinevirtual |
|
inlinevirtual |
Set precision of output field.
Implements iOstream.
Definition at line 212 of file oTstream.hpp.
|
inlinevirtual |
|
inlinevirtual |
|
protected |
name of stream
Definition at line 56 of file oTstream.hpp.
|
protected |