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 ORG_H
9 #define ORG_H
10 
11 #include "kcontacts_export.h"
12 
13 #include <QMap>
14 #include <QSharedDataPointer>
15 #include <QString>
16 
17 class OrgTest;
18 
19 namespace KContacts
20 {
21 class ParameterMap;
22 
23 /** @short Class that holds a Organization for a contact.
24  *  @since 5.3
25  */
26 class KCONTACTS_EXPORT Org
27 {
28     friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Org &);
29     friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Org &);
30     friend class VCardTool;
31     friend class ::OrgTest;
32 
33 public:
34     Org();
35     Org(const Org &other);
36     Org(const QString &org);
37 
38     ~Org();
39 
40     typedef QVector<Org> List;
41 
42     void setOrganization(const QString &org);
43     Q_REQUIRED_RESULT QString organization() const;
44 
45     Q_REQUIRED_RESULT bool isValid() const;
46 
47 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
48     /**
49      * @deprecated Since 5.88 for lack of usage
50      */
51     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
52     void setParameters(const QMap<QString, QStringList> &params);
53 #endif
54 
55 #if KCONTACTS_ENABLE_DEPRECATED_SINCE(5, 88)
56     /**
57      * @deprecated Since 5.88 for lack of usage
58      */
59     KCONTACTS_DEPRECATED_VERSION(5, 88, "For lack of usage.")
60     Q_REQUIRED_RESULT QMap<QString, QStringList> parameters() const;
61 #endif
62 
63     Q_REQUIRED_RESULT bool operator==(const Org &other) const;
64     Q_REQUIRED_RESULT bool operator!=(const Org &other) const;
65 
66     Org &operator=(const Org &other);
67 
68     Q_REQUIRED_RESULT QString toString() const;
69 
70 private:
71     void setParams(const ParameterMap &params);
72     Q_REQUIRED_RESULT ParameterMap params() const;
73 
74     class Private;
75     QSharedDataPointer<Private> d;
76 };
77 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Org &object);
78 
79 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Org &object);
80 }
81 Q_DECLARE_TYPEINFO(KContacts::Org, Q_MOVABLE_TYPE);
82 #endif // ORG_H
83