KPublicTransport

datatypes.h
1/*
2 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KPUBLICTRANSPORT_DATATYPES_H
8#define KPUBLICTRANSPORT_DATATYPES_H
9
10#include "kpublictransport_export.h"
11
12#include <QMetaType>
13#include <QSharedDataPointer>
14
15#include <type_traits>
16
17class QVariant;
18
19namespace KPublicTransport {
20namespace Internal {
21template <typename T>
22struct parameter_type
23{
24 using type = typename std::conditional<std::is_fundamental<T>::value || std::is_enum<T>::value, T, const T&>::type;
25};
26}
27}
28
29#define KPUBLICTRANSPORT_GADGET(Class) \
30 Q_GADGET \
31public: \
32 Class(); \
33 Class(Class&&) noexcept; \
34 Class(const Class&); \
35 ~Class(); \
36 Class& operator=(Class&&) noexcept; \
37 Class& operator=(const Class&); \
38 operator QVariant () const; \
39private: \
40 friend class Class ## Private; \
41 QExplicitlySharedDataPointer<Class ## Private> d;
42
43#define KPUBLICTRANSPORT_PROPERTY(Type, Getter, Setter) \
44public: \
45 Q_PROPERTY(Type Getter READ Getter WRITE Setter) \
46 Type Getter() const; \
47 void Setter(KPublicTransport::Internal::parameter_type<Type>::type value); \
48
49
50#endif
Query operations and data types for accessing realtime public transport information from online servi...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.