#include "stdafx.h" #include "v8datamodel/NumberRange.h" namespace RBX { NumberRange::NumberRange(float a, float b) : min(a), max(b) { if (b>nr.min>>nr.max; return nr; } namespace Reflection { template<> int TypedPropertyDescriptor::getDataSize( const DescribedBase* instance ) const { return sizeof(NumberRange); } template<> void TypedPropertyDescriptor::readValue(DescribedBase* instance, const XmlElement* element, IReferenceBinder& binder) const { std::string nodeval; element->getValue(nodeval); setValue(instance,fromstr(nodeval)); } template<> void TypedPropertyDescriptor::writeValue(const DescribedBase* instance, XmlElement* element) const { std::string nodeval = tostr( getValue(instance) ); element->setValue(nodeval); } template<> bool TypedPropertyDescriptor::hasStringValue() const { return true; } template<> std::string TypedPropertyDescriptor::getStringValue(const DescribedBase* instance) const { NumberRange range = getValue(instance); std::string text = tostr(range); return text; } template<> bool TypedPropertyDescriptor::setStringValue(DescribedBase* instance, const std::string& text) const { NumberRange range = fromstr(text); setValue(instance, range); return true; } template<> NumberRange& Variant::convert() { return genericConvert(); } template<> Reflection::Type const& Reflection::Type::getSingleton() { static TType type("NumberRange"); return type; } } // end namespace Reflection template<> bool StringConverter::convertToValue(const std::string& text, NumberRange& value) { if (text.empty()) return false; value = fromstr(text); return true; } template<> std::string StringConverter::convertToString(const NumberRange& value) { return tostr(value); } }