diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-12-29 15:59:58 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-12-29 18:07:21 +0100 |
commit | 7350fe82953cf6274b8845a890eafb21a09b9931 (patch) | |
tree | e802f22bd64b9cdd83b48e257629787a57352be3 /lib/quotient_common.h | |
parent | 02fdd08b98d878168eb81376a44586176dfd9576 (diff) | |
download | libquotient-7350fe82953cf6274b8845a890eafb21a09b9931.tar.gz libquotient-7350fe82953cf6274b8845a890eafb21a09b9931.zip |
Add QUOTIENT_API throughout non-generated code
This include all (hopefully) classes/structures and functions that have
non-inline definitions, as well as namespaces with Q_NAMESPACE since
those have non-inline (as of Qt 5.15) QMetaObject - for that a new
macro, QUO_NAMESPACE, has been devised to accommodate the lack of
Q_NAMESPACE_EXPORT in Qt before 5.14.
Diffstat (limited to 'lib/quotient_common.h')
-rw-r--r-- | lib/quotient_common.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/quotient_common.h b/lib/quotient_common.h index 0e3e2a40..a5926e8c 100644 --- a/lib/quotient_common.h +++ b/lib/quotient_common.h @@ -3,6 +3,8 @@ #pragma once +#include "quotient_export.h" + #include <qobjectdefs.h> #include <array> @@ -26,8 +28,21 @@ #define DECL_DEPRECATED_ENUMERATOR(Deprecated, Recommended) \ Deprecated Q_DECL_ENUMERATOR_DEPRECATED_X("Use " #Recommended) = Recommended +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) +// The first line is a usual way to indicate a namespace to moc; +// the second line redeclares the namespace static metaobject with +// QUOTIENT_API so that dynamically linked clients could serialise +// flag/enum values from the namespace. +#define QUO_NAMESPACE \ +Q_NAMESPACE \ +extern QUOTIENT_API const QMetaObject staticMetaObject; +#else +// Since Qt 5.14.0, it's all packed in a single macro +#define QUO_NAMESPACE Q_NAMESPACE_EXPORT(QUOTIENT_API) +#endif + namespace Quotient { -Q_NAMESPACE +QUO_NAMESPACE // std::array {} needs explicit template parameters on macOS because // Apple stdlib doesn't have deduction guides for std::array. C++20 has |