| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
| 4 | ** Contact: http://www.qt-project.org/legal |
| 5 | ** |
| 6 | ** This file is part of the QtNetwork module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and Digia. For licensing terms and |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 2.1 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 24 | ** |
| 25 | ** In addition, as a special exception, Digia gives you certain additional |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 28 | ** |
| 29 | ** GNU General Public License Usage |
| 30 | ** Alternatively, this file may be used under the terms of the GNU |
| 31 | ** General Public License version 3.0 as published by the Free Software |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
| 33 | ** packaging of this file. Please review the following information to |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
| 36 | ** |
| 37 | ** |
| 38 | ** $QT_END_LICENSE$ |
| 39 | ** |
| 40 | ****************************************************************************/ |
| 41 | |
| 42 | #ifndef QURLINFO_H |
| 43 | #define QURLINFO_H |
| 44 | |
| 45 | #include "QtCore/qdatetime.h" |
| 46 | #include "QtCore/qstring.h" |
| 47 | #include "QtCore/qiodevice.h" |
| 48 | |
| 49 | QT_BEGIN_NAMESPACE |
| 50 | |
| 51 | class QUrl; |
| 52 | class QUrlInfoPrivate; |
| 53 | |
| 54 | class QUrlInfo |
| 55 | { |
| 56 | public: |
| 57 | enum PermissionSpec { |
| 58 | ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100, |
| 59 | ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010, |
| 60 | ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 }; |
| 61 | |
| 62 | QUrlInfo(); |
| 63 | QUrlInfo(const QUrlInfo &ui); |
| 64 | QUrlInfo(const QString &name, int permissions, const QString &owner, |
| 65 | const QString &group, qint64 size, const QDateTime &lastModified, |
| 66 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, |
| 67 | bool isWritable, bool isReadable, bool isExecutable); |
| 68 | QUrlInfo(const QUrl &url, int permissions, const QString &owner, |
| 69 | const QString &group, qint64 size, const QDateTime &lastModified, |
| 70 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, |
| 71 | bool isWritable, bool isReadable, bool isExecutable); |
| 72 | QUrlInfo &operator=(const QUrlInfo &ui); |
| 73 | virtual ~QUrlInfo(); |
| 74 | |
| 75 | virtual void setName(const QString &name); |
| 76 | virtual void setDir(bool b); |
| 77 | virtual void setFile(bool b); |
| 78 | virtual void setSymLink(bool b); |
| 79 | virtual void setOwner(const QString &s); |
| 80 | virtual void setGroup(const QString &s); |
| 81 | virtual void setSize(qint64 size); |
| 82 | virtual void setWritable(bool b); |
| 83 | virtual void setReadable(bool b); |
| 84 | virtual void setPermissions(int p); |
| 85 | virtual void setLastModified(const QDateTime &dt); |
| 86 | void setLastRead(const QDateTime &dt); |
| 87 | |
| 88 | bool isValid() const; |
| 89 | |
| 90 | QString name() const; |
| 91 | int permissions() const; |
| 92 | QString owner() const; |
| 93 | QString group() const; |
| 94 | qint64 size() const; |
| 95 | QDateTime lastModified() const; |
| 96 | QDateTime lastRead() const; |
| 97 | bool isDir() const; |
| 98 | bool isFile() const; |
| 99 | bool isSymLink() const; |
| 100 | bool isWritable() const; |
| 101 | bool isReadable() const; |
| 102 | bool isExecutable() const; |
| 103 | |
| 104 | static bool greaterThan(const QUrlInfo &i1, const QUrlInfo &i2, |
| 105 | int sortBy); |
| 106 | static bool lessThan(const QUrlInfo &i1, const QUrlInfo &i2, |
| 107 | int sortBy); |
| 108 | static bool equal(const QUrlInfo &i1, const QUrlInfo &i2, |
| 109 | int sortBy); |
| 110 | |
| 111 | bool operator==(const QUrlInfo &i) const; |
| 112 | inline bool operator!=(const QUrlInfo &i) const |
| 113 | { return !operator==(i); } |
| 114 | |
| 115 | private: |
| 116 | QUrlInfoPrivate *d; |
| 117 | }; |
| 118 | |
| 119 | QT_END_NAMESPACE |
| 120 | |
| 121 | #endif // QURLINFO_H |