output Class Reference

#include <output.h>

Inheritance diagram for output:

output_base64 output_bit_bucket output_bzip2 output_cpio output_cpio_child output_cpio_child2 output_file output_gzip output_indent output_memory output_pager output_prefix output_quoted_printable output_stdout output_tee output_to_wide output_uuencode

Public Types

typedef aegis_shared_ptr< outputpointer
typedef void(* delete_callback_ty )(output *, void *)

Public Member Functions

virtual ~output ()
virtual nstring filename () const =0
long ftell () const
void write (const void *data, size_t nbytes)
void flush ()
virtual int page_width () const
virtual int page_length () const
void end_of_line ()
virtual const char * type_name () const =0
void fputc (char c)
void fputs (const char *str)
void fputs_xml (const char *str, bool paragraphs=false)
void fputs (string_ty *str)
void fputs_xml (string_ty *str, bool paragraphs=false)
void fputs (const nstring &str)
void fputs_xml (const nstring &str, bool paragraphs=false)
void fprintf (const char *fmt,...)
void vfprintf (const char *fmt, va_list)
void register_delete_callback (functor::pointer fp)
void unregister_delete_callback (functor::pointer fp)

Protected Member Functions

 output ()

Private Member Functions

virtual long ftell_inner () const =0
virtual void write_inner (const void *data, size_t length)=0
virtual void end_of_line_inner ()=0
virtual void flush_inner ()
void overflow (char c)
 output (const output &)
outputoperator= (const output &)

Private Attributes

functor_stack callback
unsigned char * buffer
size_t buffer_size
unsigned char * buffer_position
unsigned char * buffer_end

Detailed Description

The output class is used to describe the interface to an arbitrary output destination. It could be a file, it could be a string, or many other things, including several filters.

Definition at line 39 of file output.h.


Member Typedef Documentation

The pointer type is used to describe a pointer to an output destination.

Definition at line 46 of file output.h.

typedef void(* output::delete_callback_ty)(output *, void *)


Constructor & Destructor Documentation

virtual output::~output (  )  [virtual]

The destructor.

output::output (  )  [protected]

The default constructor. May only be called by derived classes.

output::output ( const output  )  [private]

The copy constructor. Do not use.


Member Function Documentation

virtual nstring output::filename (  )  const [pure virtual]

long output::ftell (  )  const

The ftell method is used to determine the current file position of the output.

void output::write ( const void *  data,
size_t  nbytes 
)

The write method is used to write date to the output.

void output::flush (  ) 

The flush method is used to ensure that any buffered data is written to the output.

virtual int output::page_width (  )  const [virtual]

The page_width method is used to obtain the width of the page of the output device.

Reimplemented in output_base64, output_bit_bucket, output_bzip2, output_file, output_gzip, output_indent, output_prefix, output_quoted_printable, output_stdout, output_tee, output_to_wide, and output_uuencode.

virtual int output::page_length (  )  const [virtual]

The page_length method is used to obtain the length of the page of the output device.

Reimplemented in output_base64, output_bit_bucket, output_bzip2, output_file, output_gzip, output_indent, output_prefix, output_quoted_printable, output_stdout, output_tee, output_to_wide, and output_uuencode.

void output::end_of_line (  ) 

The end_of_line method is used to ensure that the current output position is at the beginning of a line.

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

void output::fputc ( char  c  )  [inline]

The fputc method is used to write a single character to the output. The output is buffered.

Definition at line 114 of file output.h.

void output::fputs ( const char *  str  ) 

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

Parameters:
str The string to be written out.

void output::fputs_xml ( const char *  str,
bool  paragraphs = false 
)

The fputs method is used to write a NUL terminated string to the output stream, encoding any XML special characters (e.g. "<" becomes "&lt;", etc).

Parameters:
str The string to be written out.
paragraphs If true, insert
for two newlines and
for single newlines; if false, simply pass newlines through.

void output::fputs ( string_ty str  ) 

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

Parameters:
str The string to be written out.

