File: kgapiobject.h

package info (click to toggle)
libkgapi 25.12.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,408 kB
  • sloc: cpp: 37,386; ansic: 977; python: 671; xml: 58; makefile: 16; sh: 1
file content (64 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{#
SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>

SPDX-License-Identifier: LGPL-2.1-only
SPDX-License-Identifier: LGPL-3.0-only
SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
#}

{% import 'macros/properties.j2' as properties -%}
{% import 'macros/dependencies.j2' as dependencies -%}

#pragma once

#include <{{ api.export_macro | lower() }}.h>
#include "object.h"

{{ dependencies.render_includes(schema.dependencies, True, True, False) }}

#include <QSharedPointer>

#include <optional>

class QJsonObject;
class QJsonValue;

namespace KGAPI2::{{ api.namespace }} {

class {{ schema.name }};
using {{ schema.name }}Ptr = QSharedPointer<{{ schema.name }}>;

{{ dependencies.render_forward_declarations(schema.dependencies) }}

/**
 * {{ schema.description | wordwrap(80) | replace('\n', '\n * ') }}
 *
 * @see {{ api.reference_base_uri }}#{{ schema.name | lower }}
{%- if api.since %}
 * @since {{ api.since }}
{%- endif %}
 **/
class {{ api.export_macro }} {{ schema.name }} : public KGAPI2::Object {

public:
    {{ dependencies.render_enums_declarations(schema.nested_enums) }}

    /** Construcuts a new {{ schema.name }} **/
    explicit {{ schema.name }}();
    /** Destructor. **/
    ~{{ schema.name }}();

    bool operator==(const {{ schema.name }} &) const;
    bool operator!=(const {{ schema.name }} &) const;

    {{ properties.render_accessors_declarations(schema.properties) }}

    static {{ schema.name }}Ptr fromJSON(const QJsonObject &);
    QJsonValue toJSON() const;

private:
    class Private;
    std::unique_ptr<Private> d;
}; // {{ schema.name }}

} // namespace KGAPI2::{{ api.namespace }}