diff options
Diffstat (limited to 'src/EventAccessors.cpp')
-rw-r--r-- | src/EventAccessors.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/EventAccessors.cpp b/src/EventAccessors.cpp index 212c2970..e6bc61b0 100644 --- a/src/EventAccessors.cpp +++ b/src/EventAccessors.cpp @@ -34,6 +34,20 @@ struct detector<Default, std::void_t<Op<Args...>>, Op, Args...> template<template<class...> class Op, class... Args> using is_detected = typename detail::detector<nonesuch, void, Op, Args...>::value_t; +struct IsStateEvent +{ + template<class T> + bool operator()(const mtx::events::StateEvent<T> &) + { + return true; + } + template<class T> + bool operator()(const mtx::events::Event<T> &) + { + return false; + } +}; + struct EventMsgType { template<class E> @@ -476,3 +490,9 @@ mtx::accessors::serialize_event(const mtx::events::collections::TimelineEvents & { return std::visit([](const auto &e) { return nlohmann::json(e); }, event); } + +bool +mtx::accessors::is_state_event(const mtx::events::collections::TimelineEvents &event) +{ + return std::visit(IsStateEvent{}, event); +} |