aboutsummaryrefslogtreecommitdiff
path: root/lib/events
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-29 15:59:58 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-29 18:07:21 +0100
commit7350fe82953cf6274b8845a890eafb21a09b9931 (patch)
treee802f22bd64b9cdd83b48e257629787a57352be3 /lib/events
parent02fdd08b98d878168eb81376a44586176dfd9576 (diff)
downloadlibquotient-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/events')
-rw-r--r--lib/events/accountdataevents.h2
-rw-r--r--lib/events/callanswerevent.h3
-rw-r--r--lib/events/callhangupevent.h2
-rw-r--r--lib/events/callinviteevent.h2
-rw-r--r--lib/events/directchatevent.h2
-rw-r--r--lib/events/encryptedevent.h2
-rw-r--r--lib/events/encryptionevent.h5
-rw-r--r--lib/events/event.h23
-rw-r--r--lib/events/eventcontent.h19
-rw-r--r--lib/events/reactionevent.h6
-rw-r--r--lib/events/receiptevent.h2
-rw-r--r--lib/events/roomavatarevent.h3
-rw-r--r--lib/events/roomcreateevent.h2
-rw-r--r--lib/events/roomevent.h4
-rw-r--r--lib/events/roomkeyevent.h2
-rw-r--r--lib/events/roommemberevent.h5
-rw-r--r--lib/events/roommessageevent.h8
-rw-r--r--lib/events/roompowerlevelsevent.h8
-rw-r--r--lib/events/roomtombstoneevent.h2
-rw-r--r--lib/events/simplestateevents.h3
-rw-r--r--lib/events/stateevent.h2
-rw-r--r--lib/events/stickerevent.h2
-rw-r--r--lib/events/typingevent.h2
23 files changed, 56 insertions, 55 deletions
diff --git a/lib/events/accountdataevents.h b/lib/events/accountdataevents.h
index 9cf77be3..c0f2202d 100644
--- a/lib/events/accountdataevents.h
+++ b/lib/events/accountdataevents.h
@@ -50,7 +50,7 @@ struct JsonObjectConverter<TagRecord> {
using TagsMap = QHash<QString, TagRecord>;
#define DEFINE_SIMPLE_EVENT(_Name, _TypeId, _ContentType, _ContentKey) \
- class _Name : public Event { \
+ class QUOTIENT_API _Name : public Event { \
public: \
using content_type = _ContentType; \
DEFINE_EVENT_TYPEID(_TypeId, _Name) \
diff --git a/lib/events/callanswerevent.h b/lib/events/callanswerevent.h
index 4c01c941..8ffe60f2 100644
--- a/lib/events/callanswerevent.h
+++ b/lib/events/callanswerevent.h
@@ -7,7 +7,7 @@
#include "roomevent.h"
namespace Quotient {
-class CallAnswerEvent : public CallEventBase {
+class QUOTIENT_API CallAnswerEvent : public CallEventBase {
public:
DEFINE_EVENT_TYPEID("m.call.answer", CallAnswerEvent)
@@ -26,6 +26,5 @@ public:
return contentPart<QJsonObject>("answer"_ls).value("sdp"_ls).toString();
}
};
-
REGISTER_EVENT_TYPE(CallAnswerEvent)
} // namespace Quotient
diff --git a/lib/events/callhangupevent.h b/lib/events/callhangupevent.h
index f3f82833..b0017c59 100644
--- a/lib/events/callhangupevent.h
+++ b/lib/events/callhangupevent.h
@@ -7,7 +7,7 @@
#include "roomevent.h"
namespace Quotient {
-class CallHangupEvent : public CallEventBase {
+class QUOTIENT_API CallHangupEvent : public CallEventBase {
public:
DEFINE_EVENT_TYPEID("m.call.hangup", CallHangupEvent)
diff --git a/lib/events/callinviteevent.h b/lib/events/callinviteevent.h
index 80b7d651..47362b5c 100644
--- a/lib/events/callinviteevent.h
+++ b/lib/events/callinviteevent.h
@@ -7,7 +7,7 @@
#include "roomevent.h"
namespace Quotient {
-class CallInviteEvent : public CallEventBase {
+class QUOTIENT_API CallInviteEvent : public CallEventBase {
public:
DEFINE_EVENT_TYPEID("m.call.invite", CallInviteEvent)
diff --git a/lib/events/directchatevent.h b/lib/events/directchatevent.h
index e2143779..2018d3d6 100644
--- a/lib/events/directchatevent.h
+++ b/lib/events/directchatevent.h
@@ -6,7 +6,7 @@
#include "event.h"
namespace Quotient {
-class DirectChatEvent : public Event {
+class QUOTIENT_API DirectChatEvent : public Event {
public:
DEFINE_EVENT_TYPEID("m.direct", DirectChatEvent)
diff --git a/lib/events/encryptedevent.h b/lib/events/encryptedevent.h
index de89a7c6..81343a29 100644
--- a/lib/events/encryptedevent.h
+++ b/lib/events/encryptedevent.h
@@ -25,7 +25,7 @@ namespace Quotient {
* in general. It's possible, because RoomEvent interface is similar to Event's
* one and doesn't add new restrictions, just provides additional features.
*/
-class EncryptedEvent : public RoomEvent {
+class QUOTIENT_API EncryptedEvent : public RoomEvent {
public:
DEFINE_EVENT_TYPEID("m.room.encrypted", EncryptedEvent)
diff --git a/lib/events/encryptionevent.h b/lib/events/encryptionevent.h
index 14439fcc..dfb28b2f 100644
--- a/lib/events/encryptionevent.h
+++ b/lib/events/encryptionevent.h
@@ -8,7 +8,7 @@
#include "stateevent.h"
namespace Quotient {
-class EncryptionEventContent : public EventContent::Base {
+class QUOTIENT_API EncryptionEventContent : public EventContent::Base {
public:
enum EncryptionType : size_t { MegolmV1AesSha2 = 0, Undefined };
@@ -26,7 +26,7 @@ protected:
using EncryptionType = EncryptionEventContent::EncryptionType;
-class EncryptionEvent : public StateEvent<EncryptionEventContent> {
+class QUOTIENT_API EncryptionEvent : public StateEvent<EncryptionEventContent> {
Q_GADGET
public:
DEFINE_EVENT_TYPEID("m.room.encryption", EncryptionEvent)
@@ -51,6 +51,5 @@ public:
int rotationPeriodMs() const { return content().rotationPeriodMs; }
int rotationPeriodMsgs() const { return content().rotationPeriodMsgs; }
};
-
REGISTER_EVENT_TYPE(EncryptionEvent)
} // namespace Quotient
diff --git a/lib/events/event.h b/lib/events/event.h
index 8f62872d..8a0076d0 100644
--- a/lib/events/event.h
+++ b/lib/events/event.h
@@ -60,14 +60,14 @@ inline QJsonObject basicEventJson(const QString& matrixType,
using event_type_t = size_t;
using event_mtype_t = const char*;
-class EventTypeRegistry {
+class QUOTIENT_API EventTypeRegistry {
public:
~EventTypeRegistry() = default;
static event_type_t initializeTypeId(event_mtype_t matrixTypeId);
template <typename EventT>
- static inline event_type_t initializeTypeId()
+ static event_type_t initializeTypeId()
{
return initializeTypeId(EventT::matrixTypeId());
}
@@ -190,7 +190,7 @@ namespace _impl {
// === Event ===
-class Event {
+class QUOTIENT_API Event {
public:
using Type = event_type_t;
static inline _impl::EventFactory<Event> factory { "Event" };
@@ -243,7 +243,7 @@ public:
return fromJson<T>(unsignedJson()[std::forward<KeyT>(key)]);
}
- friend QDebug operator<<(QDebug dbg, const Event& e)
+ friend QUOTIENT_API QDebug operator<<(QDebug dbg, const Event& e)
{
QDebugStateSaver _dss { dbg };
dbg.noquote().nospace() << e.matrixType() << '(' << e.type() << "): ";
@@ -272,17 +272,20 @@ using Events = EventsArray<Event>;
// This macro should be used in a public section of an event class to
// provide matrixTypeId() and typeId().
-#define DEFINE_EVENT_TYPEID(_Id, _Type) \
- static constexpr event_mtype_t matrixTypeId() { return _Id; } \
- static auto typeId() { return Quotient::typeId<_Type>(); } \
+#define DEFINE_EVENT_TYPEID(_Id, _Type) \
+ static QUOTIENT_EXPORT constexpr event_mtype_t matrixTypeId() \
+ { \
+ return _Id; \
+ } \
+ static QUOTIENT_EXPORT auto typeId() { return Quotient::typeId<_Type>(); } \
// End of macro
// This macro should be put after an event class definition (in .h or .cpp)
// to enable its deserialisation from a /sync and other
// polymorphic event arrays
-#define REGISTER_EVENT_TYPE(_Type) \
- [[maybe_unused]] inline const auto _factoryAdded##_Type = \
- _Type::factory.addMethod<_Type>(); \
+#define REGISTER_EVENT_TYPE(_Type) \
+ [[maybe_unused]] QUOTIENT_API inline const auto _factoryAdded##_Type = \
+ _Type::factory.addMethod<_Type>(); \
// End of macro
// === Event loading ===
diff --git a/lib/events/eventcontent.h b/lib/events/eventcontent.h
index f609a603..bfa7d926 100644
--- a/lib/events/eventcontent.h
+++ b/lib/events/eventcontent.h
@@ -6,14 +6,15 @@
// This file contains generic event content definitions, applicable to room
// message events as well as other events (e.g., avatars).
+#include "encryptedfile.h"
+#include "quotient_export.h"
+
#include <QtCore/QJsonObject>
#include <QtCore/QMimeType>
#include <QtCore/QSize>
#include <QtCore/QUrl>
#include <QtCore/QMetaType>
-#include "encryptedfile.h"
-
class QFileInfo;
namespace Quotient {
@@ -28,7 +29,7 @@ namespace EventContent {
* assumed but not required that a content object can also be created
* from plain data.
*/
- class Base {
+ class QUOTIENT_API Base {
public:
explicit Base(QJsonObject o = {}) : originalJson(std::move(o)) {}
virtual ~Base() = default;
@@ -76,7 +77,7 @@ namespace EventContent {
*
* This class is not polymorphic.
*/
- class FileInfo {
+ class QUOTIENT_API FileInfo {
public:
FileInfo() = default;
explicit FileInfo(const QFileInfo& fi);
@@ -121,7 +122,7 @@ namespace EventContent {
/**
* A content info class for image content types: image, thumbnail, video
*/
- class ImageInfo : public FileInfo {
+ class QUOTIENT_API ImageInfo : public FileInfo {
public:
ImageInfo() = default;
explicit ImageInfo(const QFileInfo& fi, QSize imageSize = {});
@@ -146,7 +147,7 @@ namespace EventContent {
* the JSON representation of event content; namely,
* "info/thumbnail_url" and "info/thumbnail_info" fields are used.
*/
- class Thumbnail : public ImageInfo {
+ class QUOTIENT_API Thumbnail : public ImageInfo {
public:
Thumbnail() = default; // Allow empty thumbnails
Thumbnail(const QJsonObject& infoJson, const Omittable<EncryptedFile> &file = none);
@@ -160,7 +161,7 @@ namespace EventContent {
void fillInfoJson(QJsonObject* infoJson) const;
};
- class TypedBase : public Base {
+ class QUOTIENT_API TypedBase : public Base {
public:
virtual QMimeType type() const = 0;
virtual const FileInfo* fileInfo() const { return nullptr; }
@@ -183,7 +184,7 @@ namespace EventContent {
* \tparam InfoT base info class
*/
template <class InfoT>
- class UrlBasedContent : public TypedBase, public InfoT {
+ class QUOTIENT_API UrlBasedContent : public TypedBase, public InfoT {
public:
using InfoT::InfoT;
explicit UrlBasedContent(const QJsonObject& json)
@@ -215,7 +216,7 @@ namespace EventContent {
};
template <typename InfoT>
- class UrlWithThumbnailContent : public UrlBasedContent<InfoT> {
+ class QUOTIENT_API UrlWithThumbnailContent : public UrlBasedContent<InfoT> {
public:
// NB: when using inherited constructors, thumbnail has to be
// initialised separately
diff --git a/lib/events/reactionevent.h b/lib/events/reactionevent.h
index 5a2b98c4..ce11eaed 100644
--- a/lib/events/reactionevent.h
+++ b/lib/events/reactionevent.h
@@ -7,7 +7,7 @@
namespace Quotient {
-struct EventRelation {
+struct QUOTIENT_API EventRelation {
using reltypeid_t = const char*;
static constexpr reltypeid_t Reply() { return "m.in_reply_to"; }
static constexpr reltypeid_t Annotation() { return "m.annotation"; }
@@ -31,12 +31,12 @@ struct EventRelation {
}
};
template <>
-struct JsonObjectConverter<EventRelation> {
+struct QUOTIENT_API JsonObjectConverter<EventRelation> {
static void dumpTo(QJsonObject& jo, const EventRelation& pod);
static void fillFrom(const QJsonObject& jo, EventRelation& pod);
};
-class ReactionEvent : public RoomEvent {
+class QUOTIENT_API ReactionEvent : public RoomEvent {
public:
DEFINE_EVENT_TYPEID("m.reaction", ReactionEvent)
diff --git a/lib/events/receiptevent.h b/lib/events/receiptevent.h
index 9683deef..5e077e47 100644
--- a/lib/events/receiptevent.h
+++ b/lib/events/receiptevent.h
@@ -19,7 +19,7 @@ struct ReceiptsForEvent {
};
using EventsWithReceipts = QVector<ReceiptsForEvent>;
-class ReceiptEvent : public Event {
+class QUOTIENT_API ReceiptEvent : public Event {
public:
DEFINE_EVENT_TYPEID("m.receipt", ReceiptEvent)
explicit ReceiptEvent(const EventsWithReceipts& ewrs);
diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h
index 8618ba31..c54b5801 100644
--- a/lib/events/roomavatarevent.h
+++ b/lib/events/roomavatarevent.h
@@ -7,7 +7,8 @@
#include "stateevent.h"
namespace Quotient {
-class RoomAvatarEvent : public StateEvent<EventContent::ImageContent> {
+class QUOTIENT_API RoomAvatarEvent
+ : public StateEvent<EventContent::ImageContent> {
// It's a bit of an overkill to use a full-fledged ImageContent
// because in reality m.room.avatar usually only has a single URL,
// without a thumbnail. But The Spec says there be thumbnails, and
diff --git a/lib/events/roomcreateevent.h b/lib/events/roomcreateevent.h
index b3ad287c..016855b9 100644
--- a/lib/events/roomcreateevent.h
+++ b/lib/events/roomcreateevent.h
@@ -7,7 +7,7 @@
#include "quotient_common.h"
namespace Quotient {
-class RoomCreateEvent : public StateEventBase {
+class QUOTIENT_API RoomCreateEvent : public StateEventBase {
public:
DEFINE_EVENT_TYPEID("m.room.create", RoomCreateEvent)
diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h
index 8be58481..3fbb247e 100644
--- a/lib/events/roomevent.h
+++ b/lib/events/roomevent.h
@@ -11,7 +11,7 @@ namespace Quotient {
class RedactionEvent;
/** This class corresponds to m.room.* events */
-class RoomEvent : public Event {
+class QUOTIENT_API RoomEvent : public Event {
public:
static inline _impl::EventFactory<RoomEvent> factory { "RoomEvent" };
@@ -70,7 +70,7 @@ using RoomEventPtr = event_ptr_tt<RoomEvent>;
using RoomEvents = EventsArray<RoomEvent>;
using RoomEventsRange = Range<RoomEvents>;
-class CallEventBase : public RoomEvent {
+class QUOTIENT_API CallEventBase : public RoomEvent {
public:
CallEventBase(Type type, event_mtype_t matrixType, const QString& callId,
int version, const QJsonObject& contentJson = {});
diff --git a/lib/events/roomkeyevent.h b/lib/events/roomkeyevent.h
index d021fbec..c4df7936 100644
--- a/lib/events/roomkeyevent.h
+++ b/lib/events/roomkeyevent.h
@@ -6,7 +6,7 @@
#include "event.h"
namespace Quotient {
-class RoomKeyEvent : public Event
+class QUOTIENT_API RoomKeyEvent : public Event
{
public:
DEFINE_EVENT_TYPEID("m.room_key", RoomKeyEvent)
diff --git a/lib/events/roommemberevent.h b/lib/events/roommemberevent.h
index 0fb464d4..5e446dbe 100644
--- a/lib/events/roommemberevent.h
+++ b/lib/events/roommemberevent.h
@@ -10,7 +10,7 @@
#include "quotient_common.h"
namespace Quotient {
-class MemberEventContent : public EventContent::Base {
+class QUOTIENT_API MemberEventContent : public EventContent::Base {
public:
using MembershipType
[[deprecated("Use Quotient::Membership instead")]] = Membership;
@@ -33,7 +33,7 @@ protected:
using MembershipType [[deprecated("Use Membership instead")]] = Membership;
-class RoomMemberEvent : public StateEvent<MemberEventContent> {
+class QUOTIENT_API RoomMemberEvent : public StateEvent<MemberEventContent> {
Q_GADGET
public:
DEFINE_EVENT_TYPEID("m.room.member", RoomMemberEvent)
@@ -95,6 +95,5 @@ doLoadEvent<RoomMemberEvent>(const QJsonObject& json, const QString& matrixType)
return makeEvent<RoomMemberEvent>(json);
return makeEvent<RoomMemberEvent>(unknownEventTypeId(), json);
}
-
REGISTER_EVENT_TYPE(RoomMemberEvent)
} // namespace Quotient
diff --git a/lib/events/roommessageevent.h b/lib/events/roommessageevent.h
index 56597ddc..0c901b7a 100644
--- a/lib/events/roommessageevent.h
+++ b/lib/events/roommessageevent.h
@@ -16,7 +16,7 @@ namespace MessageEventContent = EventContent; // Back-compatibility
/**
* The event class corresponding to m.room.message events
*/
-class RoomMessageEvent : public RoomEvent {
+class QUOTIENT_API RoomMessageEvent : public RoomEvent {
Q_GADGET
public:
DEFINE_EVENT_TYPEID("m.room.message", RoomMessageEvent)
@@ -120,7 +120,7 @@ namespace EventContent {
* Available fields: mimeType, body. The body can be either rich text
* or plain text, depending on what mimeType specifies.
*/
- class TextContent : public TypedBase {
+ class QUOTIENT_API TextContent : public TypedBase {
public:
TextContent(QString text, const QString& contentType,
Omittable<RelatesTo> relatesTo = none);
@@ -149,7 +149,7 @@ namespace EventContent {
* - thumbnail.mimeType
* - thumbnail.imageSize
*/
- class LocationContent : public TypedBase {
+ class QUOTIENT_API LocationContent : public TypedBase {
public:
LocationContent(const QString& geoUri, const Thumbnail& thumbnail = {});
explicit LocationContent(const QJsonObject& json);
@@ -168,7 +168,7 @@ namespace EventContent {
* A base class for info types that include duration: audio and video
*/
template <typename ContentT>
- class PlayableContent : public ContentT {
+ class QUOTIENT_API PlayableContent : public ContentT {
public:
using ContentT::ContentT;
PlayableContent(const QJsonObject& json)
diff --git a/lib/events/roompowerlevelsevent.h b/lib/events/roompowerlevelsevent.h
index 0346fc0d..80e27048 100644
--- a/lib/events/roompowerlevelsevent.h
+++ b/lib/events/roompowerlevelsevent.h
@@ -7,7 +7,7 @@
#include "stateevent.h"
namespace Quotient {
-class PowerLevelsEventContent : public EventContent::Base {
+class QUOTIENT_API PowerLevelsEventContent : public EventContent::Base {
public:
struct Notifications {
int room;
@@ -34,7 +34,8 @@ protected:
void fillJson(QJsonObject* o) const override;
};
-class RoomPowerLevelsEvent : public StateEvent<PowerLevelsEventContent> {
+class QUOTIENT_API RoomPowerLevelsEvent
+ : public StateEvent<PowerLevelsEventContent> {
Q_GADGET
public:
DEFINE_EVENT_TYPEID("m.room.power_levels", RoomPowerLevelsEvent)
@@ -61,9 +62,6 @@ public:
int powerLevelForEvent(const QString& eventId) const;
int powerLevelForState(const QString& eventId) const;
int powerLevelForUser(const QString& userId) const;
-
-private:
};
-
REGISTER_EVENT_TYPE(RoomPowerLevelsEvent)
} // namespace Quotient
diff --git a/lib/events/roomtombstoneevent.h b/lib/events/roomtombstoneevent.h
index 30e53738..e336c448 100644
--- a/lib/events/roomtombstoneevent.h
+++ b/lib/events/roomtombstoneevent.h
@@ -6,7 +6,7 @@
#include "stateevent.h"
namespace Quotient {
-class RoomTombstoneEvent : public StateEventBase {
+class QUOTIENT_API RoomTombstoneEvent : public StateEventBase {
public:
DEFINE_EVENT_TYPEID("m.room.tombstone", RoomTombstoneEvent)
diff --git a/lib/events/simplestateevents.h b/lib/events/simplestateevents.h
index 9ce78609..d6557012 100644
--- a/lib/events/simplestateevents.h
+++ b/lib/events/simplestateevents.h
@@ -30,7 +30,8 @@ namespace EventContent {
} // namespace EventContent
#define DEFINE_SIMPLE_STATE_EVENT(_Name, _TypeId, _ValueType, _ContentKey) \
- class _Name : public StateEvent<EventContent::SimpleContent<_ValueType>> { \
+ class QUOTIENT_API _Name \
+ : public StateEvent<EventContent::SimpleContent<_ValueType>> { \
public: \
using value_type = content_type::value_type; \
DEFINE_EVENT_TYPEID(_TypeId, _Name) \
diff --git a/lib/events/stateevent.h b/lib/events/stateevent.h
index c37965aa..6095d628 100644
--- a/lib/events/stateevent.h
+++ b/lib/events/stateevent.h
@@ -17,7 +17,7 @@ inline QJsonObject basicStateEventJson(const QString& matrixTypeId,
{ ContentKey, content } };
}
-class StateEventBase : public RoomEvent {
+class QUOTIENT_API StateEventBase : public RoomEvent {
public:
static inline _impl::EventFactory<StateEventBase> factory { "StateEvent" };
diff --git a/lib/events/stickerevent.h b/lib/events/stickerevent.h
index 93671086..0957dca3 100644
--- a/lib/events/stickerevent.h
+++ b/lib/events/stickerevent.h
@@ -11,7 +11,7 @@ namespace Quotient {
/// Sticker messages are specialised image messages that are displayed without
/// controls (e.g. no "download" link, or light-box view on click, as would be
/// displayed for for m.image events).
-class StickerEvent : public RoomEvent
+class QUOTIENT_API StickerEvent : public RoomEvent
{
public:
DEFINE_EVENT_TYPEID("m.sticker", StickerEvent)
diff --git a/lib/events/typingevent.h b/lib/events/typingevent.h
index 7456100a..522f7e42 100644
--- a/lib/events/typingevent.h
+++ b/lib/events/typingevent.h
@@ -6,7 +6,7 @@
#include "event.h"
namespace Quotient {
-class TypingEvent : public Event {
+class QUOTIENT_API TypingEvent : public Event {
public:
DEFINE_EVENT_TYPEID("m.typing", TypingEvent)