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

KDE's Doxygen guidelines are available online.