| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: qurlinfo.h 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Definition of QUrlInfo class
|
|---|
| 5 | **
|
|---|
| 6 | ** Created : 950429
|
|---|
| 7 | **
|
|---|
| 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
|
|---|
| 9 | **
|
|---|
| 10 | ** This file is part of the kernel 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 QURLINFO_H
|
|---|
| 39 | #define QURLINFO_H
|
|---|
| 40 |
|
|---|
| 41 | #ifndef QT_H
|
|---|
| 42 | #include "qdatetime.h"
|
|---|
| 43 | #include "qstring.h"
|
|---|
| 44 | #if defined(QT_ABI_QT4)
|
|---|
| 45 | #include "qiodevice.h"
|
|---|
| 46 | #endif
|
|---|
| 47 | #endif // QT_H
|
|---|
| 48 |
|
|---|
| 49 | class QUrlOperator;
|
|---|
| 50 | class QUrl;
|
|---|
| 51 | class QUrlInfoPrivate;
|
|---|
| 52 |
|
|---|
| 53 | class Q_EXPORT QUrlInfo
|
|---|
| 54 | {
|
|---|
| 55 | public:
|
|---|
| 56 | enum PermissionSpec {
|
|---|
| 57 | ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100,
|
|---|
| 58 | ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010,
|
|---|
| 59 | ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 };
|
|---|
| 60 |
|
|---|
| 61 | QUrlInfo();
|
|---|
| 62 | QUrlInfo( const QUrlOperator &path, const QString &file );
|
|---|
| 63 | QUrlInfo( const QUrlInfo &ui );
|
|---|
| 64 | #if (QT_VERSION-0 >= 0x040000)
|
|---|
| 65 | #error "QUrlInfo::QUrlInfo() should accept QIODevice::Offset instead of uint"
|
|---|
| 66 | #elif defined(QT_ABI_QT4)
|
|---|
| 67 | QUrlInfo( const QString &name, int permissions, const QString &owner,
|
|---|
| 68 | const QString &group, QIODevice::Offset size, const QDateTime &lastModified,
|
|---|
| 69 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
|
|---|
| 70 | bool isWritable, bool isReadable, bool isExecutable );
|
|---|
| 71 | QUrlInfo( const QUrl &url, int permissions, const QString &owner,
|
|---|
| 72 | const QString &group, QIODevice::Offset size, const QDateTime &lastModified,
|
|---|
| 73 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
|
|---|
| 74 | bool isWritable, bool isReadable, bool isExecutable );
|
|---|
| 75 | #else
|
|---|
| 76 | QUrlInfo( const QString &name, int permissions, const QString &owner,
|
|---|
| 77 | const QString &group, uint size, const QDateTime &lastModified,
|
|---|
| 78 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
|
|---|
| 79 | bool isWritable, bool isReadable, bool isExecutable );
|
|---|
| 80 | QUrlInfo( const QUrl &url, int permissions, const QString &owner,
|
|---|
| 81 | const QString &group, uint size, const QDateTime &lastModified,
|
|---|
| 82 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
|
|---|
| 83 | bool isWritable, bool isReadable, bool isExecutable );
|
|---|
| 84 | #endif
|
|---|
| 85 | QUrlInfo &operator=( const QUrlInfo &ui );
|
|---|
| 86 | virtual ~QUrlInfo();
|
|---|
| 87 |
|
|---|
| 88 | virtual void setName( const QString &name );
|
|---|
| 89 | virtual void setDir( bool b );
|
|---|
| 90 | virtual void setFile( bool b );
|
|---|
| 91 | virtual void setSymLink( bool b );
|
|---|
| 92 | virtual void setOwner( const QString &s );
|
|---|
| 93 | virtual void setGroup( const QString &s );
|
|---|
| 94 | #if (QT_VERSION-0 >= 0x040000)
|
|---|
| 95 | #error "QUrlInfo::setSize() should accept QIODevice::Offset instead of uint"
|
|---|
| 96 | #elif defined(QT_ABI_QT4)
|
|---|
| 97 | virtual void setSize( QIODevice::Offset size );
|
|---|
| 98 | #else
|
|---|
| 99 | virtual void setSize( uint size );
|
|---|
| 100 | #endif
|
|---|
| 101 | virtual void setWritable( bool b );
|
|---|
| 102 | virtual void setReadable( bool b );
|
|---|
| 103 | virtual void setPermissions( int p );
|
|---|
| 104 | virtual void setLastModified( const QDateTime &dt );
|
|---|
| 105 |
|
|---|
| 106 | bool isValid() const;
|
|---|
| 107 |
|
|---|
| 108 | QString name() const;
|
|---|
| 109 | int permissions() const;
|
|---|
| 110 | QString owner() const;
|
|---|
| 111 | QString group() const;
|
|---|
| 112 | #if (QT_VERSION-0 >= 0x040000)
|
|---|
| 113 | #error "QUrlInfo::size() should return QIODevice::Offset instead of uint"
|
|---|
| 114 | #elif defined(QT_ABI_QT4)
|
|---|
| 115 | QIODevice::Offset size() const;
|
|---|
| 116 | #else
|
|---|
| 117 | uint size() const;
|
|---|
| 118 | #endif
|
|---|
| 119 | QDateTime lastModified() const;
|
|---|
| 120 | QDateTime lastRead() const;
|
|---|
| 121 | bool isDir() const;
|
|---|
| 122 | bool isFile() const;
|
|---|
| 123 | bool isSymLink() const;
|
|---|
| 124 | bool isWritable() const;
|
|---|
| 125 | bool isReadable() const;
|
|---|
| 126 | bool isExecutable() const;
|
|---|
| 127 |
|
|---|
| 128 | static bool greaterThan( const QUrlInfo &i1, const QUrlInfo &i2,
|
|---|
| 129 | int sortBy );
|
|---|
| 130 | static bool lessThan( const QUrlInfo &i1, const QUrlInfo &i2,
|
|---|
| 131 | int sortBy );
|
|---|
| 132 | static bool equal( const QUrlInfo &i1, const QUrlInfo &i2,
|
|---|
| 133 | int sortBy );
|
|---|
| 134 |
|
|---|
| 135 | bool operator==( const QUrlInfo &i ) const;
|
|---|
| 136 | private:
|
|---|
| 137 | QUrlInfoPrivate *d;
|
|---|
| 138 |
|
|---|
| 139 | };
|
|---|
| 140 |
|
|---|
| 141 | #endif
|
|---|