Messagelib

scamattribute.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5
6*/
7
8#include "scamattribute.h"
9#include <QByteArray>
10#include <QDataStream>
11#include <QIODevice>
12
13using namespace MessageViewer;
14
15class MessageViewer::ScamAttributePrivate
16{
17public:
18 ScamAttributePrivate() = default;
19
20 bool isAScam = false;
21};
22
23ScamAttribute::ScamAttribute()
24 : d(new ScamAttributePrivate)
25{
26}
27
28ScamAttribute::~ScamAttribute() = default;
29
30ScamAttribute *ScamAttribute::clone() const
31{
32 auto attr = new ScamAttribute();
33 attr->setIsAScam(isAScam());
34 return attr;
35}
36
37QByteArray ScamAttribute::type() const
38{
39 static const QByteArray sType("ScamAttribute");
40 return sType;
41}
42
43QByteArray ScamAttribute::serialized() const
44{
45 QByteArray result;
47 s.setVersion(QDataStream::Qt_5_15);
48 s << isAScam();
49 return result;
50}
51
52void ScamAttribute::deserialize(const QByteArray &data)
53{
54 QDataStream s(data);
55 s.setVersion(QDataStream::Qt_5_15);
56 bool value = false;
57 s >> value;
58 d->isAScam = value;
59}
60
61bool ScamAttribute::isAScam() const
62{
63 return d->isAScam;
64}
65
66void ScamAttribute::setIsAScam(bool b)
67{
68 d->isAScam = b;
69}
70
71bool ScamAttribute::operator==(const ScamAttribute &other) const
72{
73 return d->isAScam == other.isAScam();
74}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.