App: Use freecad_cast whenever possible

This commit is contained in:
Kacper Donat
2025-04-25 00:05:39 +02:00
committed by Benjamin Nauck
parent 929f926846
commit ad3420e126
6 changed files with 21 additions and 21 deletions

View File

@@ -1442,7 +1442,7 @@ void PropertyString::setValue(const char* newValue)
std::vector<std::pair<Property*, std::unique_ptr<Property>>> propChanges;
std::string newValueStr = newValue;
auto obj = dynamic_cast<DocumentObject*>(getContainer());
auto obj = freecad_cast<DocumentObject*>(getContainer());
bool commit = false;
if (obj && this == &obj->Label) {
@@ -1510,7 +1510,7 @@ void PropertyString::setPyObject(PyObject* value)
void PropertyString::Save(Base::Writer& writer) const
{
std::string val;
auto obj = dynamic_cast<DocumentObject*>(getContainer());
auto obj = freecad_cast<DocumentObject*>(getContainer());
writer.Stream() << writer.ind() << "<String ";
bool exported = false;
if (obj && obj->isAttachedToDocument() && obj->isExporting() && &obj->Label == this) {
@@ -1534,7 +1534,7 @@ void PropertyString::Restore(Base::XMLReader& reader)
// read my Element
reader.readElement("String");
// get the value of my Attribute
auto obj = dynamic_cast<DocumentObject*>(getContainer());
auto obj = freecad_cast<DocumentObject*>(getContainer());
if (obj && &obj->Label == this) {
if (reader.hasAttribute("restore")) {
int restore = reader.getAttributeAsInteger("restore");