Add description for numerical properties

This commit is contained in:
Alexander Bock
2014-12-17 18:18:34 +01:00
parent 72adb770f7
commit 618f3ab930
2 changed files with 20 additions and 1 deletions

View File

@@ -50,6 +50,11 @@ public:
using TemplateProperty<T>::operator=;
protected:
static const std::string MinimumValueKey;
static const std::string MaximumValueKey;
std::string generateAdditionalDescription() const;
T _minimumValue;
T _maximumValue;
};

View File

@@ -142,6 +142,13 @@ namespace properties {
return PropertyDelegate<TemplateProperty<TYPE>>::typeLua(); \
}
template <typename T>
const std::string NumericalProperty<T>::MinimumValueKey = "MinimumValue";
template <typename T>
const std::string NumericalProperty<T>::MaximumValueKey = "MaximumValueKey";
// Delegating constructors are necessary; automatic template deduction cannot
// deduce template argument for 'U' if 'default' methods are used as default values in
// a single constructor
@@ -199,7 +206,6 @@ int NumericalProperty<T>::typeLua() const {
return PropertyDelegate<NumericalProperty<T>>::typeLua();
}
template <typename T>
T NumericalProperty<T>::minValue() const {
return _minimumValue;
@@ -210,5 +216,13 @@ T NumericalProperty<T>::maxValue() const {
return _maximumValue;
}
template <typename T>
std::string NumericalProperty<T>::generateAdditionalDescription() const {
std::string result;
result += MinimumValueKey + " = " + std::to_string(_minimumValue) + ",";
result += MaximumValueKey + " = " + std::to_string(_maximumValue);
return result;
}
} // namespace properties
} // namespace openspace