@@ -79,7 +79,11 @@ class DataType : virtual public ConfigItemBridge
7979 {
8080 }
8181
82- ValueType& getValue () { return this ->_value ; }
82+ /* *
83+ * value() can be used to get the value, but it can also
84+ * be used set it like this: p.value() = newValue
85+ */
86+ ValueType& value () { return this ->_value ; }
8387 ValueType& operator *() { return this ->_value ; }
8488
8589protected:
@@ -478,7 +482,7 @@ class CheckboxTParameter : public BoolDataType, public InputParameter
478482 ConfigItemBridge (id),
479483 BoolDataType::BoolDataType (id, defaultValue),
480484 InputParameter::InputParameter (id, label) { }
481- bool isChecked () { return this ->getValue (); }
485+ bool isChecked () { return this ->value (); }
482486
483487protected:
484488 virtual const char * getInputType () override { return " checkbox" ; }
@@ -689,6 +693,40 @@ class IntTParameter :
689693 virtual const char * getInputType () override { return " number" ; }
690694};
691695
696+ template <typename ValueType, int base = 10 >
697+ class UIntTParameter :
698+ public virtual UnsignedIntDataType<ValueType, base>,
699+ public PrimitiveInputParameter<ValueType>
700+ {
701+ public:
702+ UIntTParameter (const char * id, const char * label, ValueType defaultValue) :
703+ ConfigItemBridge (id),
704+ SignedIntDataType<ValueType, base>::SignedIntDataType(id, defaultValue),
705+ PrimitiveInputParameter<ValueType>::PrimitiveInputParameter(id, label) { }
706+
707+ // TODO: somehow organize these methods into common parent.
708+ virtual ValueType getMin () override
709+ {
710+ return PrimitiveDataType<ValueType>::getMin ();
711+ }
712+ virtual ValueType getMax () override
713+ {
714+ return PrimitiveDataType<ValueType>::getMax ();
715+ }
716+
717+ virtual bool isMinDefined () override
718+ {
719+ return PrimitiveDataType<ValueType>::isMinDefined ();
720+ }
721+ virtual bool isMaxDefined () override
722+ {
723+ return PrimitiveDataType<ValueType>::isMaxDefined ();
724+ }
725+
726+ protected:
727+ virtual const char * getInputType () override { return " number" ; }
728+ };
729+
692730class FloatTParameter :
693731 public FloatDataType,
694732 public PrimitiveInputParameter<float >
@@ -822,7 +860,7 @@ class SelectTParameter : public OptionsTParameter<len>
822860// oitem.replace("{n}", "?");
823861// }
824862 if ((hasValueFromPost && (valueFromPost == optionValue)) ||
825- (strncmp (this ->getValue (), optionValue, len) == 0 ))
863+ (strncmp (this ->value (), optionValue, len) == 0 ))
826864 {
827865 // -- Value from previous submit
828866 oitem.replace (" {s}" , " selected" );
0 commit comments