12#include "fieldmetadata.h"
13#include "peopleservice.h"
22namespace KGAPI2::People
27 explicit Private() =
default;
28 Private(
const Private &) =
default;
29 Private(Private &&) noexcept = delete;
30 Private &operator=(const Private &) = delete;
31 Private &operator=(Private &&) noexcept = delete;
34 bool operator==(const Private &other)
const
36 return value == other.value && type == other.type && metadata == other.metadata;
39 bool operator!=(
const Private &other)
const
41 return !(*
this == other);
46 FieldMetadata metadata{};
62 return *d == *other.d;
65bool Nickname::operator!=(
const Nickname &other)
const
67 return !(*
this == other);
105 nickname.
setValue(obj.
value(QStringLiteral(
"value")).toString());
132 for(
const auto &nickname : data) {
133 if(nickname.isObject()) {
134 const auto objectifiedNickname = nickname.toObject();
135 nicknames.
append(fromJSON(objectifiedNickname));
146 PeopleUtils::addValueToJsonObjectIfValid(obj,
"value", d->value);
149 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"DEFAULT"));
152 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"MAIDEN_NAME"));
155 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"INITIALS"));
158 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"GPLUS"));
161 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OTHER_NAME"));
164 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"ALTERNATE_NAME"));
167 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"SHORT_NAME"));
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
void setType(Nickname::Type value)
Sets value of the type property.
FieldMetadata metadata() const
Metadata about the nickname.
void setValue(const QString &value)
Sets value of the value property.
QString value() const
The nickname.
Nickname::Type type() const
The type of the nickname.
@ SHORT_NAME
A shorter version of the person's name.
@ MAIDEN_NAME
Maiden name or birth family name. Used when the person's family name has changed as a result of marri...
@ DEFAULT
Generic nickname.
@ GPLUS
Google+ profile nickname.
@ ALTERNATE_NAME
Alternate name person is known by.
@ OTHER_NAME
A professional affiliation or other name; for example, Dr. Smith.
Nickname()
Constructs a new Nickname.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
QJsonObject toObject() const const
QString toString() const const
void append(QList< T > &&value)