12#include "fieldmetadata.h"
21namespace KGAPI2::People
26 explicit Private() =
default;
27 Private(
const Private &) =
default;
28 Private(Private &&) noexcept = delete;
29 Private &operator=(const Private &) = delete;
30 Private &operator=(Private &&) noexcept = delete;
33 bool operator==(const Private &other)
const
35 return text == other.text && metadata == other.metadata && date == other.date;
38 bool operator!=(
const Private &other)
const
40 return !(*
this == other);
44 FieldMetadata metadata{};
61 return *d == *other.d;
64bool Birthday::operator!=(
const Birthday &other)
const
66 return !(*
this == other);
102 const auto jsonMetadata = obj.
value(QStringLiteral(
"metadata")).
toObject();
103 birthday.
setMetadata(FieldMetadata::fromJSON(jsonMetadata));
105 const auto jsonDate = obj.
value(QStringLiteral(
"date")).
toObject();
106 const auto year = jsonDate.
value(QStringLiteral(
"year")).
toInt();
107 const auto month = jsonDate.value(QStringLiteral(
"month")).toInt();
108 const auto day = jsonDate.value(QStringLiteral(
"day")).toInt();
120 for(
const auto &birthday : data) {
121 if(birthday.isObject()) {
122 const auto objectifiedBirthday = birthday.toObject();
123 birthdays.
append(fromJSON(objectifiedBirthday));
136 { QStringLiteral(
"year"), d->date.year() },
137 { QStringLiteral(
"month"), d->date.month() },
138 { QStringLiteral(
"day"), d->date.day() }
void setDate(const QDate &value)
Sets value of the date property.
Birthday()
Constructs a new Birthday.
FieldMetadata metadata() const
Metadata about the birthday.
QString text() const
A free-form string representing the user's birthday.
void setText(const QString &value)
Sets value of the text property.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
QDate date() const
The date of the birthday.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
int toInt(int defaultValue) const const
QJsonObject toObject() const const
void append(QList< T > &&value)