#include <output.h>

Public Types | |
| typedef boost::shared_ptr < output > | pointer |
Public Member Functions | |
| virtual | ~output () |
| void | putch (char c) |
| void | putch (signed char c) |
| void | putch (unsigned char c) |
| void | puts (const char *s) |
| void | puts (const rcstring &s) |
| void | write (const void *data, size_t nbytes) |
| void | flush () |
| void | printf (const char *fmt,...) |
| virtual bool | start_of_line () const |
| void | put (input::pointer from) |
| virtual rcstring | name ()=0 |
| void | put_long_le (unsigned long x) |
| void | spaces (int n) |
Protected Member Functions | |
| output () | |
| virtual void | write_inner (const void *data, size_t nbytes)=0 |
| virtual size_t | get_block_size () |
| virtual bool | start_of_line_inner () const =0 |
| virtual void | fatal_error (const char *fmt,...) |
| virtual void | fatal_error_v (const char *fmt, va_list args) |
| virtual void | fatal_error_with_errno (const char *fmt,...) |
| virtual void | fatal_error_with_errno_v (const char *fmt, va_list args) |
Private Member Functions | |
| void | overflow (unsigned char c) |
| output (const output &) | |
| output & | operator= (const output &) |
Private Attributes | |
| unsigned char * | buffer |
| size_t | position |
| size_t | maximum |
Definition at line 34 of file output.h.
| typedef boost::shared_ptr<output> output::pointer |
| virtual output::~output | ( | ) | [virtual] |
The destructor.
| output::output | ( | ) | [protected] |
The default constructor.
| output::output | ( | const output & | ) | [private] |
The copy constructor. Do not use.
| void output::putch | ( | char | c | ) | [inline] |
| void output::putch | ( | signed char | c | ) | [inline] |
| void output::putch | ( | unsigned char | c | ) | [inline] |
The putch method is ised to write a character to the output.
| c | The character to write. |
Definition at line 78 of file output.h.
References buffer, maximum, overflow(), and position.
| void output::puts | ( | const char * | s | ) |
The puts method is used to write a NUL-terminated string to the output.
| void output::puts | ( | const rcstring & | s | ) |
The puts method is used to write a reference counted string to the output.
| void output::write | ( | const void * | data, | |
| size_t | nbytes | |||
| ) |
The write method is used to write arbitrary data to the output.
| data | The data to write. | |
| nbytes | The home much data to write. |
| void output::flush | ( | ) |
The flush method is used to ensure that all the buffered data has been written to the actual output.
Referenced by output_string::clear(), and output_string::mkstr().
| void output::printf | ( | const char * | fmt, | |
| ... | ||||
| ) |
The printf method is used to print formatted text to the output strteam. See printf(3) for more information about the arguments.
| fmt | The format string which describes the following arguments, and how to format them. |
| virtual bool output::start_of_line | ( | ) | const [virtual] |
The start_of_line method may be used to determine whether the output is currently positioned at the start of a line. This can be useful when trying to determine of a Unix text file needs to have its terminating newline appended.
| void output::put | ( | input::pointer | from | ) |
| virtual rcstring output::name | ( | ) | [pure virtual] |
The name method may be used to obtain the name of the output file being written.
Implemented in output_file, output_gzip, output_null, output_stdout, and output_string.
| void output::put_long_le | ( | unsigned long | x | ) |
| void output::spaces | ( | int | n | ) |
The spaces method is used to emit the given number of space characters into the output.
| virtual void output::write_inner | ( | const void * | data, | |
| size_t | nbytes | |||
| ) | [protected, pure virtual] |
The write inner method is used to write the buffered data out to the underlying implemnattion. This method must be supplied by each derived class.
| data | The data to write. | |
| nbytes | The home much data to write. |
Implemented in output_file, output_gzip, output_null, output_stdout, and output_string.
| virtual size_t output::get_block_size | ( | ) | [protected, virtual] |
The get_buffer_size method is used to obtain the preferred buffer size of output. This is not called from the base class destructor, but is deferred until the first data is written to the output.
This defaults to 1024, which isn't too bad for sockets, but is not ideal for files.
Reimplemented in output_file.
| virtual bool output::start_of_line_inner | ( | ) | const [protected, pure virtual] |
The start_of_line_inner method is called by the start_of_line method in the rare cases where it cannot determine the output state for itself.
Implemented in output_file, output_gzip, output_null, output_stdout, and output_string.
| virtual void output::fatal_error | ( | const char * | fmt, | |
| ... | ||||
| ) | [protected, virtual] |
The fatal_error method is used to report fatal errors. The `fmt' string is in the same style a standard C printf function. It calls the fatal_error_v method. This method does not return.
| fmt | The format string which describes the following arguments, and how to format them. |
| virtual void output::fatal_error_v | ( | const char * | fmt, | |
| va_list | args | |||
| ) | [protected, virtual] |
The fatal_error_v method is used to report fatal errors. The `fmt' string is in the same style a standard C vprintf function. It calls the message_v and exit methods. This method does not return.
| fmt | The format string which describes the following arguments, and how to format them. | |
| args | Variable argument lsit, controlled by the fmt argument. |
| virtual void output::fatal_error_with_errno | ( | const char * | fmt, | |
| ... | ||||
| ) | [protected, virtual] |
The fatal_error_errno method is used to report fatal errors, and append the string equivalent of errno. The `fmt' string is in the same style a standard C printf function. It calls the fatal_error_errno_v method. This method does not return.
| fmt | The format string which describes the following arguments, and how to format them. |
| virtual void output::fatal_error_with_errno_v | ( | const char * | fmt, | |
| va_list | args | |||
| ) | [protected, virtual] |
The fatal_error_errno_v method is used to report fatal errors. The `fmt' string is in the same style a standard C vprintf function. It calls the message_v and exit methods. This method does not return.
| fmt | The format string which describes the following arguments, and how to format them. | |
| args | Variable argument lsit, controlled by the fmt argument. |
| void output::overflow | ( | unsigned char | c | ) | [private] |
unsigned char* output::buffer [private] |
size_t output::position [private] |
size_t output::maximum [private] |
1.5.3