Kgapi

agerangetype.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#include <QJsonArray>
15#include <QJsonObject>
16
17#include <optional>
18
19class QJsonValue;
20
21namespace KGAPI2::People
22{
23class FieldMetadata;
24
25/**
26 * A person's age range.
27 *
28 * @see https://developers.google.com/people/api/rest/v1/people#agerangetype
29 * @since 5.23.0
30 **/
31class KGAPIPEOPLE_EXPORT AgeRangeType
32{
33public:
34 enum class AgeRange {
35 AGE_RANGE_UNSPECIFIED, ///< Unspecified.
36 LESS_THAN_EIGHTEEN, ///< Younger than eighteen.
37 EIGHTEEN_TO_TWENTY, ///< Between eighteen and twenty.
38 TWENTY_ONE_OR_OLDER, ///< Twenty-one and older.
39 };
40
41 /** Constructs a new AgeRangeType **/
42 explicit AgeRangeType();
44 AgeRangeType(AgeRangeType &&) noexcept;
45 AgeRangeType &operator=(const AgeRangeType &);
46 AgeRangeType &operator=(AgeRangeType &&) noexcept;
47 /** Destructor. **/
49
50 bool operator==(const AgeRangeType &) const;
51 bool operator!=(const AgeRangeType &) const;
52
53 [[nodiscard]] static AgeRangeType fromJSON(const QJsonObject &obj);
54 [[nodiscard]] static QList<AgeRangeType> fromJSONArray(const QJsonArray &data);
55 [[nodiscard]] QJsonValue toJSON() const;
56
57 /** The age range. **/
58 [[nodiscard]] AgeRangeType::AgeRange ageRange() const;
59 /** Sets value of the ageRange property. **/
60 void setAgeRange(AgeRangeType::AgeRange value);
61
62 /** Metadata about the age range. **/
63 [[nodiscard]] FieldMetadata metadata() const;
64 /** Sets value of the metadata property. **/
65 void setMetadata(const FieldMetadata &value);
66
67private:
68 class Private;
69 QSharedDataPointer<Private> d;
70}; // AgeRangeType
71
72} // namespace KGAPI2::People
A person's age range.
Metadata about a field.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.