void output::fputs_xml ( string_ty str,
bool  paragraphs = false 
)

The fputs_xml method is used to write a string to the output stream, encoding any XML special characters (e.g. "<" becomes "&lt;", etc).

Parameters:
str The string to be written out.
paragraphs If true, insert
for two newlines and
for single newlines; if false, simply pass newlines through.

void output::fputs ( const nstring str  ) 

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

Parameters:
str The string to be written out.

void output::fputs_xml ( const nstring str,
bool  paragraphs = false 
)

The fputs_xml method is used to write a string to the output stream, encoding any XML special characters (e.g. "<" becomes "&lt;", etc).

Parameters:
str The string to be written out.
paragraphs If true, insert
for two newlines and
for single newlines; if false, simply pass newlines through.

void output::fprintf ( const char *  fmt,
  ... 
)

The fprintf method produces output according to a format as described in the printf(3) man page.

Parameters:
fmt This method writes the output under the control of a format string that specifies how subsequent arguments (or arguments accessed via the variable-length argument facilities of stdarg(3)) are converted for output.

void output::vfprintf ( const char *  fmt,
va_list   
)

The vfprintf method is equivalent to the fprintf method, except that it is called with a va_list instead of a variable number of arguments. This method does not call the va_end macro. Consequently, the value of ap is undefined after the call. The application should call va_end(ap) itself afterwards.

void output::register_delete_callback ( functor::pointer  fp  ) 

The register_delete_callback method is used to set the callback functor to be called by the destructor.

void output::unregister_delete_callback ( functor::pointer  fp  ) 

The unregister_delete_callback method is used to forget a callback functor to be called by the destructor.

virtual long output::ftell_inner (  )  const [private, pure virtual]

The ftell_inner method is used to determine the current file position, without taking the buffering into account.

Implemented in output_base64, output_bit_bucket, output_bzip2, output_cpio, output_cpio_child, output_cpio_child2, output_file, output_gzip, output_indent, output_memory, output_pager, output_prefix, output_quoted_printable, output_stdout, output_tee, output_to_wide, and output_uuencode.

virtual void output::write_inner ( const void *  data,
size_t  length 
) [private, pure virtual]

virtual void output::end_of_line_inner (  )  [private, pure virtual]

The end_of_line_inner method is used to ensure that the current output position is at the beginning of a line, without taking the buffering into account.

Implemented in output_base64, output_bit_bucket, output_bzip2, output_cpio, output_cpio_child, output_cpio_child2, output_file, output_gzip, output_indent, output_memory, output_pager, output_prefix, output_quoted_printable, output_stdout, output_tee, output_to_wide, and output_uuencode.

virtual void output::flush_inner (  )  [private, virtual]

The flush_inner method is called by the flush method once all the data has been written. The default implementation does nothing.

Reimplemented in output_cpio_child2, output_pager, output_prefix, output_quoted_printable, output_tee, and output_to_wide.

void output::overflow ( char  c  )  [private]

The overflow mwthod is used by the fputc method when the buffer is full. It write the buffer to the output, and then adds the single character to the buffer.

output& output::operator= ( const output  )  [private]

The assignment operator. Do not use.


Field Documentation

The callback instance variable is used to remember the functor(s) to be called when this output stream is destroyed.

Definition at line 257 of file output.h.

unsigned char* output::buffer [private]

The buffer instance variable is used to remember the base of a dynamically allocated array of characters used to buffer the data, to minimize the number of systems calls required.

Reimplemented in output_cpio_child2, and output_memory.

Definition at line 264 of file output.h.

size_t output::buffer_size [private]

The buffer_size instance variable is used to remember the number of characters allocated in the buffer array.

Definition at line 270 of file output.h.

unsigned char* output::buffer_position [private]

The buffer_position instance variable is used to remember the current output position withing the output buffer.

Definition at line 276 of file output.h.

unsigned char* output::buffer_end [private]

The buffer_end instance variable is used to remember the end of the dynamically allocated buffer array.

Definition at line 282 of file output.h.


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

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