wide_output Class Reference

#include <wide_output.h>

Inheritance diagram for wide_output:

wide_output_column wide_output_expand wide_output_head wide_output_header wide_output_to_narrow wide_output_truncate wide_output_unexpand wide_output_wrap

Public Types

typedef aegis_shared_ptr
< wide_output
pointer

Public Member Functions

virtual ~wide_output ()
void put_cstr (const char *text)
void put_ws (const wchar_t *wsp)
void put_wc (wchar_t wc)
void put_wstr (wstring_ty *wsp)
void write (const wstring &s)
void fputs (string_ty *s)
virtual nstring filename ()=0
void write (const wchar_t *data, size_t len)
void flush ()
virtual int page_width ()=0
virtual int page_length ()=0
void end_of_line ()
virtual const char * type_name () const =0
void register_delete_callback (functor::pointer func)
void unregister_delete_callback (functor::pointer func)

Protected Member Functions

 wide_output ()
virtual void write_inner (const wchar_t *data, size_t len)=0
virtual void flush_inner ()=0
virtual void end_of_line_inner ()=0

Private Member Functions

void overflow (wchar_t wc)

Private Attributes

wchar_t * buffer
size_t buffer_size
wchar_t * buffer_position
wchar_t * buffer_end
functor_stack callback

Detailed Description

The wide_output class is used to present a generic wchar_t output stream. It could go to a file or to a chained sequence of filters, it isn't known, and doesn't ned to be known.

Definition at line 39 of file wide_output.h.


Member Typedef Documentation

Definition at line 42 of file wide_output.h.


Constructor & Destructor Documentation

virtual wide_output::~wide_output (  )  [virtual]

The destructor.

wide_output::wide_output (  )  [protected]

The constructor.


Member Function Documentation

void wide_output::put_cstr ( const char *  text  ) 

The put_cstr method is used to write a C string onto the output, after it has been converted to wide characters.

Parameters:
text the string to convert and write

void wide_output::put_ws ( const wchar_t *  wsp  ) 

The put_ws method is used to write a C wide string (for example, L"example") onto the output.

Parameters:
wsp the string to write

void wide_output::put_wc ( wchar_t  wc  )  [inline]

The put_wc method is used to write a single side charcter (for example, L'x') to the output stream.

Parameters:
wc the wide character to be written

Definition at line 82 of file wide_output.h.

void wide_output::put_wstr ( wstring_ty wsp  ) 

The put_wstr method is used to write a wide string onto the output stream.

Parameters:
wsp the wide character string to be written

void wide_output::write ( const wstring s  ) 

The write method is used to write a wide string onto the output stream.

Parameters:
s the wide character string to be written

void wide_output::fputs ( string_ty s  ) 

The fputs method is used to write a string onto the output stream.

Parameters:
s the string to be converted and written

virtual nstring wide_output::filename (  )  [pure virtual]

The filename method is used to obtain the name of the file being written by this output stream.

Returns:
the name of the destination

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

void wide_output::write ( const wchar_t *  data,
size_t  len 
)

The write method is used to write a set of wide charactres, e.g. a substring.

Parameters:
data The data to be written
len The number of wide characters to be written

void wide_output::flush (  ) 

The flush method is used to ensure that all output generated to date is transferred from the internal buffering and delivered to the output file or destination.

virtual int wide_output::page_width (  )  [pure virtual]

The page-width method is used to obtain the width (in printing columns) of the output destination.

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

virtual int wide_output::page_length (  )  [pure virtual]

The length method is used to obtain the length (in whole lines) of the output destination.

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

void wide_output::end_of_line (  ) 

The end_of_line method is used to add a newline to the output stream if the current position of the output is not at the beginning of a line.

virtual const char* wide_output::type_name (  )  const [pure virtual]

The type_name method is used to return the name of the class of output. Useful for debugging.

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

void wide_output::register_delete_callback ( functor::pointer  func  ) 

The register_delete_callback method is used to register a functor to be called when this output stream instance is destroyed.

Parameters:
func The functor to be called

void wide_output::unregister_delete_callback ( functor::pointer  func  ) 

The unregister_delete_callback method is used to rescind and earlier register_delete_callback call.

Parameters:
func The functor not to be called

virtual void wide_output::write_inner ( const wchar_t *  data,
size_t  len 
) [protected, pure virtual]

The write_inner method is called by the write method to emit buffered data.

Parameters:
data The data to be written
len The number of wide characters to be written

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

virtual void wide_output::flush_inner (  )  [protected, pure virtual]

The flush_inner method is called by the flush method, after it writes any buffered data via the write_inner method.

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

virtual void wide_output::end_of_line_inner (  )  [protected, pure virtual]

The end_of_line_inner method is used to do end-of-line processing by the derived class, if the buffered character state is not sufficient for the end_of_line method to determine whether or not the output position is currently at the start of a line.

Implemented in wide_output_column, wide_output_expand, wide_output_head, wide_output_header, wide_output_to_narrow, wide_output_truncate, wide_output_unexpand, and wide_output_wrap.

void wide_output::overflow ( wchar_t  wc  )  [private]

The overflow method is used to flush the buffer and add the given character to the buffer in the case where the put_wc method determines there is no room left in the buffer for more characters.

Parameters:
wc the character to write after the buffer


Field Documentation

wchar_t* wide_output::buffer [private]

The buffer instance variable is used to remember the base address of a dynamically allocated array of wide characters, used to buffer the output and reduce the number of calles to the write_inner method.

Definition at line 222 of file wide_output.h.

size_t wide_output::buffer_size [private]

The buffer_size instance variable is used to remember the allocated size (in wide characters) of the buffer instance variable.

Definition at line 229 of file wide_output.h.

wchar_t* wide_output::buffer_position [private]

The buffer_position instance variable is used to remember the current write position (for the next call to put_wc) in the buffer of data.

assert(buffer <= buffer_position); assert(buffer_position <= buffer_end);

Definition at line 239 of file wide_output.h.

wchar_t* wide_output::buffer_end [private]

The buffer_end instance variable is used to remember the address which is immediately beyond the end of the allocated buffer array. This is used by put_wc to know when to call the overflow method.

assert(buffer_end == buffer + buffer_size);

Definition at line 249 of file wide_output.h.

The callback instance variable is used to remember the fallback(s), if any, to call when this instance is destroyed.

Definition at line 255 of file wide_output.h.


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

Generated on Wed Mar 12 23:37:45 2008 for Aegis by  doxygen 1.5.5