12#include "fieldmetadata.h"
13#include "peopleservice.h"
20namespace KGAPI2::People
25 explicit Private() =
default;
26 Private(
const Private &) =
default;
27 Private(Private &&) noexcept = delete;
28 Private &operator=(const Private &) = delete;
29 Private &operator=(Private &&) noexcept = delete;
32 bool operator==(const Private &other)
const
34 return formattedType == other.formattedType && city == other.city && metadata == other.metadata && countryCode == other.countryCode
35 && postalCode == other.postalCode && poBox == other.poBox && type == other.type && formattedValue == other.formattedValue
36 && extendedAddress == other.extendedAddress && region == other.region && streetAddress == other.streetAddress && country == other.country;
39 bool operator!=(
const Private &other)
const
41 return !(*
this == other);
46 FieldMetadata metadata{};
71 return *d == *other.d;
74bool Address::operator!=(
const Address &other)
const
76 return !(*
this == other);
81 return d->formattedType;
103 return d->countryCode;
108 d->countryCode = value;
112 return d->postalCode;
117 d->postalCode = value;
139 return d->formattedValue;
144 d->formattedValue = value;
148 return d->extendedAddress;
153 d->extendedAddress = value;
166 return d->streetAddress;
171 d->streetAddress = value;
188 address.setMetadata(FieldMetadata::fromJSON(obj.
value(QStringLiteral(
"metadata")).toObject()));
189 address.setFormattedValue(obj.
value(QStringLiteral(
"formattedValue")).toString());
190 address.setType(obj.
value(QStringLiteral(
"type")).toString());
191 address.setPoBox(obj.
value(QStringLiteral(
"poBox")).toString());
192 address.setStreetAddress(obj.
value(QStringLiteral(
"streetAddress")).toString());
193 address.setExtendedAddress(obj.
value(QStringLiteral(
"extendedAddress")).toString());
194 address.setCity(obj.
value(QStringLiteral(
"city")).toString());
195 address.setRegion(obj.
value(QStringLiteral(
"region")).toString());
196 address.setPostalCode(obj.
value(QStringLiteral(
"postalCode")).toString());
197 address.setCountry(obj.
value(QStringLiteral(
"country")).toString());
198 address.setCountryCode(obj.
value(QStringLiteral(
"countryCode")).toString());
208 for(
const auto &address : data) {
209 if(address.isObject()) {
210 const auto objectifiedAddress = address.toObject();
211 addresses.
append(fromJSON(objectifiedAddress));
223 PeopleUtils::addValueToJsonObjectIfValid(obj,
"city", d->city);
225 PeopleUtils::addValueToJsonObjectIfValid(obj,
"countryCode", d->countryCode);
226 PeopleUtils::addValueToJsonObjectIfValid(obj,
"postalCode", d->postalCode);
227 PeopleUtils::addValueToJsonObjectIfValid(obj,
"poBox", d->poBox);
228 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", d->type);
229 PeopleUtils::addValueToJsonObjectIfValid(obj,
"formattedValue", d->formattedValue);
230 PeopleUtils::addValueToJsonObjectIfValid(obj,
"extendedAddress", d->extendedAddress);
231 PeopleUtils::addValueToJsonObjectIfValid(obj,
"region", d->region);
232 PeopleUtils::addValueToJsonObjectIfValid(obj,
"streetAddress", d->streetAddress);
233 PeopleUtils::addValueToJsonObjectIfValid(obj,
"country", d->country);
A person's physical address.
QString city() const
The city of the address.
QString countryCode() const
The ISO 3166-1 alpha-2 country code of the address.
QString type() const
The type of the address.
void setCity(const QString &value)
Sets value of the city property.
void setPoBox(const QString &value)
Sets value of the poBox property.
QString postalCode() const
The postal code of the address.
void setRegion(const QString &value)
Sets value of the region property.
QString poBox() const
The P.O.
void setType(const QString &value)
Sets value of the type property.
void setExtendedAddress(const QString &value)
Sets value of the extendedAddress property.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
void setCountry(const QString &value)
Sets value of the country property.
Address()
Constructs a new Address.
QString region() const
The region of the address; for example, the state or province.
QString extendedAddress() const
The extended address of the address; for example, the apartment number.
QString formattedValue() const
The unstructured value of the address.
FieldMetadata metadata() const
Metadata about the address.
QString streetAddress() const
The street address.
QString country() const
The country of the address.
void setStreetAddress(const QString &value)
Sets value of the streetAddress property.
void setFormattedValue(const QString &value)
Sets value of the formattedValue property.
void setCountryCode(const QString &value)
Sets value of the countryCode property.
void setPostalCode(const QString &value)
Sets value of the postalCode property.
QString formattedType() const
Output only.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
void append(QList< T > &&value)