Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qfileinfo.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** $Id: qfileinfo.h,v 1.2 2003/07/10 02:40:11 llornkcor Exp $
00003 **
00004 ** Definition of QFileInfo class
00005 **
00006 ** Created : 950628
00007 **
00008 ** Copyright (C) 1992-2002 Trolltech AS.  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 AS 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 
00050 
00051 class Q_EXPORT QFileInfo
00052 {
00053 public:
00054     enum PermissionSpec {
00055         ReadUser  = 0400, WriteUser  = 0200, ExeUser  = 0100,
00056         ReadGroup = 0040, WriteGroup = 0020, ExeGroup = 0010,
00057         ReadOther = 0004, WriteOther = 0002, ExeOther = 0001 };
00058 
00059     QFileInfo();
00060     QFileInfo( const QString &file );
00061     QFileInfo( const QFile & );
00062 #ifndef QT_NO_DIR
00063     QFileInfo( const QDir &, const QString &fileName );
00064 #endif
00065     QFileInfo( const QFileInfo & );
00066    ~QFileInfo();
00067 
00068     QFileInfo  &operator=( const QFileInfo & );
00069 
00070     void        setFile( const QString &file );
00071     void        setFile( const QFile & );
00072 #ifndef QT_NO_DIR
00073     void        setFile( const QDir &, const QString &fileName );
00074 #endif
00075     bool        exists()        const;
00076     void        refresh()       const;
00077     bool        caching()       const;
00078     void        setCaching( bool );
00079 
00080     QString     filePath()      const;
00081     QString     fileName()      const;
00082 #ifndef QT_NO_DIR //###
00083     QString     absFilePath()   const;
00084 #endif
00085     QString     baseName( bool complete = FALSE ) const;
00086     QString     extension( bool complete = TRUE ) const;
00087 
00088 #ifndef QT_NO_DIR //###
00089     QString     dirPath( bool absPath = FALSE ) const;
00090 #endif
00091 #ifndef QT_NO_DIR
00092     QDir        dir( bool absPath = FALSE )     const;
00093 #endif
00094     bool        isReadable()    const;
00095     bool        isWritable()    const;
00096     bool        isExecutable()  const;
00097     bool        isHidden()      const;
00098 
00099 #ifndef QT_NO_DIR //###
00100     bool        isRelative()    const;
00101     bool        convertToAbs();
00102 #endif
00103 
00104     bool        isFile()        const;
00105     bool        isDir()         const;
00106     bool        isSymLink()     const;
00107 
00108     QString     readLink()      const;
00109 
00110     QString     owner()         const;
00111     uint        ownerId()       const;
00112     QString     group()         const;
00113     uint        groupId()       const;
00114 
00115     bool        permission( int permissionSpec ) const;
00116 
00117 #if (QT_VERSION-0 >= 0x040000)
00118 #error "QFileInfo::size() should return QIODevice::Offset instead of uint"
00119 #elif defined(QT_ABI_QT4)
00120     QIODevice::Offset size()    const;
00121 #else
00122     uint        size()          const;
00123 #endif
00124 
00125     QDateTime   created()       const;
00126     QDateTime   lastModified()  const;
00127     QDateTime   lastRead()      const;
00128 
00129 private:
00130     void        doStat() const;
00131     static void slashify( QString & );
00132     static void makeAbs( QString & );
00133 
00134     QString     fn;
00135     QFileInfoCache *fic;
00136     bool        cache;
00137 #if defined(Q_OS_UNIX)
00138     bool        symLink;
00139 #endif
00140 
00141 };
00142 
00143 
00144 inline bool QFileInfo::caching() const
00145 {
00146     return cache;
00147 }
00148 
00149 
00150 #endif // QFILEINFO_H

Generated on Sat Nov 5 16:18:24 2005 for OPIE by  doxygen 1.4.2