VMime
file Class Referenceabstract
Inheritance diagram for file:
Collaboration diagram for file:

Public Types

typedef utility::path path
 
typedef unsigned long length_type
 

Public Member Functions

virtual ~file ()
 
virtual void createFile ()=0
 
virtual void createDirectory (const bool createAll=false)=0
 
virtual bool isFile () const =0
 
virtual bool isDirectory () const =0
 
virtual bool canRead () const =0
 
virtual bool canWrite () const =0
 
virtual length_type getLength ()=0
 
virtual const pathgetFullPath () const =0
 
virtual bool exists () const =0
 
virtual shared_ptr< filegetParent () const =0
 
virtual void rename (const path &newName)=0
 
virtual void remove ()=0
 
virtual shared_ptr< fileWritergetFileWriter ()=0
 
virtual shared_ptr< fileReadergetFileReader ()=0
 
virtual shared_ptr< fileIteratorgetFiles () const =0
 

Protected Member Functions

 file ()
 
- Protected Member Functions inherited from object
 object ()
 
 object (const object &)
 
objectoperator= (const object &)
 
virtual ~object ()
 

Detailed Description

Abstract representation of a file or directory.

Member Typedef Documentation

typedef unsigned long length_type

Constructor & Destructor Documentation

virtual ~file ( )
virtual
file ( )
protected

Member Function Documentation

virtual bool canRead ( ) const
pure virtual

Test whether this file is readible.

Returns
true if we can read this file, false otherwise
virtual bool canWrite ( ) const
pure virtual

Test whether this file is writeable.

Returns
true if we can write to this file, false otherwise
virtual void createDirectory ( const bool  createAll = false)
pure virtual

Create the directory pointed by this file object.

Parameters
createAllif set to true, recursively create all parent directories if they do not exist
Exceptions
exceptions::filesystem_exceptionif an error occurs
virtual void createFile ( )
pure virtual

Create the file pointed by this file object.

Exceptions
exceptions::filesystem_exceptionif an error occurs
virtual bool exists ( ) const
pure virtual

Test whether this file/directory exists.

Returns
true if the file exists, false otherwise
virtual shared_ptr<fileReader> getFileReader ( )
pure virtual

Return an object capable of reading from this file.

Returns
file reader object
virtual shared_ptr<fileIterator> getFiles ( ) const
pure virtual

Enumerate files contained in this directory.

Returns
file iterator to enumerate files
Exceptions
exceptions::not_a_directoryif this is not a directory, exceptions::filesystem_exception if another error occurs
virtual shared_ptr<fileWriter> getFileWriter ( )
pure virtual

Return an object capable of writing to this file.

Returns
file writer object
virtual const path& getFullPath ( ) const
pure virtual

Return the full path of this file/directory.

Returns
full path of the file

Referenced by courierMaildirFormat::isSubfolderDirectory(), and kmailMaildirFormat::isSubfolderDirectory().

virtual length_type getLength ( )
pure virtual

Return the length of this file.

Returns
file size (in bytes)
virtual shared_ptr<file> getParent ( ) const
pure virtual

Return the parent directory of this file/directory.

Returns
parent directory (or NULL if root)
virtual bool isDirectory ( ) const
pure virtual

Test whether this is a directory.

Returns
true if this is a directory, false otherwise

Referenced by courierMaildirFormat::isSubfolderDirectory(), and kmailMaildirFormat::isSubfolderDirectory().

virtual bool isFile ( ) const
pure virtual

Test whether this is a file.

Returns
true if this is a file, false otherwise
virtual void remove ( )
pure virtual

Deletes this file/directory.

If this is a directory, it must be empty.

Exceptions
exceptions::filesystem_exceptionif an error occurs
virtual void rename ( const path newName)
pure virtual

Rename the file/directory.

Parameters
newNamefull path of the new file
Exceptions
exceptions::filesystem_exceptionif an error occurs

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