App: Apply clang format (part 1)

This commit is contained in:
wmayer
2024-11-15 17:43:49 +01:00
committed by wwmayer
parent 463cc08f3f
commit 6f5259af26
124 changed files with 6733 additions and 4886 deletions

View File

@@ -42,7 +42,7 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(App::Part, App::GeoFeature)
Part::Part()
{
ADD_PROPERTY(Type,(""));
ADD_PROPERTY(Type, (""));
ADD_PROPERTY_TYPE(Material, (nullptr), 0, App::Prop_None, "The Material for this Part");
ADD_PROPERTY_TYPE(Meta, (), 0, App::Prop_None, "Map with additional meta information");
@@ -62,22 +62,25 @@ Part::Part()
Part::~Part() = default;
static App::Part *_getPartOfObject(const DocumentObject *obj,
std::set<const DocumentObject*> *objset)
static App::Part* _getPartOfObject(const DocumentObject* obj,
std::set<const DocumentObject*>* objset)
{
// as a Part is a geofeaturegroup it must directly link to all
// objects it contains, even if they are in additional groups etc.
// But we still must call 'hasObject()' to exclude link brought in by
// expressions.
for (auto inObj : obj->getInList()) {
if (objset && !objset->insert(inObj).second)
if (objset && !objset->insert(inObj).second) {
continue;
}
auto group = inObj->getExtensionByType<GeoFeatureGroupExtension>(true);
if(group && group->hasObject(obj)) {
if(inObj->isDerivedFrom(App::Part::getClassTypeId()))
if (group && group->hasObject(obj)) {
if (inObj->isDerivedFrom(App::Part::getClassTypeId())) {
return static_cast<App::Part*>(inObj);
else if (objset)
}
else if (objset) {
return _getPartOfObject(inObj, objset);
}
// Only one parent geofeature group per object, so break
break;
}
@@ -86,35 +89,41 @@ static App::Part *_getPartOfObject(const DocumentObject *obj,
return nullptr;
}
App::Part *Part::getPartOfObject (const DocumentObject* obj, bool recursive) {
if (!recursive)
App::Part* Part::getPartOfObject(const DocumentObject* obj, bool recursive)
{
if (!recursive) {
return _getPartOfObject(obj, nullptr);
std::set<const DocumentObject *> objset;
}
std::set<const DocumentObject*> objset;
objset.insert(obj);
return _getPartOfObject(obj, &objset);
}
PyObject *Part::getPyObject()
PyObject* Part::getPyObject()
{
if (PythonObject.is(Py::_None())){
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new PartPy(this),true);
PythonObject = Py::Object(new PartPy(this), true);
}
return Py::new_reference_to(PythonObject);
}
void Part::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
void Part::handleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
App::Property* prop)
{
// Migrate Material from App::PropertyMap to App::PropertyLink
if (!strcmp(TypeName, "App::PropertyMap")) {
App::PropertyMap oldvalue;
oldvalue.Restore(reader);
if (oldvalue.getSize()) {
auto oldprop = static_cast<App::PropertyMap*>(addDynamicProperty("App::PropertyMap", "Material_old", "Base"));
auto oldprop = static_cast<App::PropertyMap*>(
addDynamicProperty("App::PropertyMap", "Material_old", "Base"));
oldprop->setValues(oldvalue.getValues());
}
} else {
}
else {
App::GeoFeature::handleChangedPropertyType(reader, TypeName, prop);
}
}
@@ -124,21 +133,21 @@ void Part::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeNa
// Not quite sure yet making Part derivable in Python is good Idea!
// JR 2014
//namespace App {
// namespace App {
///// @cond DOXERR
//PROPERTY_SOURCE_TEMPLATE(App::PartPython, App::Part)
//template<> const char* App::PartPython::getViewProviderName(void) const {
// return "Gui::ViewProviderPartPython";
//}
//template<> PyObject* App::PartPython::getPyObject(void) {
// if (PythonObject.is(Py::_None())) {
// // ref counter is set to 1
// PythonObject = Py::Object(new FeaturePythonPyT<App::PartPy>(this),true);
// }
// return Py::new_reference_to(PythonObject);
//}
// PROPERTY_SOURCE_TEMPLATE(App::PartPython, App::Part)
// template<> const char* App::PartPython::getViewProviderName(void) const {
// return "Gui::ViewProviderPartPython";
// }
// template<> PyObject* App::PartPython::getPyObject(void) {
// if (PythonObject.is(Py::_None())) {
// // ref counter is set to 1
// PythonObject = Py::Object(new FeaturePythonPyT<App::PartPy>(this),true);
// }
// return Py::new_reference_to(PythonObject);
// }
///// @endcond
//
//// explicit template instantiation
//template class AppExport FeaturePythonT<App::Part>;
//}
// template class AppExport FeaturePythonT<App::Part>;
// }