Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlibrary.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QLIBRARY_H
5#define QLIBRARY_H
6
7#include <QtCore/qobject.h>
8#include <QtCore/qtaggedpointer.h>
9
11
13
14class QLibraryPrivate;
15
16class Q_CORE_EXPORT QLibrary : public QObject
17{
20 Q_PROPERTY(LoadHints loadHints READ loadHints WRITE setLoadHints)
21public:
22 enum LoadHint {
23 ResolveAllSymbolsHint = 0x01,
24 ExportExternalSymbolsHint = 0x02,
25 LoadArchiveMemberHint = 0x04,
26 PreventUnloadHint = 0x08,
27 DeepBindHint = 0x10
28 };
29 Q_DECLARE_FLAGS(LoadHints, LoadHint)
30 Q_ENUM(LoadHint)
31 Q_FLAG(LoadHints)
32
33 explicit QLibrary(QObject *parent = nullptr);
34 explicit QLibrary(const QString &fileName, QObject *parent = nullptr);
35 explicit QLibrary(const QString &fileName, int verNum, QObject *parent = nullptr);
36 explicit QLibrary(const QString &fileName, const QString &version, QObject *parent = nullptr);
37 ~QLibrary();
38
39 QFunctionPointer resolve(const char *symbol);
40 static QFunctionPointer resolve(const QString &fileName, const char *symbol);
41 static QFunctionPointer resolve(const QString &fileName, int verNum, const char *symbol);
42 static QFunctionPointer resolve(const QString &fileName, const QString &version, const char *symbol);
43
44 bool load();
45 bool unload();
46 bool isLoaded() const;
47
48 static bool isLibrary(const QString &fileName);
49
50 void setFileName(const QString &fileName);
51 QString fileName() const;
52
53 void setFileNameAndVersion(const QString &fileName, int verNum);
54 void setFileNameAndVersion(const QString &fileName, const QString &version);
55 QString errorString() const;
56
57 void setLoadHints(LoadHints hints);
58 LoadHints loadHints() const;
59
60private:
61 enum LoadStatusTag {
62 NotLoaded,
63 Loaded
64 };
65
66 QTaggedPointer<QLibraryPrivate, LoadStatusTag> d = nullptr;
67 Q_DISABLE_COPY(QLibrary)
68};
69
70Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints)
71
73
74#endif //QLIBRARY_H
\inmodule QtCore \reentrant
Definition qlibrary.h:17
LoadHint
This enum describes the possible hints that can be used to change the way libraries are handled when ...
Definition qlibrary.h:22
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
p1 load("image.bmp")
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
static const QQmlJSScope * resolve(const QQmlJSScope *current, const QStringList &names)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
file setFileName("readme.txt")