Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xstream::dater Class Reference

filter that add a time stamp on the begining of each line More...

#include <dater.h>

+ Inheritance diagram for xstream::dater:

Public Member Functions

 dater (std::streambuf *sb, const std::string &format="[%c] ", char separator='\n', bool write_first=true)
 construct using another streambuf More...
 
 ~dater ()
 

Protected Member Functions

std::streamsize available () const
 remaining characters in the buffer More...
 
std::streamsize taken () const
 number of characters in the buffer More...
 

Private Member Functions

void write_date ()
 writes the current date to the streambuf More...
 
int sync ()
 tries to write as much data as possible (overloaded from streambuf) More...
 
int overflow (int c)
 write a character that surpasses buffer end (overloaded from streambuf) More...
 
std::streamsize xsputn (const char *buffer, std::streamsize n)
 write an entire buffer (overloaded from streambuf) More...
 

Private Attributes

std::streambuf * _sb
 
posix::date_format date
 
char separator
 
bool write_next
 

Detailed Description

filter that add a time stamp on the begining of each line

Definition at line 23 of file dater.h.

Constructor & Destructor Documentation

xstream::dater::dater ( std::streambuf *  sb,
const std::string format = "[%c] ",
char  separator = '\n',
bool  write_first = true 
)

construct using another streambuf

Parameters
sbstreambuf to write data to
formatformat string for strftime defaults to [c] the preferred date and time representation for the current locale
separatorcharacter that signal a change of line, defaults to newline
write_firstif true date is written right before the first write. default is true

Definition at line 10 of file src/dater.cpp.

References LOG.

xstream::dater::~dater ( )

destructor

Definition at line 71 of file src/dater.cpp.

References _sb, and LOG.

Member Function Documentation

std::streamsize xstream::ostreambuf::available ( ) const
inlineprotectedinherited

remaining characters in the buffer

Definition at line 28 of file common.h.

Referenced by xstream::base64::ostreambuf::~ostreambuf().

int xstream::dater::overflow ( int  c)
private

write a character that surpasses buffer end (overloaded from streambuf)

Definition at line 21 of file src/dater.cpp.

References _sb, c, LOG, separator, write_date(), and write_next.

int xstream::dater::sync ( )
private

tries to write as much data as possible (overloaded from streambuf)

Definition at line 16 of file src/dater.cpp.

References _sb, and LOG.

std::streamsize xstream::ostreambuf::taken ( ) const
inlineprotectedinherited

number of characters in the buffer

Definition at line 36 of file common.h.

Referenced by xstream::digest::stream::xsputn().

void xstream::dater::write_date ( )
private

writes the current date to the streambuf

Definition at line 63 of file src/dater.cpp.

References _sb, date, LOG, xstream::posix::date_format::now(), string, and write_next.

Referenced by overflow(), and xsputn().

std::streamsize xstream::dater::xsputn ( const char *  buffer,
std::streamsize  n 
)
private

write an entire buffer (overloaded from streambuf)

Definition at line 37 of file src/dater.cpp.

References _sb, LOG, separator, string, write_date(), and write_next.

Member Data Documentation

std::streambuf* xstream::dater::_sb
private

streambuf were data is written to

Definition at line 26 of file dater.h.

Referenced by overflow(), sync(), write_date(), xsputn(), and ~dater().

posix::date_format xstream::dater::date
private

Definition at line 27 of file dater.h.

Referenced by write_date().

char xstream::dater::separator
private

data is written after this character

Definition at line 28 of file dater.h.

Referenced by overflow(), and xsputn().

bool xstream::dater::write_next
private

Definition at line 29 of file dater.h.

Referenced by overflow(), write_date(), and xsputn().


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