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