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. More... | |
template<Keyed_State_Event EvT> | |
const EvT * | get (const QString &stateKey={}) const |
Get a state event with the given event type and state key. More... | |
template<Keyless_State_Event EvT> | |
const EvT * | get () const |
Get a state event with the given event type. More... | |
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. More... | |
const QVector< const StateEvent * > | eventsOfType (const QString &evtType) const |
Get all state events in the room of a certain type. More... | |
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. More... | |
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. More... | |
template<Keyless_State_Fn FnT> | |
auto | query (FnT &&fn) const |
Run a function on a keyless state event with the given type. More... | |
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. More... | |
template<typename FnT , typename FallbackT > | |
auto | queryOr (const QString &stateKey, FnT &&fn, FallbackT &&fallback) const |
Same as query() but with a fallback value. More... | |
template<typename FnT , typename FallbackT > | |
auto | queryOr (FnT &&fn, FallbackT &&fallback) const |
Same as query() but with a fallback value. More... | |
Friends | |
class | Room |
Definition at line 24 of file roomstateview.h.
|
inline |
Definition at line 87 of file roomstateview.h.
bool Quotient::RoomStateView::contains | ( | const QString & | evtType, |
const QString & | stateKey = {} |
||
) | const |
|
inline |
Definition at line 81 of file roomstateview.h.
|
inline |
Definition at line 93 of file roomstateview.h.
|
inline |
Definition at line 104 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 28 of file roomstateview.h.
const QVector<const StateEvent*> Quotient::RoomStateView::eventsOfType | ( | const QString & | evtType | ) | const |
Get all state events in the room of a certain type.
This method returns all known state events that have occured in the room of the given type.
|
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 67 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 51 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 133 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 145 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 158 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 172 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 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 201 of file roomstateview.h.
|
friend |
Definition at line 208 of file roomstateview.h.