Qt 4.8
qfsfileengine.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QFSFILEENGINE_H
43 #define QFSFILEENGINE_H
44 
45 #include <QtCore/qabstractfileengine.h>
46 #ifdef Q_OS_SYMBIAN
47 #include <f32file.h>
48 #endif
49 
50 #ifndef QT_NO_FSFILEENGINE
51 
53 
55 
56 QT_MODULE(Core)
57 
59 
61 {
63 public:
64  QFSFileEngine();
65  explicit QFSFileEngine(const QString &file);
66  ~QFSFileEngine();
67 
68  bool open(QIODevice::OpenMode openMode);
69  bool open(QIODevice::OpenMode flags, FILE *fh);
70  bool close();
71  bool flush();
72  qint64 size() const;
73  qint64 pos() const;
74  bool seek(qint64);
75  bool isSequential() const;
76  bool remove();
77  bool copy(const QString &newName);
78  bool rename(const QString &newName);
79  bool link(const QString &newName);
80  bool mkdir(const QString &dirName, bool createParentDirectories) const;
81  bool rmdir(const QString &dirName, bool recurseParentDirectories) const;
82  bool setSize(qint64 size);
83  bool caseSensitive() const;
84  bool isRelativePath() const;
85  QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const;
86  FileFlags fileFlags(FileFlags type) const;
87  bool setPermissions(uint perms);
88  QString fileName(FileName file) const;
89  uint ownerId(FileOwner) const;
90  QString owner(FileOwner) const;
91  QDateTime fileTime(FileTime time) const;
92  void setFileName(const QString &file);
93  int handle() const;
94 
95 #ifndef QT_NO_FILESYSTEMITERATOR
96  Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames);
98 #endif
99 
100  qint64 read(char *data, qint64 maxlen);
101  qint64 readLine(char *data, qint64 maxlen);
102  qint64 write(const char *data, qint64 len);
103 
104  bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0);
105  bool supportsExtension(Extension extension) const;
106 
107  //FS only!!
108  bool open(QIODevice::OpenMode flags, int fd);
109  bool open(QIODevice::OpenMode flags, int fd, QFile::FileHandleFlags handleFlags);
110  bool open(QIODevice::OpenMode flags, FILE *fh, QFile::FileHandleFlags handleFlags);
111 #ifdef Q_OS_SYMBIAN
112  bool open(QIODevice::OpenMode flags, const RFile &f, QFile::FileHandleFlags handleFlags);
113 #endif
114  static bool setCurrentPath(const QString &path);
115  static QString currentPath(const QString &path = QString());
116  static QString homePath();
117  static QString rootPath();
118  static QString tempPath();
119  static QFileInfoList drives();
120 
121 protected:
123 };
124 
126 
128 
129 #endif // QT_NO_FSFILEENGINE
130 
131 #endif // QFSFILEENGINE_H
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const
This function should return the set of OR&#39;d flags that are true for the file engine&#39;s file...
virtual bool copy(const QString &newName)
Copies the contents of this file to a file with the name newName.
virtual bool open(QIODevice::OpenMode openMode)
Opens the file in the specified mode.
int type
Definition: qmetatype.cpp:239
virtual bool setSize(qint64 size)
Requests that the file be set to size size.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
virtual bool flush()
Flushes the open file, returning true if successful; otherwise returns false.
virtual QString fileName(FileName file=DefaultName) const
Return the file engine&#39;s current file name in the format specified by file.
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
virtual bool setPermissions(uint perms)
Requests that the file&#39;s permissions be set to perms.
virtual bool isRelativePath() const
Return true if the file referred to by this file engine has a relative path; otherwise return false...
virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const
Requests that the directory dirName is deleted from the file system.
virtual QString owner(FileOwner) const
If owner is OwnerUser return the name of the user who owns the file.
virtual uint ownerId(FileOwner) const
If owner is OwnerUser return the ID of the user who owns the file.
virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const
Requests that a list of all the files matching the filters list based on the filterNames in the file ...
virtual bool close()
Closes the file, returning true if successful; otherwise returns false.
FileName
These values are used to request a file name in a particular format.
The QString class provides a Unicode character string.
Definition: qstring.h:83
virtual void setFileName(const QString &file)
Sets the file engine&#39;s file name to file.
provides an extended output argument to QAbstractFileEngine&#39;s extension support.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual bool seek(qint64 pos)
Sets the file position to the given offset.
Extension
This enum describes the types of extensions that the file engine can support.
virtual bool caseSensitive() const
Should return true if the underlying file system is case-sensitive; otherwise return false...
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
provides an extended input argument to QAbstractFileEngine&#39;s extension support.
The QAbstractFileEngine class provides an abstraction for accessing the filesystem.
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
virtual bool supportsExtension(Extension extension) const
This virtual function returns true if the file engine supports extension; otherwise, false is returned.
virtual int handle() const
Returns the native file handle for this file engine.
__int64 qint64
Definition: qglobal.h:942
FileTime
These are used by the fileTime() function.
virtual qint64 write(const char *data, qint64 len)
Writes len bytes from data to the file.
virtual Iterator * beginEntryList(QDir::Filters filters, const QStringList &filterNames)
Returns an instance of a QAbstractFileEngineIterator using filters for entry filtering and filterName...
static const char *const filters[3]
virtual qint64 read(char *data, qint64 maxlen)
Reads a number of characters from the file into data.
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
#define Q_CORE_EXPORT
Definition: qglobal.h:1449
virtual Iterator * endEntryList()
virtual qint64 readLine(char *data, qint64 maxlen)
This function reads one line, terminated by a &#39; &#39; character, from the file info data.
The QAbstractFileEngineIterator class provides an iterator interface for custom file engines...
virtual bool isSequential() const
Returns true if the file is a sequential access device; returns false if the file is a direct access ...
virtual bool extension(Extension extension, const ExtensionOption *option=0, ExtensionReturn *output=0)
This virtual function can be reimplemented in a QAbstractFileEngine subclass to provide support for e...
virtual QDateTime fileTime(FileTime time) const
If time is CreationTime, return when the file was created.
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
virtual bool mkdir(const QString &dirName, bool createParentDirectories) const
Requests that the directory dirName be created.
virtual qint64 pos() const
Returns the current file position.
#define QT_END_HEADER
Definition: qglobal.h:137
virtual qint64 size() const
Returns the size of the file.
virtual bool rename(const QString &newName)
Requests that the file be renamed to newName in the file system.
virtual bool link(const QString &newName)
Creates a link from the file currently specified by fileName() to newName.
The QFSFileEngine class implements Qt&#39;s default file engine.
Definition: qfsfileengine.h:60