aboutsummaryrefslogtreecommitdiff
path: root/lib/events/eventloader.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-09-05 07:49:16 +0200
committerGitHub <noreply@github.com>2022-09-05 07:49:16 +0200
commit1e263a32fcbc44985e474a626393494a81f15e37 (patch)
tree8811e0a995dcd593cb9f233e02ece9402e76eb1b /lib/events/eventloader.h
parent8cb629f406f5b8b1ff7ce787dd3967d5684e07c3 (diff)
parentbd2736bc9f8b6023ecbc21d0d831856703b853db (diff)
downloadlibquotient-1e263a32fcbc44985e474a626393494a81f15e37.tar.gz
libquotient-1e263a32fcbc44985e474a626393494a81f15e37.zip
Merge pull request #565 from quotient-im/kitsune/streamline-event-types-2
Streamline event types, part 2
Diffstat (limited to 'lib/events/eventloader.h')
-rw-r--r--lib/events/eventloader.h40
1 files changed, 4 insertions, 36 deletions
diff --git a/lib/events/eventloader.h b/lib/events/eventloader.h
index 4c639efa..b4ac154c 100644
--- a/lib/events/eventloader.h
+++ b/lib/events/eventloader.h
@@ -6,40 +6,8 @@
#include "stateevent.h"
namespace Quotient {
-
-/*! Create an event with proper type from a JSON object
- *
- * Use this factory template to detect the type from the JSON object
- * contents (the detected event type should derive from the template
- * parameter type) and create an event object of that type.
- */
-template <typename BaseEventT>
-inline event_ptr_tt<BaseEventT> loadEvent(const QJsonObject& fullJson)
-{
- return doLoadEvent<BaseEventT>(fullJson, fullJson[TypeKeyL].toString());
-}
-
-//! \brief Create an event from a type string and content JSON
-//!
-//! Use this template to resolve the C++ type from the Matrix type string in
-//! \p matrixType and create an event of that type by passing all parameters
-//! to BaseEventT::basicJson().
-template <typename BaseEventT, typename... BasicJsonParamTs>
-inline event_ptr_tt<BaseEventT> loadEvent(
- const QString& matrixType, const BasicJsonParamTs&... basicJsonParams)
-{
- return doLoadEvent<BaseEventT>(
- BaseEventT::basicJson(matrixType, basicJsonParams...), matrixType);
+struct [[deprecated(
+ "This header is obsolete since libQuotient 0.7; include a header with"
+ " the respective event type definition instead")]] EventLoaderH;
+StateEventPtr eventLoaderH(EventLoaderH&);
}
-
-template <typename EventT>
-struct JsonConverter<event_ptr_tt<EventT>>
- : JsonObjectUnpacker<event_ptr_tt<EventT>> {
- using JsonObjectUnpacker<event_ptr_tt<EventT>>::load;
- static auto load(const QJsonObject& jo)
- {
- return loadEvent<EventT>(jo);
- }
-};
-
-} // namespace Quotient