Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:32:22

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // Copyright (C) 2019 Intel Corporation.
0003 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0004 // Qt-Security score:significant reason:default
0005 
0006 #ifndef QRESOURCE_H
0007 #define QRESOURCE_H
0008 
0009 #include <QtCore/qstring.h>
0010 #include <QtCore/qlocale.h>
0011 #include <QtCore/qstringlist.h>
0012 #include <QtCore/qlist.h>
0013 #include <QtCore/qscopedpointer.h>
0014 
0015 QT_BEGIN_NAMESPACE
0016 
0017 
0018 class QResourcePrivate;
0019 
0020 class Q_CORE_EXPORT QResource
0021 {
0022 public:
0023     enum Compression {
0024         NoCompression,
0025         ZlibCompression,
0026         ZstdCompression
0027     };
0028 
0029     QResource(const QString &file = QString(), const QLocale &locale = QLocale());
0030     ~QResource();
0031 
0032     void setFileName(const QString &file);
0033     QString fileName() const;
0034     QString absoluteFilePath() const;
0035 
0036     void setLocale(const QLocale &locale);
0037     QLocale locale() const;
0038 
0039     bool isValid() const;
0040 
0041     Compression compressionAlgorithm() const;
0042     qint64 size() const;
0043     const uchar *data() const;
0044     qint64 uncompressedSize() const;
0045     QByteArray uncompressedData() const;
0046     QDateTime lastModified() const;
0047 
0048     static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString());
0049     static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString());
0050 
0051     static bool registerResource(const uchar *rccData, const QString &resourceRoot=QString());
0052     static bool unregisterResource(const uchar *rccData, const QString &resourceRoot=QString());
0053 
0054 protected:
0055     friend class QResourceFileEngine;
0056     friend class QResourceFileEngineIterator;
0057     bool isDir() const;
0058     inline bool isFile() const { return !isDir(); }
0059     QStringList children() const;
0060 
0061 protected:
0062     QScopedPointer<QResourcePrivate> d_ptr;
0063 
0064 private:
0065     Q_DECLARE_PRIVATE(QResource)
0066 };
0067 
0068 QT_END_NAMESPACE
0069 
0070 #endif // QRESOURCE_H