aboutsummaryrefslogtreecommitdiff
path: root/lib/events
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events')
-rw-r--r--lib/events/encryptionevent.h2
-rw-r--r--lib/events/event.h23
-rw-r--r--lib/events/roommemberevent.h2
-rw-r--r--lib/events/roommessageevent.h2
4 files changed, 14 insertions, 15 deletions
diff --git a/lib/events/encryptionevent.h b/lib/events/encryptionevent.h
index 7bbcc418..cbd3ba4a 100644
--- a/lib/events/encryptionevent.h
+++ b/lib/events/encryptionevent.h
@@ -66,7 +66,7 @@ public:
int rotationPeriodMsgs() const { return content().rotationPeriodMsgs; }
private:
- REGISTER_ENUM(EncryptionType)
+ Q_ENUM(EncryptionType)
};
REGISTER_EVENT_TYPE(EncryptionEvent)
diff --git a/lib/events/event.h b/lib/events/event.h
index d9c8e088..25362786 100644
--- a/lib/events/event.h
+++ b/lib/events/event.h
@@ -47,11 +47,10 @@ inline TargetEventT* weakPtrCast(const event_ptr_tt<EventT>& ptr)
/// Re-wrap a smart pointer to base into a smart pointer to derived
template <typename TargetT, typename SourceT>
-[[deprecated("Consider using eventCast() or visit() "
- "instead")]] inline event_ptr_tt<TargetT>
-ptrCast(event_ptr_tt<SourceT>&& ptr)
+[[deprecated("Consider using eventCast() or visit() instead")]]
+inline event_ptr_tt<TargetT> ptrCast(event_ptr_tt<SourceT>&& ptr)
{
- return unique_ptr_cast<TargetT>(ptr);
+ return std::unique_ptr<TargetT>(static_cast<TargetT*>(ptr.release()));
}
// === Standard Matrix key names and basicEventJson() ===
@@ -290,19 +289,19 @@ 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 constexpr event_mtype_t matrixTypeId() { return _Id; } \
+ static 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) \
- namespace { \
- [[gnu::unused]] static const auto _factoryAdded##_Type = \
- registerEventType<_Type>(); \
- } \
+#define REGISTER_EVENT_TYPE(_Type) \
+ namespace { \
+ [[maybe_unused]] static const auto _factoryAdded##_Type = \
+ registerEventType<_Type>(); \
+ } \
// End of macro
// === is<>(), eventCast<>() and visit<>() ===
diff --git a/lib/events/roommemberevent.h b/lib/events/roommemberevent.h
index 43aaa8be..6a34fd7f 100644
--- a/lib/events/roommemberevent.h
+++ b/lib/events/roommemberevent.h
@@ -92,7 +92,7 @@ public:
bool isAvatarUpdate() const;
private:
- REGISTER_ENUM(MembershipType)
+ Q_ENUM(MembershipType)
};
template <>
diff --git a/lib/events/roommessageevent.h b/lib/events/roommessageevent.h
index d0dbbfb3..b393382a 100644
--- a/lib/events/roommessageevent.h
+++ b/lib/events/roommessageevent.h
@@ -87,7 +87,7 @@ private:
const QString& jsonMsgType,
EventContent::TypedBase* content);
- REGISTER_ENUM(MsgType)
+ Q_ENUM(MsgType)
};
REGISTER_EVENT_TYPE(RoomMessageEvent)
using MessageEventType = RoomMessageEvent::MsgType;