Source-highlight Library
Public Member Functions | Private Member Functions | Private Attributes | List of all members
srchilite::BufferedOutput Class Reference

The main class for writing into the output. More...

#include <bufferedoutput.h>

Collaboration diagram for srchilite::BufferedOutput:
Collaboration graph
[legend]

Public Member Functions

  BufferedOutput (std::ostream &os)
 
void  setAlwaysFlush (bool a=true)
  Whether to flush the output stream at each output operation. More...
 
void  output (const std::string &s)
  Writes the passed string into the output. More...
 
void  postLineInsert (const std::string &s)
  Writes the passed string into the contents to be output after the current line. More...
 
void  postDocInsert (const std::string &s)
  Writes the passed string into the contents to be output after the entire document. More...
 
template<typename T >
void  postLineInsertFrom (const T &s)
  Writes the elements of the passed generic collection into the contents to be output after the current line. More...
 
template<typename T >
void  postDocInsertFrom (const T &s)
  Writes the elements of the passed generic collection into the contents to be output after the entire document. More...
 
void  writePostLine (const std::string &prefix="")
  Writes all the (buffered) elements after the current line (and clear the buffer) More...
 
void  writePostDoc (const std::string &prefix="")
  Writes all the (buffered) elements after the current document (and clear the buffer) More...
 

Private Member Functions

void  writePostInfo (PostContents &post, const std::string &prefix="")
  Writes all the (buffered) elements (and clear the buffer) More...
 

Private Attributes

std::ostream &  outputBuff
  the stream used to output strings
 
bool  alwaysFlush
  whether to flush the output stream at each output operation
 
  the contents to be output after each line
 
  the contents to be output after the entire document
 

Detailed Description

The main class for writing into the output.

It wraps an ostream object and can perform buffering. Moreover, it provides functionalities to write something after a line or after an entire document (these contents are buffered so that they can be inserted at any time, with postLineInsert and postDocInsert and will be actually inserted in the output with writePostLine and writePostDoc).

Constructor & Destructor Documentation

srchilite::BufferedOutput::BufferedOutput ( std::ostream &  os )
Parameters
os the ostream where data will be written

Member Function Documentation

void srchilite::BufferedOutput::output ( const std::string &  s )

Writes the passed string into the output.

Parameters
s
void srchilite::BufferedOutput::postDocInsert ( const std::string &  s )

Writes the passed string into the contents to be output after the entire document.

Parameters
s
template<typename T >
void srchilite::BufferedOutput::postDocInsertFrom ( const T &  s )
inline

Writes the elements of the passed generic collection into the contents to be output after the entire document.

Parameters
s
void srchilite::BufferedOutput::postLineInsert ( const std::string &  s )

Writes the passed string into the contents to be output after the current line.

Parameters
s
template<typename T >
void srchilite::BufferedOutput::postLineInsertFrom ( const T &  s )
inline

Writes the elements of the passed generic collection into the contents to be output after the current line.

Parameters
s
void srchilite::BufferedOutput::setAlwaysFlush ( bool  a = true )
inline

Whether to flush the output stream at each output operation.

Parameters
a
void srchilite::BufferedOutput::writePostDoc ( const std::string &  prefix = "" )

Writes all the (buffered) elements after the current document (and clear the buffer)

Parameters
prefix the string to prefix all the elements
void srchilite::BufferedOutput::writePostInfo ( PostContentspost,
const std::string &  prefix = "" 
)
private

Writes all the (buffered) elements (and clear the buffer)

Parameters
post the buffered elements
prefix the string to prefix all the elements
void srchilite::BufferedOutput::writePostLine ( const std::string &  prefix = "" )

Writes all the (buffered) elements after the current line (and clear the buffer)

Parameters
prefix the string to prefix all the elements

The documentation for this class was generated from the following files:
  • /home/bettini/work/source-highlight/src-highlite/lib/srchilite/bufferedoutput.h
  • /home/bettini/work/source-highlight/src-highlite/lib/srchilite/bufferedoutput.cpp

AltStyle によって変換されたページ (->オリジナル) /