Class for native "cooked" text-format token output.
Public Member Functions | |
Constructors etc. | |
TokenWriterNative (int fmt=tiofWellDone, const std::string name="TokenWriterNative") | |
virtual | ~TokenWriterNative (void) |
Overrides | |
virtual void | put_token (const mootToken &token) |
virtual void | put_tokens (const mootSentence &tokens) |
virtual void | put_sentence (const mootSentence &sentence) |
virtual void | put_raw_buffer (const char *buf, size_t len) |
Output Utilities | |
void | _put_token (const mootToken &token, mootio::mostream *os) |
void | _put_tokens (const mootSentence &tokens, mootio::mostream *os) |
void | _put_sentence (const mootSentence &sentence, mootio::mostream *os) |
void | _put_comment (const char *buf, size_t len, mootio::mostream *os) |
void | _put_raw_buffer (const char *buf, size_t len, mootio::mostream *os) |
std::string | token2string (const mootToken &token) |
std::string | sentence2string (const mootSentence &sentence) |
Public Member Functions inherited from moot::TokenWriter | |
TokenWriter (int fmt=tiofWellDone, const std::string &name="TokenWriter") | |
virtual | ~TokenWriter (void) |
virtual void | to_mstream (mootio::mostream *mostreamp) |
virtual void | to_mstream (mootio::mostream &mos) |
virtual void | to_filename (const char *filename) |
virtual void | to_file (FILE *file) |
virtual void | to_fd (int fd) |
virtual void | to_cxxstream (std::ostream &os) |
virtual void | close (void) |
virtual bool | opened (void) |
virtual bool | flush (void) |
bool | autoflush (mootio::mostream *os) |
virtual void | put_comment_block_begin (void) |
virtual void | put_comment_block_end (void) |
virtual void | put_comment_buffer (const char *buf, size_t len) |
virtual void | put_comment (const char *s) |
virtual void | put_comment_buffer (const std::string &s) |
virtual void | printf_comment (const char *fmt,...) |
virtual void | put_raw (const char *s) |
virtual void | put_raw (const std::string &s) |
virtual void | printf_raw (const char *fmt,...) |
virtual void | writer_name (const std::string &myname) |
virtual void | carp (const char *fmt,...) |
Public Attributes | |
mootio::mocbuffer | twn_tmpbuf |
Public Attributes inherited from moot::TokenWriter | |
int | tw_format |
std::string | tw_name |
mootio::mostream * | tw_ostream |
bool | tw_ostream_created |
bool | tw_is_comment_block |
void * | tw_data |
Additional Inherited Members | |
Static Public Member Functions inherited from moot::TokenIO | |
static int | parse_format_string (const std::string &fmtString) |
static int | guess_filename_format (const char *filename) |
static bool | is_empty_format (int fmt) |
static int | sanitize_format (int fmt, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static int | parse_format_request (const char *request, const char *filename=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static std::string | format_canonical_string (int fmt) |
static class TokenReader * | new_reader (int fmt) |
static class TokenWriter * | new_writer (int fmt) |
static class TokenReader * | file_reader (const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static class TokenWriter * | file_writer (const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static size_t | pipe_tokens (class TokenReader *reader, class TokenWriter *writer) |
static size_t | pipe_sentences (class TokenReader *reader, class TokenWriter *writer) |
|
inline |
Default constructor
References moot::tiofNative.
|
inlinevirtual |
Default destructor
|
inlinevirtual |
Write a single token to the currently selected output sink. Descendants must override this method.
Reimplemented from moot::TokenWriter.
|
inlinevirtual |
Write a single (partial) sentence to the currently selected output sink. Descendants may override this method. Default implementation just calls put_token() for every element of sentence.
Reimplemented from moot::TokenWriter.
|
inlinevirtual |
Write a single sentence to the currently selected output sink. Descendants may override this method. Default implementation just calls put_sentence().
Reimplemented from moot::TokenWriter.
|
inlinevirtual |
Write some data to the currently selected output sink Descendants may override this method.
Reimplemented from moot::TokenWriter.
void moot::TokenWriterNative::_put_token | ( | const mootToken & | token, |
mootio::mostream * | os | ||
) |
Write a single token to a mootio::mostream (with eot marker)
void moot::TokenWriterNative::_put_tokens | ( | const mootSentence & | tokens, |
mootio::mostream * | os | ||
) |
Write a partial sentence to a mootio::mostream (without eos marker)
void moot::TokenWriterNative::_put_sentence | ( | const mootSentence & | sentence, |
mootio::mostream * | os | ||
) |
Write a whole sentence to a mootio::mostream (with eos marker)
void moot::TokenWriterNative::_put_comment | ( | const char * | buf, |
size_t | len, | ||
mootio::mostream * | os | ||
) |
Write a raw comment to a mootio::mostream
void moot::TokenWriterNative::_put_raw_buffer | ( | const char * | buf, |
size_t | len, | ||
mootio::mostream * | os | ||
) |
Write some raw data to a mootio::mostream, respecting tw_is_comment_block
|
inline |
Clear internal buffer and stringify sentence into it, returning result as a new std::string
References mootio::mcbuffer::clear(), mootio::micbuffer::data(), and mootio::micbuffer::size().
|
inline |
Clear internal buffer and stringify sentence into it, returning result as a new std::string
References mootio::mcbuffer::clear(), mootio::micbuffer::data(), and mootio::micbuffer::size().
mootio::mocbuffer moot::TokenWriterNative::twn_tmpbuf |
Temporary buffer for *2string methods