KPublicTransport

datatypes.h
1 /*
2  SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]>
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 
17 class QVariant;
18 
19 namespace KPublicTransport {
20 namespace Internal {
21 template <typename T>
22 struct 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 \
31 public: \
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; \
39 private: \
40  friend class Class ## Private; \
41  QExplicitlySharedDataPointer<Class ## Private> d;
42 
43 #define KPUBLICTRANSPORT_PROPERTY(Type, Getter, Setter) \
44 public: \
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...
Definition: attribution.cpp:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:05:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.