1 | // SPDX-FileCopyrightText: 2021 Kitsune Ral <kitsune-ral@users.sf.net> |
---|---|
2 | // SPDX-License-Identifier: LGPL-2.1-or-later |
3 | |
4 | #include "roomstateview.h" |
5 | |
6 | using namespace Quotient; |
7 | |
8 | const StateEvent* RoomStateView::get(const QString& evtType, |
9 | const QString& stateKey) const |
10 | { |
11 | return value(key: { evtType, stateKey }); |
12 | } |
13 | |
14 | bool RoomStateView::contains(const QString& evtType, |
15 | const QString& stateKey) const |
16 | { |
17 | return contains(key: { evtType, stateKey }); |
18 | } |
19 | |
20 | QJsonObject RoomStateView::contentJson(const QString& evtType, |
21 | const QString& stateKey) const |
22 | { |
23 | return queryOr(evtType, stateKey, fn: &Event::contentJson, fallback: QJsonObject()); |
24 | } |
25 | |
26 | const QVector<const StateEvent*> RoomStateView::eventsOfType( |
27 | const QString& evtType) const |
28 | { |
29 | auto vals = QVector<const StateEvent*>(); |
30 | for (auto it = cbegin(); it != cend(); ++it) |
31 | if (it.key().first == evtType) |
32 | vals.append(t: it.value()); |
33 | |
34 | return vals; |
35 | } |
36 |