File indexing completed on 2024-04-28 07:42:07

0001 /*
0002     This file is part of the KContacts framework.
0003     SPDX-FileCopyrightText: 2016-2019 Laurent Montel <montel@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef NOTE_H
0009 #define NOTE_H
0010 
0011 #include "kcontacts_export.h"
0012 
0013 #include <QMap>
0014 #include <QSharedDataPointer>
0015 #include <QString>
0016 
0017 namespace KContacts
0018 {
0019 class ParameterMap;
0020 
0021 /** @short Class that holds a Note for a contact.
0022  *  @since 5.3
0023  */
0024 class KCONTACTS_EXPORT Note
0025 {
0026     friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Note &);
0027     friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Note &);
0028     friend class VCardTool;
0029 
0030 public:
0031     Note();
0032     Note(const Note &other);
0033     Note(const QString &note);
0034 
0035     ~Note();
0036 
0037     typedef QList<Note> List;
0038 
0039     void setNote(const QString &note);
0040     Q_REQUIRED_RESULT QString note() const;
0041 
0042     Q_REQUIRED_RESULT bool isValid() const;
0043 
0044     Q_REQUIRED_RESULT bool operator==(const Note &other) const;
0045     Q_REQUIRED_RESULT bool operator!=(const Note &other) const;
0046 
0047     Note &operator=(const Note &other);
0048 
0049     Q_REQUIRED_RESULT QString toString() const;
0050 
0051 private:
0052     KCONTACTS_NO_EXPORT void setParams(const ParameterMap &params);
0053     Q_REQUIRED_RESULT KCONTACTS_NO_EXPORT ParameterMap params() const;
0054 
0055     class Private;
0056     QSharedDataPointer<Private> d;
0057 };
0058 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Note &object);
0059 
0060 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Note &object);
0061 }
0062 Q_DECLARE_TYPEINFO(KContacts::Note, Q_RELOCATABLE_TYPE);
0063 #endif // NOTE_H