file Class Reference

Abstract representation of a file or directory. More...

Inheritance diagram for file:
Inheritance graph
[legend]
Collaboration diagram for file:
Collaboration graph
[legend]

List of all members.

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 ref< filegetParent () const =0
virtual void rename (const path &newName)=0
virtual void remove ()=0
virtual ref< fileWritergetFileWriter ()=0
virtual ref< fileReadergetFileReader ()=0
virtual ref< fileIteratorgetFiles () const =0

Protected Member Functions

 file ()

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

Implemented in posixFile, and windowsFile.

virtual bool canWrite (  )  const [pure virtual]

Test whether this file is writeable.

Returns:
true if we can write to this file, false otherwise

Implemented in posixFile, and windowsFile.

virtual void createDirectory ( const bool  createAll = false  )  [pure virtual]

Create the directory pointed by this file object.

Parameters:
createAll if set to true, recursively create all parent directories if they do not exist
Exceptions:
exceptions::filesystem_exception if an error occurs

Implemented in posixFile, and windowsFile.

virtual void createFile (  )  [pure virtual]

Create the file pointed by this file object.

Exceptions:
exceptions::filesystem_exception if an error occurs

Implemented in posixFile, and windowsFile.

virtual bool exists (  )  const [pure virtual]

Test whether this file/directory exists.

Returns:
true if the file exists, false otherwise

Implemented in posixFile, and windowsFile.

virtual ref<fileReader> getFileReader (  )  [pure virtual]

Return an object capable of reading from this file.

Returns:
file reader object

Implemented in posixFile, and windowsFile.

virtual ref<fileIterator> getFiles (  )  const [pure virtual]

Enumerate files contained in this directory.

Returns:
file iterator to enumerate files
Exceptions:
exceptions::not_a_directory if this is not a directory, exceptions::filesystem_exception if another error occurs

Implemented in posixFile, and windowsFile.

virtual ref<fileWriter> getFileWriter (  )  [pure virtual]

Return an object capable of writing to this file.

Returns:
file writer object

Implemented in posixFile, and windowsFile.

virtual const path& getFullPath (  )  const [pure virtual]

Return the full path of this file/directory.

Returns:
full path of the file

Implemented in posixFile, and windowsFile.

virtual length_type getLength (  )  [pure virtual]

Return the length of this file.

Returns:
file size (in bytes)

Implemented in posixFile, and windowsFile.

virtual ref<file> getParent (  )  const [pure virtual]

Return the parent directory of this file/directory.

Returns:
parent directory (or NULL if root)

Implemented in posixFile, and windowsFile.

virtual bool isDirectory (  )  const [pure virtual]

Test whether this is a directory.

Returns:
true if this is a directory, false otherwise

Implemented in posixFile, and windowsFile.

virtual bool isFile (  )  const [pure virtual]

Test whether this is a file.

Returns:
true if this is a file, false otherwise

Implemented in posixFile, and windowsFile.

virtual void remove (  )  [pure virtual]

Deletes this file/directory.

If this is a directory, it must be empty.

Exceptions:
exceptions::filesystem_exception if an error occurs

Implemented in posixFile, and windowsFile.

virtual void rename ( const path newName  )  [pure virtual]

Rename the file/directory.

Parameters:
newName full path of the new file
Exceptions:
exceptions::filesystem_exception if an error occurs

Implemented in posixFile, and windowsFile.


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

Generated by  doxygen 1.6.2