CopperSpice API  2.0.0
QFSFileEngine Class Reference

The QFSFileEngine class implements the default file engine. More...

Inheritance diagram for QFSFileEngine:
QAbstractFileEngine

Public Methods

 QFSFileEngine ()
 
 QFSFileEngine (const QString &file)
 
 ~QFSFileEngine ()
 
QAbstractFileEngineIteratorbeginEntryList (QDir::Filters filters, const QStringList &filterNames) override
 
bool caseSensitive () const override
 
bool close () override
 
bool copy (const QString &newName) override
 
QStringList entryList (QDir::Filters filters, const QStringList &filterNames) const override
 
bool extension (Extension extension, const ExtensionOption *option=nullptr, ExtensionReturn *output=nullptr) override
 
FileFlags fileFlags (FileFlags type) const override
 
QString fileName (FileName file) const override
 
QDateTime fileTime (QFileDevice::FileTimeType type) const override
 
bool flush () override
 
int handle () const override
 
bool isRelativePath () const override
 
bool isSequential () const override
 
bool link (const QString &newName) override
 
bool mkdir (const QString &dirName, bool createParentDirectories) const override
 
bool open (QIODevice::OpenMode openMode) override
 
bool open (QIODevice::OpenMode openMode, FILE *fh)
 
bool open (QIODevice::OpenMode openMode, FILE *fh, QFile::FileHandleFlags handleFlags)
 
bool open (QIODevice::OpenMode openMode, int fd)
 
bool open (QIODevice::OpenMode openMode, int fd, QFile::FileHandleFlags handleFlags)
 
QString owner (FileOwner own) const override
 
uint ownerId (FileOwner own) const override
 
qint64 pos () const override
 
qint64 read (char *data, qint64 maxlen) override
 
qint64 readLine (char *data, qint64 maxlen) override
 
bool remove () override
 
bool rename (const QString &newName) override
 
bool renameOverwrite (const QString &newName) override
 
bool rmdir (const QString &dirName, bool recurseParentDirectories) const override
 
bool seek (qint64 pos) override
 
void setFileName (const QString &file) override
 
bool setFileTime (const QDateTime &newTime, QFileDevice::FileTimeType type) override
 
bool setPermissions (uint perms) override
 
bool setSize (qint64 size) override
 
qint64 size () const override
 
bool supportsExtension (Extension extension) const override
 
bool syncToDisk () override
 
qint64 write (const char *data, qint64 len) override
 
- Public Methods inherited from QAbstractFileEngine
virtual ~QAbstractFileEngine ()
 
bool atEnd () const
 
QFile::FileError error () const
 
QString errorString () const
 
virtual bool extension (Extension extension, const ExtensionOption *option=nullptr, ExtensionReturn *output=nullptr)
 
ucharmap (qint64 offset, qint64 size, QFile::MemoryMapFlags flags)
 
bool unmap (uchar *address)
 

Static Public Methods

static QString currentPath (const QString &path=QString ())
 
static QFileInfoList drives ()
 
static QString homePath ()
 
static QString rootPath ()
 
static bool setCurrentPath (const QString &path)
 
static QString tempPath ()
 
- Static Public Methods inherited from QAbstractFileEngine
static QAbstractFileEngine * create (const QString &fileName)
 

Additional Inherited Members

- Public Typedefs inherited from QAbstractFileEngine
using FileFlags = QFlags< FileFlag >
 
- Public Types inherited from QAbstractFileEngine
enum  Extension
 
enum  FileFlag
 
enum  FileName
 
enum  FileOwner
 
- Protected Methods inherited from QAbstractFileEngine
 QAbstractFileEngine ()
 
void setError (QFile::FileError error, const QString &errorString)
 

Detailed Description

To create a new file engine inherit from QFSFileEngine. You will also need to create a new class which inherits from QAbstractFileEngineHandler. Most applications which access files and directories can normally use QFile, QFileInfo or QDir. Inheriting from this class is only required to extend functionality.

See also
setCurrentPath()

Constructor & Destructor Documentation

QFSFileEngine::QFSFileEngine ( )

Constructs a new QFSFileEngine.

QFSFileEngine::QFSFileEngine ( const QString file)
explicit

Constructs a new QFSFileEngine for the given file.

QFSFileEngine::~QFSFileEngine ( )

Destroys the QFSFileEngine and frees any allocated resources.

Method Documentation

QAbstractFileEngineIterator * QFSFileEngine::beginEntryList ( QDir::Filters  filters,
const QStringList filterNames 
)
overridevirtual
bool QFSFileEngine::caseSensitive ( ) const
overridevirtual

Returns true for Windows and false for Unix.

Reimplemented from QAbstractFileEngine::caseSensitive()

bool QFSFileEngine::close ( )
overridevirtual

Reimplemented from QAbstractFileEngine::close()

bool QFSFileEngine::copy ( const QString newName)
overridevirtual

For Windows, copies the QFSFileEngine file to newName. This method is not implemented for Unix.

Reimplemented from QAbstractFileEngine::copy()

QString QFSFileEngine::currentPath ( const QString path = QString())
static

For Windows, returns the canonicalized form of the current path used by the file engine for the drive path. Each drive has its own current directory so a different path is returned for file names which are on different drives.

For Unix, returns the current working directory for this file engine.

See also
setCurrentPath()
QFileInfoList QFSFileEngine::drives ( )
static

For Windows, returns a list of all drive letters in the file system. For Unix, the list contains the root path "/".

