home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qfileinfo.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  144 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qfileinfo.h   3.0.0   edited Aug 3 20:07 $
  3. **
  4. ** Definition of QFileInfo class
  5. **
  6. ** Created : 950628
  7. **
  8. ** Copyright (C) 1992-2000 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 QFILEINFO_H
  39. #define QFILEINFO_H
  40.  
  41. #ifndef QT_H
  42. #include "qfile.h"
  43. #include "qdatetime.h"
  44. #endif // QT_H
  45.  
  46.  
  47. class QDir;
  48. struct QFileInfoCache;
  49.  
  50.  
  51. class Q_EXPORT QFileInfo                   // file information class
  52. {
  53. public:
  54.     enum PermissionSpec {
  55.     ReadUser  = 0400, WriteUser  = 0200, ExeUser  = 0100,
  56.     ReadGroup = 0040, WriteGroup = 0020, ExeGroup = 0010,
  57.     ReadOther = 0004, WriteOther = 0002, ExeOther = 0001 };
  58.  
  59.     QFileInfo();
  60.     QFileInfo( const QString &file );
  61.     QFileInfo( const QFile & );
  62. #ifndef QT_NO_DIR
  63.     QFileInfo( const QDir &, const QString &fileName );
  64. #endif
  65.     QFileInfo( const QFileInfo & );
  66.    ~QFileInfo();
  67.  
  68.     QFileInfo  &operator=( const QFileInfo & );
  69.  
  70.     void    setFile( const QString &file );
  71.     void    setFile( const QFile & );
  72. #ifndef QT_NO_DIR
  73.     void    setFile( const QDir &, const QString &fileName );
  74. #endif
  75.     bool    exists()    const;
  76.     void    refresh()    const;
  77.     bool    caching()    const;
  78.     void    setCaching( bool );
  79.  
  80.     QString    filePath()    const;
  81.     QString    fileName()    const;
  82. #ifndef QT_NO_DIR //###
  83.     QString    absFilePath()    const;
  84. #endif
  85.     QString    baseName( bool complete = FALSE ) const;
  86.     QString    extension( bool complete = TRUE ) const;
  87.  
  88. #ifndef QT_NO_DIR //###
  89.     QString    dirPath( bool absPath = FALSE ) const;
  90. #endif
  91. #ifndef QT_NO_DIR
  92.     QDir    dir( bool absPath = FALSE )    const;
  93. #endif
  94.     bool    isReadable()    const;
  95.     bool    isWritable()    const;
  96.     bool    isExecutable()    const;
  97.  
  98. #ifndef QT_NO_DIR //###
  99.     bool    isRelative()    const;
  100.     bool    convertToAbs();
  101. #endif
  102.  
  103.     bool    isFile()    const;
  104.     bool    isDir()        const;
  105.     bool    isSymLink()    const;
  106.  
  107.     QString    readLink()    const;
  108.  
  109.     QString    owner()        const;
  110.     uint    ownerId()    const;
  111.     QString    group()        const;
  112.     uint    groupId()    const;
  113.  
  114.     bool    permission( int permissionSpec ) const;
  115.  
  116.     uint    size()        const;
  117.  
  118.     QDateTime    created()    const;
  119.     QDateTime    lastModified()    const;
  120.     QDateTime    lastRead()    const;
  121.  
  122. private:
  123.     void    doStat() const;
  124.     static void slashify( QString & );
  125.     static void makeAbs( QString & );
  126.     
  127.     QString    fn;
  128.     QFileInfoCache *fic;
  129.     bool    cache;
  130. #if defined(Q_OS_UNIX)
  131.     bool        symLink;
  132. #endif
  133.  
  134. };
  135.  
  136.  
  137. inline bool QFileInfo::caching() const
  138. {
  139.     return cache;
  140. }
  141.  
  142.  
  143. #endif // QFILEINFO_H
  144.