Qt 4.8
qfsfileengine_p.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_P_H
43 #define QFSFILEENGINE_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "qplatformdefs.h"
57 #include "QtCore/qfsfileengine.h"
58 #include "private/qabstractfileengine_p.h"
59 #include <QtCore/private/qfilesystementry_p.h>
60 #include <QtCore/private/qfilesystemmetadata_p.h>
61 #include <qhash.h>
62 
63 #ifdef Q_OS_SYMBIAN
64 #include <f32file.h>
65 //This macro will be defined if the OS supports memory mapped files
66 #if defined (SYMBIAN_FILE_MAPPING_SUPPORTED) && !defined (WINS)
67 //simpler define to check in sources
68 #define QT_SYMBIAN_USE_NATIVE_FILEMAP
69 #include <f32filemap.h>
70 #endif
71 #endif
72 
73 #ifndef QT_NO_FSFILEENGINE
74 
76 
77 #if defined(Q_OS_WINCE_STD) && _WIN32_WCE < 0x600
78 #define Q_USE_DEPRECATED_MAP_API 1
79 #endif
80 
82 {
84 
85 public:
86 #ifdef Q_WS_WIN
87  static QString longFileName(const QString &path);
88 #endif
89 
91  QIODevice::OpenMode openMode;
92 
93  bool nativeOpen(QIODevice::OpenMode openMode);
94  bool openFh(QIODevice::OpenMode flags, FILE *fh);
95  bool openFd(QIODevice::OpenMode flags, int fd);
96  bool nativeClose();
97  bool closeFdFh();
98  bool nativeFlush();
99  bool flushFh();
100  qint64 nativeSize() const;
101 #ifndef Q_OS_WIN
102  qint64 sizeFdFh() const;
103 #endif
104  qint64 nativePos() const;
105  qint64 posFdFh() const;
106  bool nativeSeek(qint64);
107  bool seekFdFh(qint64);
108  qint64 nativeRead(char *data, qint64 maxlen);
109  qint64 readFdFh(char *data, qint64 maxlen);
110  qint64 nativeReadLine(char *data, qint64 maxlen);
111  qint64 readLineFdFh(char *data, qint64 maxlen);
112  qint64 nativeWrite(const char *data, qint64 len);
113  qint64 writeFdFh(const char *data, qint64 len);
114  int nativeHandle() const;
115  bool nativeIsSequential() const;
116 #ifndef Q_OS_WIN
117  bool isSequentialFdFh() const;
118 #endif
119 
120  uchar *map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags);
121  bool unmap(uchar *ptr);
122 
124 
125  FILE *fh;
126 #ifdef Q_OS_SYMBIAN
127 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
128  RFile64 symbianFile;
129  TInt64 symbianFilePos;
130 #else
131  RFile symbianFile;
132 
146  TInt symbianFilePos;
147 #endif
148 #ifndef QT_SYMBIAN_USE_NATIVE_FILEMAP
149  mutable int fileHandleForMaps;
150  int getMapHandle();
151 #endif
152 #endif
153 
154 #ifdef Q_WS_WIN
157  QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps;
158 
159 #ifndef Q_OS_WINCE
160  mutable int cachedFd;
161 #endif
162 
163  mutable DWORD fileAttrib;
164 #elif defined (QT_SYMBIAN_USE_NATIVE_FILEMAP)
166 #else
167  QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps;
168 #endif
169  int fd;
170 
172  {
175  IOWriteCommand
176  };
180 
181  mutable uint is_sequential : 2;
182  mutable uint could_stat : 1;
183  mutable uint tried_stat : 1;
184 #if !defined(Q_OS_WINCE)
185  mutable uint need_lstat : 1;
186  mutable uint is_link : 1;
187 #endif
188 
189 #if defined(Q_OS_WIN)
190  bool doStat(QFileSystemMetaData::MetaDataFlags flags) const;
191 #else
192  bool doStat(QFileSystemMetaData::MetaDataFlags flags = QFileSystemMetaData::PosixStatFlags) const;
193 #endif
194  bool isSymlink() const;
195 
196 #if defined(Q_OS_WIN32)
197  int sysOpen(const QString &, int flags);
198 #endif
199 
200 protected:
202 
203  void init();
204 
205  QAbstractFileEngine::FileFlags getPermissions(QAbstractFileEngine::FileFlags type) const;
206 };
207 
209 
210 #endif // QT_NO_FSFILEENGINE
211 
212 #endif // QFSFILEENGINE_P_H
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
LastIOCommand lastIOCommand
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
QIODevice::OpenMode openMode
unsigned char uchar
Definition: qglobal.h:994
QFuture< void > map(Sequence &sequence, MapFunction function)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static bool init
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
QHash< uchar *, DWORD > maps
const T * ptr(const T &t)
__int64 qint64
Definition: qglobal.h:942
void * HANDLE
Definition: qnamespace.h:1671
QFileSystemEntry fileEntry
QFileSystemMetaData metaData
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
MemoryMapFlags
This enum describes special options that may be used by the map() function.
Definition: qfile.h:180
The QFSFileEngine class implements Qt&#39;s default file engine.
Definition: qfsfileengine.h:60