1 /*
2     This file is part of the KContacts framework.
3     SPDX-FileCopyrightText: 2016-2019 Laurent Montel <montel@kde.org>
4 
5     SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef NOTE_H
9 #define NOTE_H
10 
11 #include "kcontacts_export.h"
12 
13 #include <QMap>
14 #include <QSharedDataPointer>
15 #include <QString>
16 
17 namespace KContacts
18 {
19 class ParameterMap;
20 
21 /** @short Class that holds a Note for a contact.
22  *  @since 5.3
23  */
24 class KCONTACTS_EXPORT Note
25 {
26     friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Note &);
27     friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Note &);
28     friend class VCardTool;
29 
30 public:
31     Note();
32     Note(const Note &other);
33     Note(const QString &note);
34 
35     ~Note();
36 
37     typedef QVector<Note> List;
38 
39     void setNote(const QString &note);
40     Q_REQUIRED_RESULT QString note() const;
41 
42     Q_REQUIRED_RESULT bool isValid() const;
43 
44 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
45     /**
46      * @deprecated Since 5.88 for lack of usage
47      */
48     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
49     void setParameters(const QMap<QString, QStringList> &params);
50 #endif
51 
52 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
53     /**
54      * @deprecated Since 5.88 for lack of usage
55      */
56     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
57     Q_REQUIRED_RESULT QMap<QString, QStringList> parameters() const;
58 #endif
59 
60     Q_REQUIRED_RESULT bool operator==(const Note &other) const;
61     Q_REQUIRED_RESULT bool operator!=(const Note &other) const;
62 
63     Note &operator=(const Note &other);
64 
65     Q_REQUIRED_RESULT QString toString() const;
66 
67 private:
68     void setParams(const ParameterMap &params);
69     Q_REQUIRED_RESULT ParameterMap params() const;
70 
71     class Private;
72     QSharedDataPointer<Private> d;
73 };
74 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Note &object);
75 
76 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Note &object);
77 }
78 Q_DECLARE_TYPEINFO(KContacts::Note, Q_MOVABLE_TYPE);
79 #endif // NOTE_H
80