qresource.sip 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // qresource.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QResource
  22. {
  23. %TypeHeaderCode
  24. #include <qresource.h>
  25. %End
  26. public:
  27. QResource(const QString &fileName = QString(), const QLocale &locale = QLocale());
  28. ~QResource();
  29. QString absoluteFilePath() const;
  30. SIP_PYOBJECT data() const /TypeHint="bytes"/;
  31. %MethodCode
  32. // The data may contain embedded '\0's so set the size explicitly.
  33. if (sipCpp->data())
  34. {
  35. if ((sipRes = PyBytes_FromStringAndSize((char *)sipCpp->data(), sipCpp->size())) == NULL)
  36. sipIsErr = 1;
  37. }
  38. else
  39. {
  40. Py_INCREF(Py_None);
  41. sipRes = Py_None;
  42. }
  43. %End
  44. QString fileName() const;
  45. bool isValid() const;
  46. QLocale locale() const;
  47. void setFileName(const QString &file);
  48. void setLocale(const QLocale &locale);
  49. qint64 size() const;
  50. static bool registerResource(const QString &rccFileName, const QString &mapRoot = QString());
  51. static bool registerResource(const uchar *rccData, const QString &mapRoot = QString()) /PyName=registerResourceData/;
  52. static bool unregisterResource(const QString &rccFileName, const QString &mapRoot = QString());
  53. static bool unregisterResource(const uchar *rccData, const QString &mapRoot = QString()) /PyName=unregisterResourceData/;
  54. protected:
  55. QStringList children() const;
  56. bool isDir() const;
  57. bool isFile() const;
  58. public:
  59. QDateTime lastModified() const;
  60. enum Compression
  61. {
  62. NoCompression,
  63. ZlibCompression,
  64. ZstdCompression,
  65. };
  66. QResource::Compression compressionAlgorithm() const;
  67. qint64 uncompressedSize() const;
  68. QByteArray uncompressedData() const;
  69. private:
  70. QResource(const QResource &);
  71. };