File: roomstateview.cpp

package info (click to toggle)
libquotient 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,588 kB
  • sloc: xml: 39,103; cpp: 25,226; sh: 97; makefile: 10
file content (35 lines) | stat: -rw-r--r-- 1,012 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: 2021 Kitsune Ral <kitsune-ral@users.sf.net>
// SPDX-License-Identifier: LGPL-2.1-or-later

#include "roomstateview.h"

using namespace Quotient;

const StateEvent* RoomStateView::get(const QString& evtType,
                                     const QString& stateKey) const
{
    return value({ evtType, stateKey });
}

bool RoomStateView::contains(const QString& evtType,
                             const QString& stateKey) const
{
    return contains({ evtType, stateKey });
}

QJsonObject RoomStateView::contentJson(const QString& evtType,
                                       const QString& stateKey) const
{
    return queryOr(evtType, stateKey, &Event::contentJson, QJsonObject());
}

const QVector<const StateEvent*> RoomStateView::eventsOfType(
    const QString& evtType) const
{
    auto vals = QVector<const StateEvent*>();
    for (auto it = cbegin(); it != cend(); ++it)
        if (it.key().first == evtType)
            vals.append(it.value());

    return vals;
}