KCalendarCore

person.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <[email protected]>
5  SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
18 #ifndef KCALCORE_PERSON_H
19 #define KCALCORE_PERSON_H
20 
21 #include "kcalendarcore_export.h"
22 
23 #include <QString>
24 #include <QHash>
25 #include <QMetaType>
26 #include <QSharedDataPointer>
27 
28 namespace KCalendarCore
29 {
30 
38 class KCALENDARCORE_EXPORT Person
39 {
40  Q_GADGET
41  Q_PROPERTY(bool isEmpty READ isEmpty)
42  Q_PROPERTY(QString fullName READ fullName)
43  Q_PROPERTY(QString name READ name WRITE setName)
44  Q_PROPERTY(QString email READ email WRITE setEmail)
45 
46 public:
51 
55  Person();
56 
64  static Person fromFullName(const QString &fullName);
65 
72  Person(const QString &name, const QString &email);
73 
78  Person(const Person &person);
79 
83  virtual ~Person();
84 
88  Q_REQUIRED_RESULT bool isEmpty() const;
89 
95  Q_REQUIRED_RESULT QString fullName() const;
96 
104  void setName(const QString &name);
105 
111  Q_REQUIRED_RESULT QString name() const;
112 
120  void setEmail(const QString &email);
121 
127  Q_REQUIRED_RESULT QString email() const;
128 
140  Q_REQUIRED_RESULT static bool isValidEmail(const QString &email);
141 
147  bool operator==(const Person &person) const;
148 
154  bool operator!=(const Person &person) const;
155 
161  Person &operator=(const Person &person);
162 
163 private:
164  //@cond PRIVATE
165  class Private;
167  //@endcond
168 
169  friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::Person &person);
170  friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::Person &person);
171 };
172 
176 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Person &person);
177 
181 KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Person &person);
182 
187 KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Person &key);
188 
189 }
190 
191 //@cond PRIVATE
192 Q_DECLARE_TYPEINFO(KCalendarCore::Person, Q_MOVABLE_TYPE);
193 Q_DECLARE_METATYPE(KCalendarCore::Person)
194 //@endcond
195 
196 #endif
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:825
Represents a person, by name and email address.
Definition: person.h:38
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:849
QVector< Person > List
List of persons.
Definition: person.h:50
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Person &key)
Return a hash value for a Person argument.
Definition: person.cpp:148
Namespace for all KCalendarCore types.
Definition: alarm.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:51:32 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.