1 /****************************************************************************
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtCore module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef QFSFILEENGINE_P_H
43 #define QFSFILEENGINE_P_H
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.
56 #include "qplatformdefs.h"
57 #include "QtCore/qfsfileengine.h"
58 #include "private/qabstractfileengine_p.h"
61 #ifndef QT_NO_FSFILEENGINE
65 #if defined(Q_OS_WINCE_STD) && _WIN32_WCE < 0x600
66 #define Q_USE_DEPRECATED_MAP_API 1
69 class QFSFileEnginePrivate
: public QAbstractFileEnginePrivate
71 Q_DECLARE_PUBLIC(QFSFileEngine
)
75 static QString
longFileName(const QString
&path
);
77 static QString
canonicalized(const QString
&path
);
80 QByteArray nativeFilePath
;
81 QIODevice::OpenMode openMode
;
83 void nativeInitFileName();
84 bool nativeOpen(QIODevice::OpenMode openMode
);
85 bool openFh(QIODevice::OpenMode flags
, FILE *fh
);
86 bool openFd(QIODevice::OpenMode flags
, int fd
);
91 qint64
nativeSize() const;
92 qint64
sizeFdFh() const;
93 qint64
nativePos() const;
94 qint64
posFdFh() const;
95 bool nativeSeek(qint64
);
96 bool seekFdFh(qint64
);
97 qint64
nativeRead(char *data
, qint64 maxlen
);
98 qint64
readFdFh(char *data
, qint64 maxlen
);
99 qint64
nativeReadLine(char *data
, qint64 maxlen
);
100 qint64
readLineFdFh(char *data
, qint64 maxlen
);
101 qint64
nativeWrite(const char *data
, qint64 len
);
102 qint64
writeFdFh(const char *data
, qint64 len
);
103 int nativeHandle() const;
104 bool nativeIsSequential() const;
105 bool isSequentialFdFh() const;
107 uchar
*map(qint64 offset
, qint64 size
, QFile::MemoryMapFlags flags
);
108 bool unmap(uchar
*ptr
);
113 QHash
<uchar
*, QPair
<int /*offset*/, HANDLE
/*handle*/> > maps
;
114 mutable int cachedFd
;
115 mutable DWORD fileAttrib
;
117 QHash
<uchar
*, QPair
<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps
;
118 mutable QT_STATBUF st
;
122 #ifdef Q_USE_DEPRECATED_MAP_API
123 void mapHandleClose();
124 HANDLE fileMapHandle
;
133 LastIOCommand lastIOCommand
;
134 bool lastFlushFailed
;
135 bool closeFileHandle
;
137 mutable uint is_sequential
: 2;
138 mutable uint could_stat
: 1;
139 mutable uint tried_stat
: 1;
140 #if !defined(Q_OS_WINCE)
141 mutable uint need_lstat
: 1;
142 mutable uint is_link
: 1;
146 bool isSymlink() const;
148 #if defined(Q_OS_WIN32)
149 int sysOpen(const QString
&, int flags
);
152 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
153 static void resolveLibs();
154 static bool resolveUNCLibs();
155 static bool uncListSharesOnServer(const QString
&server
, QStringList
*list
);
159 QFSFileEnginePrivate();
163 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
164 QAbstractFileEngine::FileFlags
getPermissions() const;
170 #endif // QT_NO_FSFILEENGINE
172 #endif // QFSFILEENGINE_P_H