Messagelib

scamattribute.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
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 
13 using namespace MessageViewer;
14 
15 class MessageViewer::ScamAttributePrivate
16 {
17 public:
18  ScamAttributePrivate() = default;
19 
20  bool isAScam = false;
21 };
22 
23 ScamAttribute::ScamAttribute()
24  : d(new ScamAttributePrivate)
25 {
26 }
27 
28 ScamAttribute::~ScamAttribute() = default;
29 
30 ScamAttribute *ScamAttribute::clone() const
31 {
32  auto attr = new ScamAttribute();
33  attr->setIsAScam(isAScam());
34  return attr;
35 }
36 
37 QByteArray ScamAttribute::type() const
38 {
39  static const QByteArray sType("ScamAttribute");
40  return sType;
41 }
42 
43 QByteArray ScamAttribute::serialized() const
44 {
45  QByteArray result;
47  s << isAScam();
48  return result;
49 }
50 
51 void ScamAttribute::deserialize(const QByteArray &data)
52 {
53  QDataStream s(data);
54  bool value = false;
55  s >> value;
56  d->isAScam = value;
57 }
58 
59 bool ScamAttribute::isAScam() const
60 {
61  return d->isAScam;
62 }
63 
64 void ScamAttribute::setIsAScam(bool b)
65 {
66  d->isAScam = b;
67 }
68 
69 bool ScamAttribute::operator==(const ScamAttribute &other) const
70 {
71  return d->isAScam == other.isAScam();
72 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:05:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.