21#include "cc_tools_qt/ToolsField.h"
32template <
typename TUnderlyingType>
33class ToolsNumericFieldBase :
public ToolsField
35 static_assert(std::is_integral<TUnderlyingType>::value || std::is_floating_point<TUnderlyingType>::value,
36 "Underlying type is expected to be integral or floating point.");
37 using Base = ToolsField;
40 using UnderlyingType = TUnderlyingType;
41 using SerialisedSeq = Base::SerialisedSeq;
43 ToolsNumericFieldBase() {}
45 virtual ~ToolsNumericFieldBase() noexcept = default;
47 UnderlyingType getValue()
const
49 return getValueImpl();
52 void setValue(UnderlyingType value)
57 std::size_t minLength()
const
59 return minLengthImpl();
62 std::size_t maxLength()
const
64 return maxLengthImpl();
69 return static_cast<int>(minLength()) * 2;
74 return static_cast<int>(maxLength()) * 2;
79 virtual UnderlyingType getValueImpl()
const = 0;
80 virtual void setValueImpl(UnderlyingType value) = 0;
81 virtual std::size_t minLengthImpl()
const = 0;
82 virtual std::size_t maxLengthImpl()
const = 0;