aboutsummaryrefslogtreecommitdiff
path: root/events/simplestateevents.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-03-31 13:20:52 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-03-31 13:20:52 +0900
commit44764f015f25db307811f2969c117b37133fc676 (patch)
treee3d1a5c79886336c07fe5d9e5114d3b8d6fe6043 /events/simplestateevents.h
parenta95618af600c8c72c15ece48682ee6260de27aff (diff)
parente7868adbf5b275f66529fb2dae323ed8aeb69e05 (diff)
downloadlibquotient-44764f015f25db307811f2969c117b37133fc676.tar.gz
libquotient-44764f015f25db307811f2969c117b37133fc676.zip
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'events/simplestateevents.h')
-rw-r--r--events/simplestateevents.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/events/simplestateevents.h b/events/simplestateevents.h
index d5841bdc..6b0cd51a 100644
--- a/events/simplestateevents.h
+++ b/events/simplestateevents.h
@@ -19,36 +19,35 @@
#pragma once
#include "event.h"
-
#include "eventcontent.h"
namespace QMatrixClient
{
-#define DECLARE_SIMPLE_STATE_EVENT(_Name, _TypeId, _EnumType, _ContentType, _ContentKey) \
+#define DEFINE_SIMPLE_STATE_EVENT(_Name, _TypeId, _EnumType, _ContentType, _ContentKey) \
class _Name \
: public StateEvent<EventContent::SimpleContent<_ContentType>> \
{ \
public: \
static constexpr const char* TypeId = _TypeId; \
explicit _Name(const QJsonObject& obj) \
- : StateEvent(_EnumType, obj, #_ContentKey) \
+ : StateEvent(_EnumType, obj, QStringLiteral(#_ContentKey)) \
{ } \
template <typename T> \
explicit _Name(T&& value) \
- : StateEvent(_EnumType, #_ContentKey, \
+ : StateEvent(_EnumType, QStringLiteral(#_ContentKey), \
std::forward<T>(value)) \
{ } \
- _ContentType _ContentKey() const { return content().value; } \
+ const _ContentType& _ContentKey() const { return content().value; } \
};
- DECLARE_SIMPLE_STATE_EVENT(RoomNameEvent, "m.room.name",
- Event::Type::RoomName, QString, name)
- DECLARE_SIMPLE_STATE_EVENT(RoomAliasesEvent, "m.room.aliases",
- Event::Type::RoomAliases, QStringList, aliases)
- DECLARE_SIMPLE_STATE_EVENT(RoomCanonicalAliasEvent, "m.room.canonical_alias",
- Event::Type::RoomCanonicalAlias, QString, alias)
- DECLARE_SIMPLE_STATE_EVENT(RoomTopicEvent, "m.room.topic",
- Event::Type::RoomTopic, QString, topic)
- DECLARE_SIMPLE_STATE_EVENT(EncryptionEvent, "m.room.encryption",
- Event::Type::RoomEncryption, QString, algorithm)
+ DEFINE_SIMPLE_STATE_EVENT(RoomNameEvent, "m.room.name",
+ Event::Type::RoomName, QString, name)
+ DEFINE_SIMPLE_STATE_EVENT(RoomAliasesEvent, "m.room.aliases",
+ Event::Type::RoomAliases, QStringList, aliases)
+ DEFINE_SIMPLE_STATE_EVENT(RoomCanonicalAliasEvent, "m.room.canonical_alias",
+ Event::Type::RoomCanonicalAlias, QString, alias)
+ DEFINE_SIMPLE_STATE_EVENT(RoomTopicEvent, "m.room.topic",
+ Event::Type::RoomTopic, QString, topic)
+ DEFINE_SIMPLE_STATE_EVENT(EncryptionEvent, "m.room.encryption",
+ Event::Type::RoomEncryption, QString, algorithm)
} // namespace QMatrixClient