-rw-r--r-- | qmake/include/qfile.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/qmake/include/qfile.h b/qmake/include/qfile.h new file mode 100644 index 0000000..14a917b --- a/dev/null +++ b/qmake/include/qfile.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of QFile class | ||
5 | ** | ||
6 | ** Created : 930831 | ||
7 | ** | ||
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | ||
9 | ** | ||
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | ||
11 | ** | ||
12 | ** This file may be distributed under the terms of the Q Public License | ||
13 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
14 | ** LICENSE.QPL included in the packaging of this file. | ||
15 | ** | ||
16 | ** This file may be distributed and/or modified under the terms of the | ||
17 | ** GNU General Public License version 2 as published by the Free Software | ||
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
19 | ** packaging of this file. | ||
20 | ** | ||
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
22 | ** licenses may use this file in accordance with the Qt Commercial License | ||
23 | ** Agreement provided with the Software. | ||
24 | ** | ||
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
27 | ** | ||
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
29 | ** information about Qt Commercial License Agreements. | ||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
32 | ** | ||
33 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
34 | ** not clear to you. | ||
35 | ** | ||
36 | **********************************************************************/ | ||
37 | |||
38 | #ifndef QFILE_H | ||
39 | #define QFILE_H | ||
40 | |||
41 | #ifndef QT_H | ||
42 | #include "qiodevice.h" | ||
43 | #include "qstring.h" | ||
44 | #include <stdio.h> | ||
45 | #endif // QT_H | ||
46 | |||
47 | class QDir; | ||
48 | |||
49 | |||
50 | class Q_EXPORT QFile : public QIODevice // file I/O device class | ||
51 | { | ||
52 | public: | ||
53 | QFile(); | ||
54 | QFile( const QString &name ); | ||
55 | ~QFile(); | ||
56 | |||
57 | QString name()const; | ||
58 | voidsetName( const QString &name ); | ||
59 | |||
60 | typedef QCString (*EncoderFn)( const QString &fileName ); | ||
61 | typedef QString (*DecoderFn)( const QCString &localfileName ); | ||
62 | static QCString encodeName( const QString &fileName ); | ||
63 | static QString decodeName( const QCString &localFileName ); | ||
64 | static void setEncodingFunction( EncoderFn ); | ||
65 | static void setDecodingFunction( DecoderFn ); | ||
66 | |||
67 | boolexists() const; | ||
68 | static bool exists( const QString &fileName ); | ||
69 | |||
70 | boolremove(); | ||
71 | static bool remove( const QString &fileName ); | ||
72 | |||
73 | boolopen( int ); | ||
74 | boolopen( int, FILE * ); | ||
75 | boolopen( int, int ); | ||
76 | voidclose(); | ||
77 | voidflush(); | ||
78 | |||
79 | Offsetsize() const; | ||
80 | Offsetat() const; | ||
81 | boolat( Offset ); | ||
82 | boolatEnd() const; | ||
83 | |||
84 | Q_LONGreadBlock( char *data, Q_ULONG len ); | ||
85 | Q_LONGwriteBlock( const char *data, Q_ULONG len ); | ||
86 | Q_LONGwriteBlock( const QByteArray& data ) | ||
87 | { return QIODevice::writeBlock(data); } | ||
88 | Q_LONGreadLine( char *data, Q_ULONG maxlen ); | ||
89 | Q_LONGreadLine( QString &, Q_ULONG maxlen ); | ||
90 | |||
91 | int getch(); | ||
92 | int putch( int ); | ||
93 | int ungetch( int ); | ||
94 | |||
95 | int handle() const; | ||
96 | |||
97 | protected: | ||
98 | QStringfn; | ||
99 | FILE *fh; | ||
100 | int fd; | ||
101 | Offsetlength; | ||
102 | boolext_f; | ||
103 | void * d; | ||
104 | |||
105 | private: | ||
106 | voidinit(); | ||
107 | QCStringungetchBuffer; | ||
108 | |||
109 | private:// Disabled copy constructor and operator= | ||
110 | #if defined(Q_DISABLE_COPY) | ||
111 | QFile( const QFile & ); | ||
112 | QFile &operator=( const QFile & ); | ||
113 | #endif | ||
114 | }; | ||
115 | |||
116 | |||
117 | inline QString QFile::name() const | ||
118 | { return fn; } | ||
119 | |||
120 | inline QIODevice::Offset QFile::at() const | ||
121 | { return ioIndex; } | ||
122 | |||
123 | |||
124 | #endif // QFILE_H | ||