qurlinfo.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2016 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  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 The Qt Company. For licensing terms
  14. ** and conditions see https://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
  20. ** Foundation and appearing in the file LICENSE.LGPL3 included in the
  21. ** packaging of this file. Please review the following information to
  22. ** ensure the GNU Lesser General Public License version 3 requirements
  23. ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
  24. **
  25. ** GNU General Public License Usage
  26. ** Alternatively, this file may be used under the terms of the GNU
  27. ** General Public License version 2.0 or (at your option) the GNU General
  28. ** Public license version 3 or any later version approved by the KDE Free
  29. ** Qt Foundation. The licenses are as published by the Free Software
  30. ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
  31. ** included in the packaging of this file. Please review the following
  32. ** information to ensure the GNU General Public License requirements will
  33. ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
  34. ** https://www.gnu.org/licenses/gpl-3.0.html.
  35. **
  36. ** $QT_END_LICENSE$
  37. **
  38. ****************************************************************************/
  39. #ifndef QURLINFO_H
  40. #define QURLINFO_H
  41. //
  42. // W A R N I N G
  43. // -------------
  44. //
  45. // This file is not part of the Qt API. It exists purely as an
  46. // implementation detail. This header file may change from version to
  47. // version without notice, or even be removed.
  48. //
  49. // We mean it.
  50. //
  51. #include <QtCore/qdatetime.h>
  52. #include <QtCore/qstring.h>
  53. #include <QtCore/qiodevice.h>
  54. //QT_REQUIRE_CONFIG(ftp);
  55. QT_BEGIN_NAMESPACE
  56. class QUrl;
  57. class QUrlInfoPrivate;
  58. class QUrlInfo
  59. {
  60. public:
  61. enum PermissionSpec {
  62. ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100,
  63. ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010,
  64. ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 };
  65. QUrlInfo();
  66. QUrlInfo(const QUrlInfo &ui);
  67. QUrlInfo(const QString &name, int permissions, const QString &owner,
  68. const QString &group, qint64 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, qint64 size, const QDateTime &lastModified,
  73. const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
  74. bool isWritable, bool isReadable, bool isExecutable);
  75. QUrlInfo &operator=(const QUrlInfo &ui);
  76. virtual ~QUrlInfo();
  77. virtual void setName(const QString &name);
  78. virtual void setDir(bool b);
  79. virtual void setFile(bool b);
  80. virtual void setSymLink(bool b);
  81. virtual void setOwner(const QString &s);
  82. virtual void setGroup(const QString &s);
  83. virtual void setSize(qint64 size);
  84. virtual void setWritable(bool b);
  85. virtual void setReadable(bool b);
  86. virtual void setPermissions(int p);
  87. virtual void setLastModified(const QDateTime &dt);
  88. void setLastRead(const QDateTime &dt);
  89. bool isValid() const;
  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. static bool greaterThan(const QUrlInfo &i1, const QUrlInfo &i2,
  104. int sortBy);
  105. static bool lessThan(const QUrlInfo &i1, const QUrlInfo &i2,
  106. int sortBy);
  107. static bool equal(const QUrlInfo &i1, const QUrlInfo &i2,
  108. int sortBy);
  109. bool operator==(const QUrlInfo &i) const;
  110. inline bool operator!=(const QUrlInfo &i) const
  111. { return !operator==(i); }
  112. private:
  113. QUrlInfoPrivate *d;
  114. };
  115. QT_END_NAMESPACE
  116. #endif // QURLINFO_H