![]() |
libQuotient
A Qt library for building matrix clients
|
#include <roomstateview.h>


Public Member Functions | |
| const QHash< StateEventKey, const StateEvent * > & | events () const |
| const StateEvent * | get (const QString &evtType, const QString &stateKey={}) const |
| Get a state event with the given event type and state key. | |
| template<Keyed_State_Event EvT> | |
| const EvT * | get (const QString &stateKey={}) const |
| Get a state event with the given event type and state key. | |
| template<Keyless_State_Event EvT> | |
| const EvT * | get () const |
| Get a state event with the given event type. | |
| bool | contains (const QString &evtType, const QString &stateKey={}) const |
| template<Keyed_State_Event EvT> | |
| bool | contains (const QString &stateKey={}) const |
| template<Keyless_State_Event EvT> | |
| bool | contains () const |
| template<Keyed_State_Event EvT> | |
| auto | content (const QString &stateKey, typename EvT::content_type defaultValue={}) const |
| template<Keyless_State_Event EvT> | |
| auto | content (typename EvT::content_type defaultValue={}) const |
| Q_INVOKABLE QJsonObject | contentJson (const QString &evtType, const QString &stateKey={}) const |
| Get the content of the current state event with the given event type and state key. | |
| QVector< const StateEvent * > | eventsOfType (const QString &evtType) const |
| Get all state events in the room of a certain type. | |
| template<Keyed_State_Event EvT> | |
| QVector< const EvT * > | eventsOfType () const |
| Get all state events in the room of a certain type. | |
| template<typename FnT > | |
| auto | query (const QString &evtType, const QString &stateKey, FnT &&fn) const |
| Run a function on a state event with the given type and key. | |
| template<Keyed_State_Fn FnT> | |
| auto | query (const QString &stateKey, FnT &&fn) const |
| Run a function on a state event with the given type and key. | |
| template<Keyless_State_Fn FnT> | |
| auto | query (FnT &&fn) const |
| Run a function on a keyless state event with the given type. | |
| template<Keyed_State_Fn FnT> | |
| void | queryAll (FnT &&fn) const |
| Run a function on each event of the given type. | |
| template<typename FnT , typename FallbackT > | |
| auto | queryOr (const QString &evtType, const QString &stateKey, FnT &&fn, FallbackT &&fallback) const |
| Same as query() but with a fallback value. | |
| template<typename FnT , typename FallbackT > | |
| auto | queryOr (const QString &stateKey, FnT &&fn, FallbackT &&fallback) const |
| Same as query() but with a fallback value. | |
| template<typename FnT , typename FallbackT > | |
| auto | queryOr (FnT &&fn, FallbackT &&fallback) const |
| Same as query() but with a fallback value. | |
Friends | |
| class | Room |
Definition at line 25 of file roomstateview.h.
|
inline |
Definition at line 88 of file roomstateview.h.
| bool Quotient::RoomStateView::contains | ( | const QString & | evtType, |
| const QString & | stateKey = {} |
||
| ) | const |
|
inline |
Definition at line 82 of file roomstateview.h.
|
inline |
Definition at line 94 of file roomstateview.h.
|
inline |
Definition at line 105 of file roomstateview.h.
| Q_INVOKABLE QJsonObject Quotient::RoomStateView::contentJson | ( | const QString & | evtType, |
| const QString & | stateKey = {} |
||
| ) | const |
Get the content of the current state event with the given event type and state key.
'content' object otherwise
|
inline |
Definition at line 29 of file roomstateview.h.
|
inline |
Get all state events in the room of a certain type.
This is a type-safe overload for the case when the event type is known at compile time.
EvT that have occurred in the room Definition at line 137 of file roomstateview.h.
| QVector< const StateEvent * > Quotient::RoomStateView::eventsOfType | ( | const QString & | evtType | ) | const |
Get all state events in the room of a certain type.
This function allows to retrieve all events of one type regardless of their state key.
evtType that have occurred in the room
|
inline |
Get a state event with the given event type.
This is a typesafe overload that accepts a C++ event type instead of its Matrix name. This overload only defined for events that do not use state key (i.e., derived from KeylessStateEvent).
Definition at line 68 of file roomstateview.h.
| const StateEvent * Quotient::RoomStateView::get | ( | const QString & | evtType, |
| const QString & | stateKey = {} |
||
| ) | const |
Get a state event with the given event type and state key.
evtType and state key stateKey, or nullptr if there's no such evtType / stateKey combination in the current state. nullptr; you MUST check it before using or use other methods of this class such as query() and content() to access state safely.
|
inline |
Get a state event with the given event type and state key.
This is a typesafe overload that accepts a C++ event type instead of its Matrix name. It is only defined for events with state key (i.e., derived from KeyedStateEvent).
Definition at line 52 of file roomstateview.h.
|
inline |
Run a function on a state event with the given type and key.
Use this overload when there's no predefined event type or the event type is unknown at compile time.
fn fails Definition at line 151 of file roomstateview.h.
|
inline |
Run a function on a state event with the given type and key.
This is an overload for keyed state events (those that have needsStateKey == true) with type defined at compile time.
fn fails Definition at line 163 of file roomstateview.h.
|
inline |
Run a function on a keyless state event with the given type.
This is an overload for keyless state events (those having needsStateKey == false) with type defined at compile time.
fn fails Definition at line 176 of file roomstateview.h.
|
inline |
Run a function on each event of the given type.
This is effectively a combination of query and eventsOfType() except that it doesn't create a new container. The return value of FnT is ignored.
Definition at line 187 of file roomstateview.h.
|
inline |
Same as query() but with a fallback value.
This is a shortcut for query().value_or(), passing respective arguments to the respective functions. This is an overload for the case when the event type cannot be fixed at compile time.
fn execution, or fallback if the requested event doesn't exist or the function fails Definition at line 202 of file roomstateview.h.
|
inline |
Same as query() but with a fallback value.
This is a shortcut for query().value_or(), passing respective arguments to the respective functions. This is an overload for the case when the event type cannot be fixed at compile time.
fn execution, or fallback if the requested event doesn't exist or the function fails Definition at line 217 of file roomstateview.h.
|
inline |
Same as query() but with a fallback value.
This is a shortcut for query().value_or(), passing respective arguments to the respective functions. This is an overload for the case when the event type cannot be fixed at compile time.
fn execution, or fallback if the requested event doesn't exist or the function fails Definition at line 231 of file roomstateview.h.
|
friend |
Definition at line 238 of file roomstateview.h.