cppfs  1.2.0.5b71c2c98fb9
Cross-platform C++ file system library supporting multiple backends (Local-FS, SSH)
Public Member Functions | List of all members
cppfs::AbstractFileHandleBackend Class Referenceabstract

Interface for file handles. More...

#include <cppfs/include/cppfs/AbstractFileHandleBackend.h>

Inheritance diagram for cppfs::AbstractFileHandleBackend:
Inheritance graph
[legend]

Public Member Functions

 AbstractFileHandleBackend ()
 Constructor. More...
 
virtual ~AbstractFileHandleBackend ()
 Destructor. More...
 
virtual std::unique_ptr< AbstractFileHandleBackendclone () const =0
 Create a copy of this handle. More...
 
virtual AbstractFileSystemfs () const =0
 Get file system. More...
 
virtual void updateFileInfo ()=0
 Update file information. More...
 
virtual std::string path () const =0
 Get path. More...
 
virtual bool exists () const =0
 Check if file or directory exists. More...
 
virtual bool isFile () const =0
 Check if item is a file. More...
 
virtual bool isDirectory () const =0
 Check if item is a directory. More...
 
virtual bool isSymbolicLink () const =0
 Check if item is a symbolic link. More...
 
virtual std::vector< std::string > listFiles () const =0
 List files in directory. More...
 
virtual std::unique_ptr< AbstractFileIteratorBackendbegin () const =0
 Get iterator that points to the first directory entry. More...
 
virtual unsigned int size () const =0
 Get file size. More...
 
virtual unsigned int accessTime () const =0
 Get time of last access. More...
 
virtual unsigned int modificationTime () const =0
 Get time of last modification. More...
 
virtual unsigned int userId () const =0
 Get ID of owning user. More...
 
virtual void setUserId (unsigned int uid)=0
 Set owning user. More...
 
virtual unsigned int groupId () const =0
 Get ID of owning group. More...
 
virtual void setGroupId (unsigned int gid)=0
 Set owning group. More...
 
virtual unsigned long permissions () const =0
 Get file permissions. More...
 
virtual void setPermissions (unsigned long permissions)=0
 Set file permissions. More...
 
virtual bool createDirectory ()=0
 Create directory. More...
 
virtual bool removeDirectory ()=0
 Remove directory. More...
 
virtual bool copy (AbstractFileHandleBackend &dest)=0
 Copy file. More...
 
virtual bool move (AbstractFileHandleBackend &dest)=0
 Move file. More...
 
virtual bool createLink (AbstractFileHandleBackend &dest)=0
 Create hard link. More...
 
virtual bool createSymbolicLink (AbstractFileHandleBackend &dest)=0
 Create symbolic link. More...
 
virtual bool rename (const std::string &filename)=0
 Rename file or directory. More...
 
virtual bool remove ()=0
 Remove file. More...
 
virtual std::unique_ptr< std::istream > createInputStream (std::ios_base::openmode mode) const =0
 Create input stream to read from the file. More...
 
virtual std::unique_ptr< std::ostream > createOutputStream (std::ios_base::openmode mode)=0
 Create output stream to write to the file. More...
 

Detailed Description

Interface for file handles.

Constructor & Destructor Documentation

cppfs::AbstractFileHandleBackend::AbstractFileHandleBackend ( )

Constructor.

virtual cppfs::AbstractFileHandleBackend::~AbstractFileHandleBackend ( )
virtual

Destructor.

Member Function Documentation

virtual std::unique_ptr<AbstractFileHandleBackend> cppfs::AbstractFileHandleBackend::clone ( ) const
pure virtual

Create a copy of this handle.

Returns
File handle

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual AbstractFileSystem* cppfs::AbstractFileHandleBackend::fs ( ) const
pure virtual

Get file system.

Returns
File system (must NOT be null)

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual void cppfs::AbstractFileHandleBackend::updateFileInfo ( )
pure virtual

Update file information.

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual std::string cppfs::AbstractFileHandleBackend::path ( ) const
pure virtual

Get path.

Returns
Path to file or directory

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::exists ( ) const
pure virtual

Check if file or directory exists.

