Kgapi

name.h
1/*
2 * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
3 * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 * SPDX-License-Identifier: LGPL-3.0-only
7 * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
8 */
9
10#pragma once
11
12#include <QSharedDataPointer>
13#include "kgapipeople_export.h"
14
15#include <QString>
16
17#include <optional>
18
19class QJsonObject;
20class QJsonValue;
21class QJsonArray;
22
23namespace KContacts {
24class Addressee;
25}
26
27namespace KGAPI2::People
28{
29class FieldMetadata;
30
31/**
32 * A person's name. If the name is a mononym, the family name is empty.
33 *
34 * @see https://developers.google.com/people/api/rest/v1/people#name
35 * @since 5.23.0
36 **/
37class KGAPIPEOPLE_EXPORT Name
38{
39public:
40 /** Constructs a new Name **/
41 explicit Name();
42 Name(const Name &);
43 Name(Name &&) noexcept;
44 Name &operator=(const Name &);
45 Name &operator=(Name &&) noexcept;
46 /** Destructor. **/
48
49 bool operator==(const Name &) const;
50 bool operator!=(const Name &) const;
51
52 [[nodiscard]] static Name fromJSON(const QJsonObject &);
53 [[nodiscard]] static QList<Name> fromJSONArray(const QJsonArray &data);
54 [[nodiscard]] QJsonValue toJSON() const;
55
56 [[nodiscard]] static Name fromKContactsAddressee(const KContacts::Addressee &addressee);
57 void applyToKContactsAddressee(KContacts::Addressee &addressee) const;
58
59 /** The free form name value. **/
60 [[nodiscard]] QString unstructuredName() const;
61 /** Sets value of the unstructuredName property. **/
62 void setUnstructuredName(const QString &value);
63
64 /** The family name. **/
65 [[nodiscard]] QString familyName() const;
66 /** Sets value of the familyName property. **/
67 void setFamilyName(const QString &value);
68
69 /** The middle name(s) spelled as they sound. **/
70 [[nodiscard]] QString phoneticMiddleName() const;
71 /** Sets value of the phoneticMiddleName property. **/
72 void setPhoneticMiddleName(const QString &value);
73
74 /** The middle name(s). **/
75 [[nodiscard]] QString middleName() const;
76 /** Sets value of the middleName property. **/
77 void setMiddleName(const QString &value);
78
79 /** The honorific prefixes, such as `Mrs.` or `Dr.` **/
80 [[nodiscard]] QString honorificPrefix() const;
81 /** Sets value of the honorificPrefix property. **/
82 void setHonorificPrefix(const QString &value);
83
84 /** The given name. **/
85 [[nodiscard]] QString givenName() const;
86 /** Sets value of the givenName property. **/
87 void setGivenName(const QString &value);
88
89 /** The given name spelled as it sounds. **/
90 [[nodiscard]] QString phoneticGivenName() const;
91 /** Sets value of the phoneticGivenName property. **/
92 void setPhoneticGivenName(const QString &value);
93
94 /** The honorific prefixes spelled as they sound. **/
95 [[nodiscard]] QString phoneticHonorificPrefix() const;
96 /** Sets value of the phoneticHonorificPrefix property. **/
97 void setPhoneticHonorificPrefix(const QString &value);
98
99 /** Output only. The display name formatted according to the locale specified by the viewer's account or the `Accept-Language` HTTP header. **/
100 [[nodiscard]] QString displayName() const;
101
102 /** Output only. The display name with the last name first formatted according to the locale specified by the viewer's account or the `Accept-Language` HTTP
103 * header. **/
104 [[nodiscard]] QString displayNameLastFirst() const;
105
106 /** The family name spelled as it sounds. **/
107 [[nodiscard]] QString phoneticFamilyName() const;
108 /** Sets value of the phoneticFamilyName property. **/
109 void setPhoneticFamilyName(const QString &value);
110
111 /** The honorific suffixes, such as `Jr.` **/
112 [[nodiscard]] QString honorificSuffix() const;
113 /** Sets value of the honorificSuffix property. **/
114 void setHonorificSuffix(const QString &value);
115
116 /** The honorific suffixes spelled as they sound. **/
117 [[nodiscard]] QString phoneticHonorificSuffix() const;
118 /** Sets value of the phoneticHonorificSuffix property. **/
119 void setPhoneticHonorificSuffix(const QString &value);
120
121 /** The full name spelled as it sounds. **/
122 [[nodiscard]] QString phoneticFullName() const;
123 /** Sets value of the phoneticFullName property. **/
124 void setPhoneticFullName(const QString &value);
125
126 /** Metadata about the name. **/
127 [[nodiscard]] FieldMetadata metadata() const;
128 /** Sets value of the metadata property. **/
129 void setMetadata(const FieldMetadata &value);
130
131private:
132 class Private;
134}; // Name
135
136} // namespace KGAPI2::People
Metadata about a field.
A person's name.
Definition name.h:38
~Name()
Destructor.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.