Aegis  4.25.D505
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
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_tbuffer
size_t buffer_size
wchar_tbuffer_position
wchar_tbuffer_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

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 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_header, wide_output_column, wide_output_wrap, wide_output_truncate, wide_output_head, wide_output_unexpand, wide_output_to_narrow, and wide_output_expand.

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_header, wide_output_column, wide_output_wrap, wide_output_truncate, wide_output_head, wide_output_unexpand, wide_output_to_narrow, and wide_output_expand.

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 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_header, wide_output_column, wide_output_wrap, wide_output_truncate, wide_output_head, wide_output_unexpand, wide_output_to_narrow, and wide_output_expand.

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

Parameters:
sthe string to be converted and written
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:
wcthe character to write after the buffer
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_header, wide_output_column, wide_output_wrap, wide_output_truncate, wide_output_head, wide_output_unexpand, wide_output_to_narrow, and wide_output_expand.

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_header, wide_output_column, wide_output_wrap, wide_output_truncate, wide_output_head, wide_output_unexpand, wide_output_to_narrow, and wide_output_expand.

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:
textthe string to convert and 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:
wcthe wide character to be written

Definition at line 82 of file wide_output.h.

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:
wspthe string to write

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

Parameters:
wspthe wide character string to be written

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

Parameters:
funcThe functor to be called
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_header, wide_output_column, wide_output_wrap, wide_output_truncate, wide_output_head, wide_output_unexpand, wide_output_to_narrow, and wide_output_expand.

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

Parameters:
funcThe functor not to be called
void wide_output::write ( const wstring s)

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

Parameters:
sthe wide character string to be written
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:
dataThe data to be written
lenThe number of wide characters to be written
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:
dataThe data to be written
lenThe number of wide characters to be written

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


Field Documentation

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.

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 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.

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.

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: