21#include <QtCore/QString>
22#include <QtCore/QVariantMap>
23#include <QtCore/QVariantList>
24#include <QtCore/QList>
25#include <QtCore/QPair>
27#include "comms/comms.h"
28#include "cc_tools_qt/Api.h"
55 explicit Common(
const QVariantMap& props);
58 explicit Common(
const QVariant& props);
70 const QString& name() const;
73 void setName(const QString& value);
76 void setName(const
char* value);
79 bool isHidden() const;
85 bool isSerialisedHidden() const;
88 Common& serialisedHidden(
bool value = true);
91 bool isReadOnly() const;
97 bool isHiddenWhenReadOnly() const;
100 Common& hiddenWhenReadOnly(
bool value = true);
103 void setTo(QVariantMap& props) const;
106 void getFrom(const QVariantMap& props);
114 template <typename U>
115 static
void setElemTo(U&& val, const QString& name, QVariantMap& props)
117 props.insert(name, QVariant::fromValue(std::forward<U>(val)));
125 template <
typename TValueType>
127 const QVariantMap& props,
129 const TValueType& defaultVal = TValueType())
131 auto var = props.value(name);
132 if ((!var.isValid()) || (!var.canConvert<TValueType>())) {
136 return var.value<TValueType>();
141 bool m_hidden =
false;
142 bool m_serialisedHidden =
false;
143 bool m_readOnly =
false;
144 bool m_hiddenWhenReadOnly =
false;
150template <
typename TDerived>
183 TDerived&
name(const QString& value)
186 return static_cast<TDerived&
>(*this);
191 TDerived&
name(
const char* value)
194 return static_cast<TDerived&
>(*this);
265 long long displayOffset() const;
271 bool hasScaledDecimals() const;
275 int scaledDecimals() const;
287 IntValue& addSpecial(const QString& specialName,
long long value);
290 QVariantMap asMap() const;
293 void getFrom(const QVariantMap& props);
295 long long m_displayOffset = 0;
296 int m_scaledDecimals = 0;
345 EnumValue& add(const QString& elemName,
long long value);
355 QVariantMap asMap() const;
357 void getFrom(const QVariantMap& props);
412 QVariantMap asMap() const;
414 void getFrom(const QVariantMap& props);
464 QVariantMap asMap() const;
466 void getFrom(const QVariantMap& props);
513 Bundle& add(const QVariantMap& memberProps);
516 QVariantMap asMap() const;
518 void getFrom(const QVariantMap& props);
555 QVariantMap asMap() const;
603 bool isPrefixVisible() const;
610 const QString& prefixName() const;
616 bool isIndexAppendedToElementName() const;
622 QVariantMap asMap() const;
625 void getFrom(const QVariantMap& props);
628 QString m_prefixName;
629 bool m_showPrefix = false;
630 bool m_appendIndexToElementName = false;
666 const QVariantMap& field() const;
677 bool isUncheckable() const;
683 QVariantMap asMap() const;
686 void getFrom(const QVariantMap& props);
689 bool m_uncheckable = false;
731 int decimals() const;
742 FloatValue& addSpecial(const QString& specialName,
double value);
746 QVariantMap asMap() const;
749 void getFrom(const QVariantMap& props);
800 bool isIndexHidden() const;
803 Variant& setIndexHidden(
bool hiddenVal = true);
806 QVariantMap asMap() const;
808 void getFrom(const QVariantMap& props);
811 bool m_indexHidden = false;
817template <
typename TField>
821struct ForTag<comms::field::tag::Int>
827struct ForTag<comms::field::tag::Enum>
833struct ForTag<comms::field::tag::Bitmask>
839struct ForTag<comms::field::tag::Bitfield>
845struct ForTag<comms::field::tag::Bundle>
851struct ForTag<comms::field::tag::String>
857struct ForTag<comms::field::tag::RawArrayList>
863struct ForTag<comms::field::tag::ArrayList>
869struct ForTag<comms::field::tag::Optional>
875struct ForTag<comms::field::tag::Float>
881struct ForTag<comms::field::tag::Variant>
891template <
typename TField>
892using ForField =
typename details::ForTag<typename TField::CommsTag>::Type;