KContacts

secrecy.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2002 Tobias Koenig <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_SECRECY_H
9 #define KCONTACTS_SECRECY_H
10 
11 #include "kcontacts_export.h"
12 #include <QSharedDataPointer>
13 #include <QVector>
14 
15 namespace KContacts
16 {
17 /** Describes the confidentiality of an addressee. */
18 class KCONTACTS_EXPORT Secrecy
19 {
20  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Secrecy &);
21  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Secrecy &);
22 
23 public:
24  /**
25  * Secrecy types
26  *
27  * @li Public - for public access
28  * @li Private - only private access
29  * @li Confidential - access for confidential persons
30  */
31  enum Type {
32  Public,
33  Private,
34  Confidential,
35  Invalid,
36  };
37 
38  /**
39  * List of secrecy types.
40  */
42 
43  /**
44  * Creates a new secrecy of the given type.
45  *
46  * @param type The secrecy type. @see Type
47  */
48  Secrecy(Type type = Invalid);
49 
50  /**
51  * Copy constructor.
52  */
53  Secrecy(const Secrecy &other);
54 
55  /**
56  * Destroys the secrecy.
57  */
58  ~Secrecy();
59 
60  Secrecy &operator=(const Secrecy &other);
61 
62  Q_REQUIRED_RESULT bool operator==(const Secrecy &other) const;
63  Q_REQUIRED_RESULT bool operator!=(const Secrecy &other) const;
64 
65  /**
66  * Returns if the Secrecy object has a valid value.
67  */
68  Q_REQUIRED_RESULT bool isValid() const;
69 
70  /**
71  * Sets the @p type.
72  *
73  * @param type The #Type of secrecy
74  */
75  void setType(Type type);
76 
77  /**
78  * Returns the type.
79  */
80  Q_REQUIRED_RESULT Type type() const;
81 
82  /**
83  * Returns a list of all available secrecy types.
84  */
85  Q_REQUIRED_RESULT static TypeList typeList();
86 
87  /**
88  * Returns a translated label for a given secrecy @p type.
89  */
90  Q_REQUIRED_RESULT static QString typeLabel(Type type);
91 
92  /**
93  * Returns a string representation of the secrecy.
94  */
95  Q_REQUIRED_RESULT QString toString() const;
96 
97 private:
98  class PrivateData;
100 };
101 
102 /**
103  * Serializes the @p secrecy object into the @p stream.
104  */
105 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Secrecy &secrecy);
106 
107 /**
108  * Initializes the @p secrecy object from the @p stream.
109  */
110 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Secrecy &secrecy);
111 }
112 Q_DECLARE_TYPEINFO(KContacts::Secrecy, Q_MOVABLE_TYPE);
113 #endif
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
QVector< Type > TypeList
List of secrecy types.
Definition: secrecy.h:41
Type
Secrecy types.
Definition: secrecy.h:31
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Describes the confidentiality of an addressee.
Definition: secrecy.h:18
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Sep 20 2021 22:56:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.