OSB_LIB::FileBase Class Reference

Inheritance diagram for OSB_LIB::FileBase:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::FileBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

Support for FILE*: base class.

This class provides common functionality for the handling of FILE*.

Definition at line 62 of file cdrfile.h.

Public Member Functions

Protected Member Functions

Protected Attributes

Private Member Functions


Constructor & Destructor Documentation

OSB_LIB::FileBase::FileBase (  ) 

Default constructor.

virtual OSB_LIB::FileBase::~FileBase (  )  [virtual]

Destructor: closes file_ if open.

OSB_LIB::FileBase::FileBase ( const FileBase  )  [private]

Prevent copying: not implemented.


Member Function Documentation

virtual int OSB_LIB::FileBase::close (  )  [virtual]

Close the file.

Returns:
0 in case of success or file_ was never opened, else errno.

Reimplemented in OSB_LIB::CdrOutputFile.

const std::string& OSB_LIB::FileBase::dir (  )  const

Directory of file.

bool OSB_LIB::FileBase::eof (  ) 

End of file?

Returns:
false if file_ is not open, else std::feof(file_).

bool OSB_LIB::FileBase::error (  ) 

Error on file?

Returns:
true if file_ is not open, else std::ferror(file_).

FILE* OSB_LIB::FileBase::file (  ) 

Access to the FILE* pointer.

Note:
Use with care and only for operation that are not supported by this class, e.g., rewind(FILE*).

bool OSB_LIB::FileBase::isOpen (  )  const

Input file open?

const std::string& OSB_LIB::FileBase::name (  )  const

Name of file.

int OSB_LIB::FileBase::open ( const std::string &  dir,
const std::string &  name,
const char *  mode 
) [protected]

Open the file.

Parameters:
dir Directory of the file.
name Name of the file.
mode Open mode of the file, see man fopen.
Returns:
0 in case of success, else errno.
Note:
Always set name_ and dir_.

FileBase& OSB_LIB::FileBase::operator= ( const FileBase  )  [private]

Prevent assignment: not implemented.

const std::string OSB_LIB::FileBase::path (  )  const

Path of file.

Returns:
dir()/name(), empty string if the name is empty.

int OSB_LIB::FileBase::remove (  ) 

Remove the file.

Returns:
0 in if the file does no more exist after the function has returned, else errno.
If the function is successful (returns 0) name_ and dir_ are cleared, else left unchanged.

int OSB_LIB::FileBase::rename ( const std::string &  newName  ) 

Rename the file.

Parameters:
newName New name of the output file.
Returns:
0 in case of success,
EEXIST if newName already exists in dir_,
else errno.
Note:
The file remains in the same directory where is was created.


Member Data Documentation

std::string OSB_LIB::FileBase::dir_ [protected]

Directory of the file.

Definition at line 167 of file cdrfile.h.

FILE* OSB_LIB::FileBase::file_ [protected]

The file itself.

Definition at line 163 of file cdrfile.h.

std::string OSB_LIB::FileBase::name_ [protected]

Name of the file.

Definition at line 165 of file cdrfile.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:15:09 2006 for OSB Library by  doxygen 1.4.7