#pragma once #include #include namespace mdd { class IPropertyValue { public: virtual ~IPropertyValue(){} virtual std::string GetPropertyType() = 0; }; template class PropertyValue : public IPropertyValue { public: std::string GetPropertyType() { return typeid(TYPE).name(); } std::shared_ptr value = std::make_shared(); }; class IProperty { protected: virtual IPropertyValue* GetPropertyValue() = 0; public: virtual ~IProperty(){} virtual std::shared_ptr GetSubProp(const std::string& name) = 0; template std::shared_ptr Value() { if (GetPropertyValue()->GetPropertyType() != typeid(EXPECTED_TYPE).name()) { return std::make_shared(); } else { return dynamic_cast>(GetPropertyValue())->value; } } }; }