QStringList QFSFileEngine::entryList ( QDir::Filters  filters,
const QStringList filterNames 
) const
overridevirtual
bool QFSFileEngine::extension ( Extension  extension,
const ExtensionOption *  option = nullptr,
ExtensionReturn *  output = nullptr 
)
override
FileFlags QFSFileEngine::fileFlags ( FileFlags  type) const
overridevirtual
QString QFSFileEngine::fileName ( FileName  file) const
overridevirtual

Reimplemented from QAbstractFileEngine::fileName()

QDateTime QFSFileEngine::fileTime ( QFileDevice::FileTimeType  type) const
overridevirtual

Reimplemented from QAbstractFileEngine::fileTime()

bool QFSFileEngine::flush ( )
overridevirtual

Reimplemented from QAbstractFileEngine::flush()

int QFSFileEngine::handle ( ) const
overridevirtual

Reimplemented from QAbstractFileEngine::handle()

QString QFSFileEngine::homePath ( )
static

Returns the home path for the current user.

See also
rootPath()
bool QFSFileEngine::isRelativePath ( ) const
overridevirtual
bool QFSFileEngine::isSequential ( ) const
overridevirtual
bool QFSFileEngine::link ( const QString newName)
overridevirtual

Reimplemented from QAbstractFileEngine::link()

bool QFSFileEngine::mkdir ( const QString dirName,
bool  createParentDirectories 
) const
overridevirtual

Reimplemented from QAbstractFileEngine::mkdir()

bool QFSFileEngine::open ( QIODevice::OpenMode  openMode)
overridevirtual

Reimplemented from QAbstractFileEngine::open()

bool QFSFileEngine::open ( QIODevice::OpenMode  openMode,
FILE *  fh 
)

Opens the file handle fh using the given openMode. Returns true on success, otherwise returns false.

bool QFSFileEngine::open ( QIODevice::OpenMode  openMode,
FILE *  fh,
QFile::FileHandleFlags  handleFlags 
)

Opens the file handle fh using the given openMode. Returns true on success, otherwise returns false. The handleFlags argument specifies whether the file handle will be closed by CopperSpice.

See also
QFile::FileHandleFlags
bool QFSFileEngine::open ( QIODevice::OpenMode  openMode,
int  fd 
)

Opens the file descriptor fd using the given openMode. Returns true on success, otherwise returns false.

bool QFSFileEngine::open ( QIODevice::OpenMode  openMode,
int  fd,
QFile::FileHandleFlags  handleFlags 
)

Opens the file descriptor fd using the given openMode. Returns true on success, otherwise returns false. The handleFlags argument specifies whether the file handle will be closed by CopperSpice.

See also
QFile::FileHandleFlags
QString QFSFileEngine::owner ( FileOwner  own) const
overridevirtual

Reimplemented from QAbstractFileEngine::owner()

uint QFSFileEngine::ownerId ( FileOwner  own) const
overridevirtual

For Windows -2 is always returned.

On Unix systems if calling stat() is successful the uid is returned if the value for own is the owner. Otherwise the gid is returned. If stat() is unsuccessful, -2 is returned.

Reimplemented from QAbstractFileEngine::ownerId()

qint64 QFSFileEngine::pos ( ) const
overridevirtual

Reimplemented from QAbstractFileEngine::pos()

qint64 QFSFileEngine::read ( char *  data,
qint64  maxlen 
)
overridevirtual

Reimplemented from QAbstractFileEngine::read()

qint64 QFSFileEngine::readLine ( char *  data,
qint64  maxlen 
)
overridevirtual

Reimplemented from QAbstractFileEngine::readLine()

bool QFSFileEngine::remove ( )
overridevirtual

Reimplemented from QAbstractFileEngine::remove()

bool QFSFileEngine::rename ( const QString newName)
overridevirtual

Reimplemented from QAbstractFileEngine::rename()

bool QFSFileEngine::renameOverwrite ( const QString newName)
overridevirtual
bool QFSFileEngine::rmdir ( const QString dirName,
bool  recurseParentDirectories 
) const
overridevirtual

Reimplemented from QAbstractFileEngine::rmdir()

QString QFSFileEngine::rootPath ( )
static

Returns the root path.

See also
homePath()
bool QFSFileEngine::seek ( qint64  pos)
overridevirtual

Reimplemented from QAbstractFileEngine::seek()

bool QFSFileEngine::setCurrentPath ( const QString path)
static

Sets the current path to path. Returns true if the new path exists, otherwise this method does nothing and returns false.

See also
currentPath()
void QFSFileEngine::setFileName ( const QString file)
overridevirtual
bool QFSFileEngine::setFileTime ( const QDateTime newTime,
QFileDevice::FileTimeType  type 
)
overridevirtual
bool QFSFileEngine::setPermissions ( uint  perms)
overridevirtual
bool QFSFileEngine::setSize ( qint64  size)
overridevirtual

Reimplemented from QAbstractFileEngine::setSize()

qint64 QFSFileEngine::size ( ) const
overridevirtual

Reimplemented from QAbstractFileEngine::size()

bool QFSFileEngine::supportsExtension ( Extension  extension) const
overridevirtual
bool QFSFileEngine::syncToDisk ( )
overridevirtual
QString QFSFileEngine::tempPath ( )
static

Returns the temporary path. This is a location where it is safe to store temporary files.

qint64 QFSFileEngine::write ( const char *  data,
qint64  len 
)
overridevirtual

Reimplemented from QAbstractFileEngine::write()