Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:19:43

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QLIBRARY_H
0006 #define QLIBRARY_H
0007 
0008 #include <QtCore/qobject.h>
0009 #include <QtCore/qtaggedpointer.h>
0010 
0011 QT_REQUIRE_CONFIG(library);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QLibraryPrivate;
0016 
0017 class Q_CORE_EXPORT QLibrary : public QObject
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
0021     Q_PROPERTY(LoadHints loadHints READ loadHints WRITE setLoadHints)
0022 public:
0023     enum LoadHint {
0024         ResolveAllSymbolsHint = 0x01,
0025         ExportExternalSymbolsHint = 0x02,
0026         LoadArchiveMemberHint = 0x04,
0027         PreventUnloadHint = 0x08,
0028         DeepBindHint = 0x10
0029     };
0030     Q_DECLARE_FLAGS(LoadHints, LoadHint)
0031     Q_ENUM(LoadHint)
0032     Q_FLAG(LoadHints)
0033 
0034     explicit QLibrary(QObject *parent = nullptr);
0035     explicit QLibrary(const QString &fileName, QObject *parent = nullptr);
0036     explicit QLibrary(const QString &fileName, int verNum, QObject *parent = nullptr);
0037     explicit QLibrary(const QString &fileName, const QString &version, QObject *parent = nullptr);
0038     ~QLibrary();
0039 
0040     QFunctionPointer resolve(const char *symbol);
0041     static QFunctionPointer resolve(const QString &fileName, const char *symbol);
0042     static QFunctionPointer resolve(const QString &fileName, int verNum, const char *symbol);
0043     static QFunctionPointer resolve(const QString &fileName, const QString &version, const char *symbol);
0044 
0045     bool load();
0046     bool unload();
0047     bool isLoaded() const;
0048 
0049     static bool isLibrary(const QString &fileName);
0050 
0051     void setFileName(const QString &fileName);
0052     QString fileName() const;
0053 
0054     void setFileNameAndVersion(const QString &fileName, int verNum);
0055     void setFileNameAndVersion(const QString &fileName, const QString &version);
0056     QString errorString() const;
0057 
0058     void setLoadHints(LoadHints hints);
0059     LoadHints loadHints() const;
0060 
0061 private:
0062     enum LoadStatusTag {
0063         NotLoaded,
0064         Loaded
0065     };
0066 
0067     friend class QLibraryPrivate;
0068     QTaggedPointer<QLibraryPrivate, LoadStatusTag> d = nullptr;
0069     Q_DISABLE_COPY(QLibrary)
0070 };
0071 
0072 Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints)
0073 
0074 QT_END_NAMESPACE
0075 
0076 #endif //QLIBRARY_H