conexus logo

Conexus::NSPR::File Class Reference
[Conexus I/O Endpoints with NSPR supportConexus I/O Endpoints]

Encapsulates a NSPR file. More...

#include <file.h>

Inheritance diagram for Conexus::NSPR::File:

Inheritance graph
[legend]

List of all members.

Public Types

typedef ConexusPointer< Filepointer

Public Member Functions

 CONEXUS_ENDPOINT_GENERIC_CREATE ()
virtual ~File ()
virtual void open (const std::string name, long unsigned mode=FILE_UNCHANGED) throw ( open_exception )
 Opens the named file in the specified mode.
virtual void open () throw ( open_exception )
 Will attempt to open the file if a filename has been specified.
std::string filename ()
 Will return the filename.
long unsigned mode ()
bool eof ()
bool throw_eof ()
void set_throw_eof (bool teof=true)
bool is_file () const
bool is_directory () const
bool is_other_file_type () const
size_t size () const
void set_filename (std::string d, long unsigned mode=FILE_UNCHANGED) throw ( open_exception )
 Sets the filename.
sigc::signal< void > signal_filename_changed ()

Static Public Member Functions

static File::pointer create (const std::string &filename=std::string(), long unsigned mode=0)

Protected Member Functions

 File (const std::string &filename, long unsigned mode)
virtual Data read_data (long int timeout, size_t s=0) throw ( read_exception )
 Reimplements Endpoint::read_data() using FileDescriptor::read_data() to catch the exception where data read size is zero indicating EOF.

Protected Attributes

std::string m_filename
long unsigned m_mode
bool m_eof
bool m_throw_eof
sigc::signal< void > m_signal_filename_changed


Detailed Description

Encapsulates a NSPR file.

TODO review NSPR documentation for completeness TODO add support for PR_GetFileInfo

Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>

Member Typedef Documentation

typedef ConexusPointer<File> Conexus::NSPR::File::pointer

Reimplemented from Conexus::NSPR::FileDescriptor.


Constructor & Destructor Documentation

Conexus::NSPR::File::File ( const std::string &  filename,
long unsigned  mode 
) [protected]

Conexus::NSPR::File::~File (  )  [virtual]


Member Function Documentation

Conexus::NSPR::File::CONEXUS_ENDPOINT_GENERIC_CREATE (  ) 

File::pointer Conexus::NSPR::File::create ( const std::string &  filename = std::string(),
long unsigned  mode = 0 
) [static]

bool Conexus::NSPR::File::eof (  ) 

References m_eof.

std::string Conexus::NSPR::File::filename (  ) 

Will return the filename.

References m_filename.

bool Conexus::NSPR::File::is_directory (  )  const

References m_filename.

bool Conexus::NSPR::File::is_file (  )  const

References m_filename.

bool Conexus::NSPR::File::is_other_file_type (  )  const

References m_filename.

long unsigned Conexus::NSPR::File::mode (  ) 

References m_mode.

void Conexus::NSPR::File::open (  )  throw ( open_exception ) [virtual]

Will attempt to open the file if a filename has been specified.

Otherwise an exception will be thrown.

Implements Conexus::Endpoint.

References m_filename.

void Conexus::NSPR::File::open ( const std::string  name,
long unsigned  mode = FILE_UNCHANGED 
) throw ( open_exception ) [virtual]

Data Conexus::NSPR::File::read_data ( long int  timeout,
size_t  s = 0 
) throw ( read_exception ) [protected, virtual]

Reimplements Endpoint::read_data() using FileDescriptor::read_data() to catch the exception where data read size is zero indicating EOF.

When encountered throws eof exception.

Exceptions:
Conexus::exception::read::eof When file EOF is encounter on a zero length read

References Conexus::NSPR::FileDescriptor::read_data().

void Conexus::NSPR::File::set_filename ( std::string  d,
long unsigned  mode = FILE_UNCHANGED 
) throw ( open_exception )

Sets the filename.

If the file is currently open and d is not equal to the current filename, the current file will be closed.

Also, if auto_open is set, the new file will be immediately opened.

Additionally, this method checks whether the parameter d is the same as the current filename, and parameter mode is the same as the current mode. If both are equal, the file will not be closed and reopened unless force=true.

References Conexus::FILE_UNCHANGED.

Referenced by File().

void Conexus::NSPR::File::set_throw_eof ( bool  teof = true  ) 

References m_throw_eof.

sigc::signal< void > Conexus::NSPR::File::signal_filename_changed (  ) 

size_t Conexus::NSPR::File::size (  )  const

References m_filename.

bool Conexus::NSPR::File::throw_eof (  ) 

References m_throw_eof.


Member Data Documentation

bool Conexus::NSPR::File::m_eof [protected]

Referenced by eof().

std::string Conexus::NSPR::File::m_filename [protected]

long unsigned Conexus::NSPR::File::m_mode [protected]

Referenced by mode().

sigc::signal<void> Conexus::NSPR::File::m_signal_filename_changed [protected]

Referenced by signal_filename_changed().

Referenced by set_throw_eof(), and throw_eof().


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

Generated on Wed Jul 8 15:51:28 2009 for conexus by doxygen 1.5.8