Simplify logic using freecad_dynamic_cast
This commit is contained in:
@@ -329,17 +329,19 @@ bool Sheet::exportToFile(const std::string& filename,
|
||||
|
||||
std::stringstream field;
|
||||
|
||||
if (prop->isDerivedFrom((PropertyQuantity::getClassTypeId()))) {
|
||||
field << static_cast<PropertyQuantity*>(prop)->getValue();
|
||||
using Base::freecad_dynamic_cast;
|
||||
|
||||
if (auto p = freecad_dynamic_cast<PropertyQuantity>(prop)) {
|
||||
field << p->getValue();
|
||||
}
|
||||
else if (prop->isDerivedFrom((PropertyFloat::getClassTypeId()))) {
|
||||
field << static_cast<PropertyFloat*>(prop)->getValue();
|
||||
else if (auto p = freecad_dynamic_cast<PropertyFloat>(prop)) {
|
||||
field << p->getValue();
|
||||
}
|
||||
else if (prop->isDerivedFrom((PropertyInteger::getClassTypeId()))) {
|
||||
field << static_cast<PropertyInteger*>(prop)->getValue();
|
||||
else if (auto p = freecad_dynamic_cast<PropertyInteger>(prop)) {
|
||||
field << p->getValue();
|
||||
}
|
||||
else if (prop->isDerivedFrom((PropertyString::getClassTypeId()))) {
|
||||
field << static_cast<PropertyString*>(prop)->getValue();
|
||||
else if (auto p = freecad_dynamic_cast<PropertyString>(prop)) {
|
||||
field << p->getValue();
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
|
||||
Reference in New Issue
Block a user