Aegis  4.25.D505
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
output Class Reference

#include <output.h>

Inheritance diagram for output:
output_bit_bucket output_cpio output_cpio_child output_cpio_child2 output_file output_filter output_memory output_pager output_stdout output_tar output_tar_child output_tee output_to_wide

Public Types

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

Public Member Functions

virtual ~output ()
virtual nstring filename (void) const =0
long ftell (void) const
void write (const void *data, size_t nbytes)
void flush (void)
virtual int page_width (void) const
virtual int page_length (void) const
void end_of_line (void)
virtual nstring type_name (void) 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 (void) const =0
virtual void write_inner (const void *data, size_t length)=0
virtual void end_of_line_inner (void)=0
virtual void flush_inner (void)
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 37 of file output.h.


Member Typedef Documentation

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

Definition at line 46 of file output.h.

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

Reimplemented in output_filter_wrap_simple, output_filter_wrap_make, and output_filter_set_width.

Definition at line 44 of file output.h.


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

void output::end_of_line ( void  )

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

virtual void output::end_of_line_inner ( void  ) [private, pure virtual]
virtual nstring output::filename ( void  ) const [pure virtual]
void output::flush ( void  )

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

virtual void output::flush_inner ( void  ) [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_tee, output_to_wide, and output_filter.

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

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

Parameters:
fmtThis 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::fputc ( char  c) [inline]

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

Definition at line 112 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:
strThe string to be written out.
void output::fputs ( string_ty str)

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

Parameters:
strThe string to be written out.
void output::fputs ( const nstring str)

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

Parameters:
strThe 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:
strThe string to be written out.
paragraphsIf true, insert

for two newlines and
for single newlines; if false, simply pass newlines through.

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:
strThe string to be written out.
paragraphsIf true, insert

for two newlines and
for single newlines; if false, simply pass newlines through.

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:
strThe string to be written out.
paragraphsIf true, insert

for two newlines and
for single newlines; if false, simply pass newlines through.

long output::ftell ( void  ) const

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

virtual long output::ftell_inner ( void  ) const [private, pure virtual]
output& output::operator= ( const output ) [private]

The assignment operator. Do not use.

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.

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

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

Reimplemented in output_file, output_to_wide, output_tee, output_bit_bucket, output_stdout, output_filter_uuencode, and output_filter.

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

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

Reimplemented in output_file, output_to_wide, output_tee, output_bit_bucket, output_stdout, output_filter_uuencode, output_filter_quoted_printable, output_filter_prefix, output_filter, and output_filter_set_width.

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

virtual nstring output::type_name ( void  ) const [pure virtual]

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

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::write ( const void *  data,
size_t  nbytes 
)

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

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

Field Documentation

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 262 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 280 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 274 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 268 of file output.h.

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

Definition at line 255 of file output.h.


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