aboutsummaryrefslogtreecommitdiff
path: root/lib/qt_connection_util.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-01-23 17:11:45 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-01-23 17:12:44 +0100
commit8183a33c130f1284404edc61767ff6d29402d200 (patch)
tree98931d10c8a10cc6b1496ccbb3e46ef60bfc3d09 /lib/qt_connection_util.h
parent1215888438b901ad80e8bf9882cdcc6a3f057399 (diff)
downloadlibquotient-8183a33c130f1284404edc61767ff6d29402d200.tar.gz
libquotient-8183a33c130f1284404edc61767ff6d29402d200.zip
RoomStateView
This class is called to provide an arbitrary snapshot of a room state; as the first step, Room::currentState() returns an instance of this class that stores, well, the current state. Implelementation-wise it's the same hash map of two-part state event keys to const event pointers; however, RoomStateView provides additional operations: - get(), that deprecates Room::getCurrentState(), returns a pointer to a particular event if the current state has it. Unlike the original method, the pointer returned from this one can be nullptr; this is done to get rid of stubbed state events that have to be created everytime a "state miss" occurred (i.e., when getCurrentState() does not find an existing event in the current state). - eventsOfType() - this is a new place for Room::stateEventsOfType() introduced recently. - query() - this is a way to specify a piece of the state content that you need to retrieve by passing a member function or a function object that retrieves it. That is especially convenient with member functions of the event class; just pass the pointer to this member function, and query() will parse the event type it has to retrieve out of it and call that member function on the event object. Returns an Omittable<>; if the respective piece of state doesn't exist, you'll get `Quotient::none` (the same as `std::nullopt`). - queryOr() - the same but with the fallback value; instead of an Omittable<>, the fallback value will be returned if the needed event is not found.
Diffstat (limited to 'lib/qt_connection_util.h')
0 files changed, 0 insertions, 0 deletions