20#include "cc_tools_qt/ToolsField.h"
31template <
typename TUnderlyingType>
32class ToolsNumericFieldBase :
public ToolsField
34 static_assert(std::is_integral<TUnderlyingType>::value || std::is_floating_point<TUnderlyingType>::value,
35 "Underlying type is expected to be integral or floating point.");
36 using Base = ToolsField;
39 using UnderlyingType = TUnderlyingType;
40 using SerialisedSeq = Base::SerialisedSeq;
42 ToolsNumericFieldBase() {}
44 virtual ~ToolsNumericFieldBase() noexcept = default;
46 UnderlyingType getValue()
const
48 return getValueImpl();
51 void setValue(UnderlyingType value)
56 std::size_t minLength()
const
58 return minLengthImpl();
61 std::size_t maxLength()
const
63 return maxLengthImpl();
68 return static_cast<int>(minLength()) * 2;
73 return static_cast<int>(maxLength()) * 2;
77 virtual UnderlyingType getValueImpl()
const = 0;
78 virtual void setValueImpl(UnderlyingType value) = 0;
79 virtual std::size_t minLengthImpl()
const = 0;
80 virtual std::size_t maxLengthImpl()
const = 0;