Returns
'true' if it exists, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::isFile ( ) const
pure virtual

Check if item is a file.

Returns
'true' if it is a file, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::isDirectory ( ) const
pure virtual

Check if item is a directory.

Returns
'true' if it is a directory, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::isSymbolicLink ( ) const
pure virtual

Check if item is a symbolic link.

Returns
'true' if it is a symbolic link, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual std::vector<std::string> cppfs::AbstractFileHandleBackend::listFiles ( ) const
pure virtual

List files in directory.

Returns
List of files, empty list if this is not a valid directory

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual std::unique_ptr<AbstractFileIteratorBackend> cppfs::AbstractFileHandleBackend::begin ( ) const
pure virtual

Get iterator that points to the first directory entry.

Returns
Iterator backend, must NOT be null

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual unsigned int cppfs::AbstractFileHandleBackend::size ( ) const
pure virtual

Get file size.

Returns
Size if handle points to a file, else 0

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual unsigned int cppfs::AbstractFileHandleBackend::accessTime ( ) const
pure virtual

Get time of last access.

Returns
Time stamp

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual unsigned int cppfs::AbstractFileHandleBackend::modificationTime ( ) const
pure virtual

Get time of last modification.

Returns
Time stamp

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual unsigned int cppfs::AbstractFileHandleBackend::userId ( ) const
pure virtual

Get ID of owning user.

Returns
User ID

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual void cppfs::AbstractFileHandleBackend::setUserId ( unsigned int  uid)
pure virtual

Set owning user.

Parameters
[in]uidUser ID

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual unsigned int cppfs::AbstractFileHandleBackend::groupId ( ) const
pure virtual

Get ID of owning group.

Returns
Group ID

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual void cppfs::AbstractFileHandleBackend::setGroupId ( unsigned int  gid)
pure virtual

Set owning group.

Parameters
[in]gidGroup ID

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual unsigned long cppfs::AbstractFileHandleBackend::permissions ( ) const
pure virtual

Get file permissions.

Returns
File permissions

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual void cppfs::AbstractFileHandleBackend::setPermissions ( unsigned long  permissions)
pure virtual

Set file permissions.

Parameters
[in]permissionsFile permissions

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::createDirectory ( )
pure virtual

Create directory.

Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::removeDirectory ( )
pure virtual

Remove directory.

Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::copy ( AbstractFileHandleBackend dest)
pure virtual

Copy file.

Parameters
[in]destDestination file or directory (must be of the same type as this file handle)
Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::move ( AbstractFileHandleBackend dest)
pure virtual

Move file.

Parameters
[in]destDestination file or directory (must be of the same type as this file handle)
Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::createLink ( AbstractFileHandleBackend dest)
pure virtual

Create hard link.

Parameters
[in]destDestination file or directory (must be of the same type as this file handle)
Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::createSymbolicLink ( AbstractFileHandleBackend dest)
pure virtual

Create symbolic link.

Parameters
[in]destDestination file or directory (must be of the same type as this file handle)
Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::rename ( const std::string &  filename)
pure virtual

Rename file or directory.

Parameters
[in]filenameFile name
Returns
'true' if successful, else 'false'

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual bool cppfs::AbstractFileHandleBackend::remove ( )
pure virtual

Remove file.

Returns
'true' if successful, else 'false'
Remarks
Does only work if the handle points to a valid file, not a directory.

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual std::unique_ptr<std::istream> cppfs::AbstractFileHandleBackend::createInputStream ( std::ios_base::openmode  mode) const
pure virtual

Create input stream to read from the file.

Parameters
[in]modeOpening mode flags
Returns
Input stream, null on error
Remarks
The created stream object has to be destroyed be the caller.

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.

virtual std::unique_ptr<std::ostream> cppfs::AbstractFileHandleBackend::createOutputStream ( std::ios_base::openmode  mode)
pure virtual

Create output stream to write to the file.

Parameters
[in]modeOpening mode flags
Returns
Output stream, null on error
Remarks
The created stream object has to be destroyed be the caller.

Implemented in cppfs::LocalFileHandle, cppfs::SshFileHandle, and cppfs::LocalFileHandle.


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