cutelyst  4.4.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
authenticationuser.cpp
1 /*
2  * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #include "authenticationuser.h"
6 
7 #include <QDataStream>
8 #include <QDebug>
9 
10 using namespace Cutelyst;
11 
13 {
14 }
15 
17 {
18  setId(id);
19 }
20 
22 {
23 }
24 
26 {
27  return m_data.value(QStringLiteral("id"));
28 }
29 
31 {
32  m_data.insert(QStringLiteral("id"), id);
33 }
34 
36 {
37  return m_data.isEmpty();
38 }
39 
41 {
42  return m_data.value(QStringLiteral("authRealm")).toString();
43 }
44 
46 {
47  m_data.insert(QStringLiteral("authRealm"), authRealm);
48 }
49 
50 QDataStream &operator<<(QDataStream &out, const AuthenticationUser &user)
51 {
52  out << user.data();
53  return out;
54 }
55 
56 QDataStream &operator>>(QDataStream &in, AuthenticationUser &user)
57 {
58  QVariantMap map;
59  in >> map;
60  user.setData(map);
61  return in;
62 }
63 
64 QDebug operator<<(QDebug dbg, const AuthenticationUser &user)
65 {
66  const QVariantMap map = user.data();
67  const bool oldSetting = dbg.autoInsertSpaces();
68  dbg.nospace() << "AuthenticationUser(";
69  for (auto it = map.constBegin(); it != map.constEnd(); ++it) {
70  dbg << '(' << it.key() << ", " << it.value() << ')';
71  }
72  dbg << ')';
73  dbg.setAutoInsertSpaces(oldSetting);
74  return dbg.maybeSpace();
75 }
76 
77 #include "moc_authenticationuser.cpp"
Container for user data retrieved from an AuthenticationStore.
void setData(const QVariantMap &data)
void setAuthRealm(const QString &authRealm)
void setId(const QVariant &id)
The Cutelyst namespace holds all public Cutelyst API.
bool autoInsertSpaces() const const
QDebug & maybeSpace()
QDebug & nospace()
void setAutoInsertSpaces(bool b)