aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-03-04 18:44:47 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-03-05 10:23:18 +0900
commit089a23093dd8e73b4e1e5b1a2aa3935028066faa (patch)
treeccca0041bbee8ef40c593f22528234f18e523e98
parentff85bba352ee23d6e2689804da40a9433a117e71 (diff)
downloadlibquotient-089a23093dd8e73b4e1e5b1a2aa3935028066faa.tar.gz
libquotient-089a23093dd8e73b4e1e5b1a2aa3935028066faa.zip
simplestateevents.h: minor tweaks
-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