aboutsummaryrefslogtreecommitdiff
path: root/lib/events/simplestateevents.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-22 10:50:39 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-22 10:50:39 +0900
commit02872ea0cf6dccabb55b38a33fc5ad67f183254b (patch)
tree035b6c8ba9aa2796c0ef8a797a536d953560d05d /lib/events/simplestateevents.h
parente48c5db65cb078c8ee84fd617441a78247671dad (diff)
parent1e273212eca1dfa294d1a4bb9271261bf5671aa3 (diff)
downloadlibquotient-02872ea0cf6dccabb55b38a33fc5ad67f183254b.tar.gz
libquotient-02872ea0cf6dccabb55b38a33fc5ad67f183254b.zip
Merge remote-tracking branch 'remotes/origin/kitsune-simpler-simple-content'
Diffstat (limited to 'lib/events/simplestateevents.h')
-rw-r--r--lib/events/simplestateevents.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/events/simplestateevents.h b/lib/events/simplestateevents.h
index 5aa24c15..2c23d9ca 100644
--- a/lib/events/simplestateevents.h
+++ b/lib/events/simplestateevents.h
@@ -19,7 +19,6 @@
#pragma once
#include "stateevent.h"
-#include "eventcontent.h"
#include "converters.h"
@@ -28,7 +27,7 @@ namespace QMatrixClient
namespace EventContent
{
template <typename T>
- class SimpleContent: public Base
+ class SimpleContent
{
public:
using value_type = T;
@@ -39,23 +38,19 @@ namespace QMatrixClient
: value(std::forward<TT>(value)), key(std::move(keyName))
{ }
SimpleContent(const QJsonObject& json, QString keyName)
- : Base(json)
- , value(QMatrixClient::fromJson<T>(json[keyName]))
+ : value(fromJson<T>(json[keyName]))
, key(std::move(keyName))
{ }
+ QJsonObject toJson() const
+ {
+ return { { key, QMatrixClient::toJson(value) } };
+ }
public:
T value;
protected:
QString key;
-
- private:
- void fillJson(QJsonObject* json) const override
- {
- Q_ASSERT(json);
- json->insert(key, QMatrixClient::toJson(value));
- }
};
} // namespace EventContent