Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qfileinfo.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QFileInfo class 00005 ** 00006 ** Created : 950628 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the tools module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QFILEINFO_H 00039 #define QFILEINFO_H 00040 00041 #ifndef QT_H 00042 #include "qfile.h" 00043 #include "qdatetime.h" 00044 #endif // QT_H 00045 00046 00047 class QDir; 00048 struct QFileInfoCache; 00049 template <class T> class QDeepCopy; 00050 00051 00052 class Q_EXPORT QFileInfo 00053 { 00054 public: 00055 enum PermissionSpec { 00056 ReadOwner = 04000, WriteOwner = 02000, ExeOwner = 01000, 00057 ReadUser = 00400, WriteUser = 00200, ExeUser = 00100, 00058 ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010, 00059 ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 }; 00060 00061 QFileInfo(); 00062 QFileInfo( const QString &file ); 00063 QFileInfo( const QFile & ); 00064 #ifndef QT_NO_DIR 00065 QFileInfo( const QDir &, const QString &fileName ); 00066 #endif 00067 QFileInfo( const QFileInfo & ); 00068 ~QFileInfo(); 00069 00070 QFileInfo &operator=( const QFileInfo & ); 00071 00072 void setFile( const QString &file ); 00073 void setFile( const QFile & ); 00074 #ifndef QT_NO_DIR 00075 void setFile( const QDir &, const QString &fileName ); 00076 #endif 00077 bool exists() const; 00078 void refresh() const; 00079 bool caching() const; 00080 void setCaching( bool ); 00081 00082 QString filePath() const; 00083 QString fileName() const; 00084 #ifndef QT_NO_DIR //### 00085 QString absFilePath() const; 00086 #endif 00087 QString baseName( bool complete = FALSE ) const; 00088 QString extension( bool complete = TRUE ) const; 00089 00090 #ifndef QT_NO_DIR //### 00091 QString dirPath( bool absPath = FALSE ) const; 00092 #endif 00093 #ifndef QT_NO_DIR 00094 QDir dir( bool absPath = FALSE ) const; 00095 #endif 00096 bool isReadable() const; 00097 bool isWritable() const; 00098 bool isExecutable() const; 00099 bool isHidden() const; 00100 00101 #ifndef QT_NO_DIR //### 00102 bool isRelative() const; 00103 bool convertToAbs(); 00104 #endif 00105 00106 bool isFile() const; 00107 bool isDir() const; 00108 bool isSymLink() const; 00109 00110 QString readLink() const; 00111 00112 QString owner() const; 00113 uint ownerId() const; 00114 QString group() const; 00115 uint groupId() const; 00116 00117 bool permission( int permissionSpec ) const; 00118 00119 #if (QT_VERSION-0 >= 0x040000) 00120 #error "QFileInfo::size() should return QIODevice::Offset instead of uint" 00121 #elif defined(QT_ABI_QT4) 00122 QIODevice::Offset size() const; 00123 #else 00124 uint size() const; 00125 #endif 00126 00127 QDateTime created() const; 00128 QDateTime lastModified() const; 00129 QDateTime lastRead() const; 00130 00131 private: 00132 void doStat() const; 00133 static void slashify( QString & ); 00134 static void makeAbs( QString & ); 00135 00136 QString fn; 00137 QFileInfoCache *fic; 00138 bool cache; 00139 #if defined(Q_OS_UNIX) 00140 bool symLink; 00141 #endif 00142 00143 void detach(); 00144 friend class QDeepCopy< QFileInfo >; 00145 }; 00146 00147 00148 inline bool QFileInfo::caching() const 00149 { 00150 return cache; 00151 } 00152 00153 00154 #endif // QFILEINFO_H