84 template<Property property, typename Function> |
84 template<Property property, typename Function> |
85 void handle(SetPropertyResult* result, const PropertyKeyValue& pair, Function function); |
85 void handle(SetPropertyResult* result, const PropertyKeyValue& pair, Function function); |
86 virtual void setProperty(SetPropertyResult* result, const PropertyKeyValue& pair); |
86 virtual void setProperty(SetPropertyResult* result, const PropertyKeyValue& pair); |
87 }; |
87 }; |
88 |
88 |
|
89 /** |
|
90 * @brief Tests whether the object is exactly of the specified type |
|
91 * @tparam R Type of LDraw line type object to test for |
|
92 * @param object Object to test |
|
93 * @returns whether the type of the object specified by @c id is the same type as R. Returns false if it is a subclass. |
|
94 */ |
|
95 template<typename R> |
|
96 bool isA(const ldraw::Object* object) |
|
97 { |
|
98 const std::type_info& a = typeid(*object); |
|
99 const std::type_info& b = typeid(R); |
|
100 return a == b; |
|
101 } |
|
102 |
89 template<ldraw::Property property> |
103 template<ldraw::Property property> |
90 ldraw::Object::SetPropertyResult ldraw::Object::setProperty(const ldraw::PropertyType<property>& value) |
104 ldraw::Object::SetPropertyResult ldraw::Object::setProperty(const ldraw::PropertyType<property>& value) |
91 { |
105 { |
92 SetPropertyResult result = SetPropertyResult::PropertyNotHandled; |
106 SetPropertyResult result = SetPropertyResult::PropertyNotHandled; |
93 this->setProperty(&result, PropertyKeyValue{property, QVariant::fromValue(value)}); |
107 this->setProperty(&result, PropertyKeyValue{property, QVariant::fromValue(value)}); |