KHealthCertificate

khealthcertificatetypes.h
1/*
2 * SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3 * SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6#ifndef KHEALTHCERTIFICATETYPES_H
7#define KHEALTHCERTIFICATETYPES_H
8
9#include "khealthcertificate.h"
10
11#include <QSharedDataPointer>
12
13#include <type_traits>
14
15class QVariant;
16
17namespace KHealthCertificateInternal {
18template <typename T>
19struct parameter_type
20{
21 using type = typename std::conditional<std::is_fundamental<T>::value || std::is_enum<T>::value, T, const T&>::type;
22};
23}
24
25#define KHEALTHCERTIFICATE_GADGET(Class) \
26 Q_GADGET \
27 Q_PROPERTY(KHealthCertificate::CertificateType type READ type) \
28public: \
29 K ## Class ## Certificate(); \
30 K ## Class ## Certificate(K ## Class ## Certificate &&) noexcept; \
31 K ## Class ## Certificate(const K ## Class ##Certificate &); \
32 ~K ## Class ## Certificate(); \
33 K ## Class ## Certificate& operator=(K ## Class ## Certificate &&) noexcept; \
34 K ## Class ## Certificate& operator=(const K ## Class ## Certificate &); \
35 operator QVariant () const; \
36 bool operator==(const K ## Class ## Certificate &other) const; \
37 bool operator!=(const K ## Class ## Certificate &other) const; \
38private: \
39 KHealthCertificate::CertificateType type() const; \
40 friend class K ## Class ## CertificatePrivate; \
41 QExplicitlySharedDataPointer<K ## Class ## CertificatePrivate> d;
42
43#define KHEALTHCERTIFICATE_PROPERTY(Type, Getter, Setter) \
44public: \
45 Q_PROPERTY(Type Getter READ Getter CONSTANT) \
46 Type Getter() const; \
47 void Setter(KHealthCertificateInternal::parameter_type<Type>::type value); \
48
49#endif // KHEALTHCERTIFICATETYPES_H
50
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Apr 27 2024 22:10:33 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.