22#include "cc_tools_qt/ToolsField.h"
33template <
typename TUnderlyingType>
34class ToolsNumericFieldBase :
public ToolsField
36 static_assert(std::is_integral<TUnderlyingType>::value || std::is_floating_point<TUnderlyingType>::value,
37 "Underlying type is expected to be integral or floating point.");
38 using Base = ToolsField;
41 using UnderlyingType = TUnderlyingType;
42 using SerialisedSeq = Base::SerialisedSeq;
44 ToolsNumericFieldBase() {}
46 virtual ~ToolsNumericFieldBase() noexcept = default;
48 UnderlyingType getValue()
const
50 return getValueImpl();
53 void setValue(UnderlyingType value)
58 std::size_t minLength()
const
60 return minLengthImpl();
63 std::size_t maxLength()
const
65 return maxLengthImpl();
70 return static_cast<int>(minLength()) * 2;
75 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;