@@ -50,11 +50,11 @@ class QUOTIENT_API RoomStateView
50
50
template <Keyed_State_Event EvT>
51
51
const EvT* get (const QString& stateKey = {}) const
52
52
{
53
- if ( const auto * evt = get ( EvT::TypeId, stateKey)) {
54
- Q_ASSERT ( evt-> matrixType () == EvT::TypeId
55
- && evt->stateKey () == stateKey);
56
- return eventCast<const EvT>(evt);
57
- }
53
+ for ( auto typeId : EvT::MetaType. matrixIds )
54
+ if ( const auto * evt = get (typeId, stateKey)) {
55
+ Q_ASSERT (evt-> matrixType () == typeId && evt->stateKey () == stateKey);
56
+ return eventCast<const EvT>(evt);
57
+ }
58
58
return nullptr ;
59
59
}
60
60
@@ -66,10 +66,11 @@ class QUOTIENT_API RoomStateView
66
66
template <Keyless_State_Event EvT>
67
67
const EvT* get () const
68
68
{
69
- if (const auto * evt = get (EvT::TypeId)) {
70
- Q_ASSERT (evt->matrixType () == EvT::TypeId);
71
- return eventCast<const EvT>(evt);
72
- }
69
+ for (auto typeId : EvT::MetaType.matrixIds )
70
+ if (const auto *evt = get (typeId)) {
71
+ Q_ASSERT (evt->matrixType () == typeId);
72
+ return eventCast<const EvT>(evt);
73
+ }
73
74
return nullptr ;
74
75
}
75
76
@@ -80,20 +81,23 @@ class QUOTIENT_API RoomStateView
80
81
template <Keyed_State_Event EvT>
81
82
bool contains (const QString& stateKey = {}) const
82
83
{
83
- return contains (EvT::TypeId, stateKey);
84
+ return std::ranges::any_of (EvT::MetaType.matrixIds , [this , &stateKey](event_type_t typeId) {
85
+ return contains (typeId, stateKey);
86
+ });
84
87
}
85
88
86
89
template <Keyless_State_Event EvT>
87
90
bool contains () const
88
91
{
89
- return contains (EvT::TypeId);
92
+ return std::ranges::any_of (EvT::MetaType.matrixIds ,
93
+ [this ](event_type_t typeId) { return contains (typeId); });
90
94
}
91
95
92
96
template <Keyed_State_Event EvT>
93
97
auto content (const QString& stateKey,
94
98
typename EvT::content_type defaultValue = {}) const
95
99
{
96
- // EventBase <>::content is special in that it returns a const-ref,
100
+ // EventTemplate <>::content for StateEvent is special in that it returns a const-ref,
97
101
// and lift() inside queryOr() can't wrap that in a temporary optional.
98
102
if (const auto evt = get<EvT>(stateKey))
99
103
return evt->content ();
0 commit comments