diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-11-14 07:14:45 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-11-14 21:55:51 +0900 |
commit | 7ce14ccedc7a5239396e7662da1b2ba45195c271 (patch) | |
tree | e5f254246b73eef320bf426a4f45b2a341fd9b27 /lib/events/simplestateevents.h | |
parent | 2a72a0ad0f8b4a0d24c9c2262917ff658ca5fec4 (diff) | |
download | libquotient-7ce14ccedc7a5239396e7662da1b2ba45195c271.tar.gz libquotient-7ce14ccedc7a5239396e7662da1b2ba45195c271.zip |
DEFINE_SIMPLE_STATE_EVENT: Add default constructor
...that creates an "empty" event, i.e. an event with content initialised by a default constructor (not all content types support this but those for simple events do).
Diffstat (limited to 'lib/events/simplestateevents.h')
-rw-r--r-- | lib/events/simplestateevents.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/events/simplestateevents.h b/lib/events/simplestateevents.h index 3a59ad6d..5aa24c15 100644 --- a/lib/events/simplestateevents.h +++ b/lib/events/simplestateevents.h @@ -65,16 +65,17 @@ namespace QMatrixClient public: \ using value_type = content_type::value_type; \ DEFINE_EVENT_TYPEID(_TypeId, _Name) \ - explicit _Name(QJsonObject obj) \ - : StateEvent(typeId(), std::move(obj), \ - QStringLiteral(#_ContentKey)) \ - { } \ + explicit _Name() : _Name(value_type()) { } \ template <typename T> \ explicit _Name(T&& value) \ : StateEvent(typeId(), matrixTypeId(), \ QStringLiteral(#_ContentKey), \ std::forward<T>(value)) \ { } \ + explicit _Name(QJsonObject obj) \ + : StateEvent(typeId(), std::move(obj), \ + QStringLiteral(#_ContentKey)) \ + { } \ auto _ContentKey() const { return content().value; } \ }; \ REGISTER_EVENT_TYPE(_Name) \ |