Aegis  4.25.D505
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
output_file Class Reference

#include <file.h>

Inheritance diagram for output_file:
output

Public Member Functions

virtual ~output_file ()

Static Public Member Functions

static output::pointer open (const nstring &fn, bool binary=false)
static output::pointer text_open (string_ty *fn)
static output::pointer text_open (const nstring &fn)
static output::pointer binary_open (string_ty *fn)
static output::pointer binary_open (const nstring &fn)
static output::pointer compressed_text_open (const nstring &filename)

Protected Member Functions

nstring filename (void) const
nstring type_name (void) const
long ftell_inner (void) const
void write_inner (const void *data, size_t length)
void end_of_line_inner (void)
int page_width (void) const
int page_length (void) const

Private Member Functions

 output_file (const nstring &file_name, bool binary=false)
 output_file ()
 output_file (const output_file &)
output_fileoperator= (const output_file &)

Private Attributes

nstring file_name
int fd
bool bol
size_t pos

Detailed Description

The output_file class is used to represent the state of an output stream to a regular file.

Definition at line 31 of file file.h.


Constructor & Destructor Documentation

virtual output_file::~output_file ( ) [virtual]

The destructor.

output_file::output_file ( const nstring file_name,
bool  binary = false 
) [private]

The constructor. It is private on purpose, use one of the open class methods instead.

Parameters:
file_nameThe name of the file to be opened for output. (Make absolutely sure it is not NULL or empty.)
binaryWhether the file is binary (true) or text (false).
output_file::output_file ( ) [private]

The default constructor. Do not use.

output_file::output_file ( const output_file ) [private]

The copy constructor. Do not use.


Member Function Documentation

static output::pointer output_file::binary_open ( string_ty fn) [inline, static]

The binary_open class method is used to open a binary output file.

Parameters:
fnThe path name of the file to be opened. If the poijnter is NULL or the string is empty, the standard output is used.

Definition at line 99 of file file.h.

static output::pointer output_file::binary_open ( const nstring fn) [inline, static]

The binary_open class method is used to open a binary output file.

Parameters:
fnThe path name of the file to be opened. If the poijnter is NULL or the string is empty, the standard output is used.

Definition at line 112 of file file.h.

static output::pointer output_file::compressed_text_open ( const nstring filename) [static]

The compressed_text_open class method is used to openb a file, for example a report output, while taking into the file's extension to determine whether or not to also compress the output.

If the file name is ampty or "-" the standard output will be used.

If the fil ename ends with ".gz" (case insensitive) the output will be gzipped. If the file ends with ".bz" or ".bz2" the output will be bzip2ed.

Parameters:
filenameThe name of the file
Returns:
pointer to a new output instance
void output_file::end_of_line_inner ( void  ) [protected, 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.

Implements output.

nstring output_file::filename ( void  ) const [protected, virtual]

The filename method is used to obtain the filename of this output.

Implements output.

long output_file::ftell_inner ( void  ) const [protected, virtual]

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

Implements output.

static output::pointer output_file::open ( const nstring fn,
bool  binary = false 
) [static]

The open class method is used to open an output file.

Parameters:
fnThe path name of the file to be opened. If the poijnter is NULL or the string is empty, the standard output is used.
binaryWherther or not the file is binary. Defaults to false (i.e. text).
output_file& output_file::operator= ( const output_file ) [private]

The assignment operator. Do not use.

int output_file::page_length ( void  ) const [protected, virtual]

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

Reimplemented from output.

int output_file::page_width ( void  ) const [protected, virtual]

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

Reimplemented from output.

static output::pointer output_file::text_open ( string_ty fn) [inline, static]

The text_open class method is used to open a text output file.

Parameters:
fnThe path name of the file to be opened. If the poijnter is NULL or the string is empty, the standard output is used.

Definition at line 73 of file file.h.

static output::pointer output_file::text_open ( const nstring fn) [inline, static]

The text_open class method is used to open a text output file.

Parameters:
fnThe path name of the file to be opened. If the poijnter is NULL or the string is empty, the standard output is used.

Definition at line 86 of file file.h.

nstring output_file::type_name ( void  ) const [protected, virtual]

The type_name method is used to determine the name of this output device or file or type.

Implements output.

void output_file::write_inner ( const void *  data,
size_t  length 
) [protected, virtual]

The write_inner method is used write data to the output, without taking the buffering into account.

Implements output.


Field Documentation

bool output_file::bol [private]

The bol instance variable is used to remember whether or not we are at the start of a line.

Definition at line 175 of file file.h.

int output_file::fd [private]

The fd instance variable is used to remember the number of the file descriptor opened for writing.

Definition at line 169 of file file.h.

The file_name instance variable is used to remember the name of the file opened for writing.

Definition at line 163 of file file.h.

size_t output_file::pos [private]

The pos instance variable is used to remember the current position in the output file.

Definition at line 181 of file file.h.


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