KItinerary
6#ifndef KITINERARY_UPERELEMENT_H
7#define KITINERARY_UPERELEMENT_H
9#include "uperdecoder.h"
10#include "internal/instance_counter.h"
19 static constexpr detail::num<0> _uper_optional_counter(detail::num<0>) { return {}; } \
20 static constexpr bool _uper_ExtensionMarker = false;
23#define UPER_EXTENDABLE_GADGET \
25 static constexpr detail::num<0> _uper_optional_counter(detail::num<0>) { return {}; } \
26 static constexpr bool _uper_ExtensionMarker = true;
29#define UPER_ENUM(Name) \
31 constexpr bool uperHasExtensionMarker(Name) { return false; }
32#define UPER_EXTENABLE_ENUM(Name) \
34 constexpr bool uperHasExtensionMarker(Name) { return true; }
36#define UPER_ELEMENT(Type, Name) \
39 Q_PROPERTY(Type Name MEMBER Name CONSTANT) \
40 [[nodiscard]] constexpr inline bool Name ## IsSet() const { return true; } \
41 [[nodiscard]] std::optional<Type> Name ## Value() const { return Name; }
43#define UPER_ELEMENT_OPTIONAL(Type, Name) \
46 Q_PROPERTY(Type Name MEMBER Name CONSTANT) \
47 Q_PROPERTY(bool Name ## IsSet READ Name ## IsSet) \
49 static constexpr int _uper_ ## Name ## OptionalIndex = decltype(_uper_optional_counter(detail::num<>()))::value; \
50 static constexpr auto _uper_optional_counter(detail::num<decltype(_uper_optional_counter(detail::num<>()))::value + 1> n) \
51 -> decltype(n) { return {}; } \
53 [[nodiscard]] inline bool Name ## IsSet() const { return m_optionals[m_optionals.size() - _uper_ ## Name ## OptionalIndex - 1]; } \
54 [[nodiscard]] std::optional<Type> Name ## Value() const { return Name ## IsSet() ? std::optional<Type>(Name) : std::optional<Type>(); }
56#define UPER_ELEMENT_DEFAULT(Type, Name, DefaultValue) \
58 Type Name = DefaultValue; \
59 Q_PROPERTY(Type Name MEMBER Name CONSTANT) \
61 static constexpr int _uper_ ## Name ## OptionalIndex = decltype(_uper_optional_counter(detail::num<>()))::value; \
62 static constexpr auto _uper_optional_counter(detail::num<decltype(_uper_optional_counter(detail::num<>()))::value + 1> n) \
63 -> decltype(n) { return {}; } \
64 [[nodiscard]] inline bool Name ## IsSet() const { return m_optionals[m_optionals.size() - _uper_ ## Name ## OptionalIndex - 1]; } \
65 [[nodiscard]] std::optional<Type> Name ## Value() const { return Name; }
67#define UPER_ELEMENT_CHOICE(Name, ...) \
69 std::variant<__VA_ARGS__> Name; \
70 Q_PROPERTY(QVariant Name READ Name ## Variant CONSTANT) \
71 [[nodiscard]] constexpr inline bool Name ## IsSet() const { return true; } \
72 [[nodiscard]] std::optional<std::variant<__VA_ARGS__>> Name ## Value() const { return Name; } \
74 [[nodiscard]] inline QVariant Name ## Variant() const { return QVariant::fromStdVariant(Name); }
78#define UPER_GADGET_FINALIZE \
80 void decode(UPERDecoder &decoder); \
82 static constexpr auto _uper_OptionalCount = decltype(_uper_optional_counter(detail::num<>()))::value; \
83 std::bitset<_uper_OptionalCount> m_optionals; \
84 inline void decodeSequence(UPERDecoder &decoder) { \
85 if constexpr (_uper_ExtensionMarker) { \
86 if (decoder.readBoolean()) { \
87 decoder.setError("SEQUENCE with extension marker set not implemented."); \
91 m_optionals = decoder.readBitset<_uper_OptionalCount>(); \
Classes for reservation/travel data models, data extraction and data augmentation.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 11:54:58 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.