Fix issues:
+ improve formatting + remove superfluous semicolons + comment unused parameters + rename Initialisation to Initialization + rename Deinitialisation to Finalization + remove spaces
This commit is contained in:
@@ -1136,15 +1136,15 @@ void Application::initTypes(void)
|
||||
App ::PropertyExpressionEngine ::init();
|
||||
|
||||
// Extension classes
|
||||
App ::Extension ::init();
|
||||
App ::ExtensionContainer ::init();
|
||||
App ::DocumentObjectExtension ::init();
|
||||
App ::GroupExtension ::init();
|
||||
App ::GroupExtensionPython ::init();
|
||||
App ::GeoFeatureGroupExtension ::init();
|
||||
App ::Extension ::init();
|
||||
App ::ExtensionContainer ::init();
|
||||
App ::DocumentObjectExtension ::init();
|
||||
App ::GroupExtension ::init();
|
||||
App ::GroupExtensionPython ::init();
|
||||
App ::GeoFeatureGroupExtension ::init();
|
||||
App ::GeoFeatureGroupExtensionPython::init();
|
||||
App ::OriginGroupExtension ::init();
|
||||
App ::OriginGroupExtensionPython::init();
|
||||
App ::OriginGroupExtension ::init();
|
||||
App ::OriginGroupExtensionPython ::init();
|
||||
|
||||
// Document classes
|
||||
App ::TransactionalObject ::init();
|
||||
|
||||
@@ -95,10 +95,10 @@ DocumentObjectExecReturn *DocumentObject::execute(void)
|
||||
{
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
for(auto ext : vector) {
|
||||
if(ext->extensionMustExecute())
|
||||
ext->extensionExecute();
|
||||
|
||||
}
|
||||
return StdReturn;
|
||||
}
|
||||
|
||||
@@ -106,13 +106,13 @@ short DocumentObject::mustExecute(void) const
|
||||
{
|
||||
if(isTouched())
|
||||
return 1;
|
||||
|
||||
|
||||
//ask all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
for(auto ext : vector) {
|
||||
if(ext->extensionMustExecute())
|
||||
return 1;
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -388,24 +388,24 @@ void DocumentObject::connectRelabelSignals()
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentObject::onSettingDocument() {
|
||||
|
||||
void DocumentObject::onSettingDocument()
|
||||
{
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
ext->onExtendedSettingDocument();
|
||||
}
|
||||
|
||||
void DocumentObject::setupObject() {
|
||||
|
||||
void DocumentObject::setupObject()
|
||||
{
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
ext->onExtendedSetupObject();
|
||||
}
|
||||
|
||||
void DocumentObject::unsetupObject() {
|
||||
|
||||
void DocumentObject::unsetupObject()
|
||||
{
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
/// returns the type name of the ViewProviderExtension which is automatically attached
|
||||
/// to the viewprovider object when it is initiated
|
||||
virtual const char* getViewProviderExtensionName(void) const {return "";};
|
||||
virtual const char* getViewProviderExtensionName(void) const {return "";}
|
||||
};
|
||||
|
||||
} //App
|
||||
|
||||
@@ -39,12 +39,12 @@ std::string DocumentObjectExtensionPy::representation(void) const
|
||||
return std::string("<document object extension>");
|
||||
}
|
||||
|
||||
PyObject *DocumentObjectExtensionPy::getCustomAttributes(const char* attr) const
|
||||
PyObject *DocumentObjectExtensionPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DocumentObjectExtensionPy::setCustomAttributes(const char* attr, PyObject *obj)
|
||||
int DocumentObjectExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
/// returns the type name of the ViewProvider
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderDocumentObjectGroup";
|
||||
};
|
||||
}
|
||||
|
||||
virtual PyObject *getPyObject(void);
|
||||
};
|
||||
|
||||
@@ -186,4 +186,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::ExtensionPython, App::ExtensionPython::I
|
||||
|
||||
// explicit template instantiation
|
||||
template class AppExport ExtensionPythonT<Extension>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
Namespace="App"
|
||||
FatherInclude="App/PropertyContainerPy.h"
|
||||
FatherNamespace="App"
|
||||
Initialisation="true"
|
||||
Initialization="true"
|
||||
Constructor = "true">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Stefan Troeger" EMail="stefantroeger@gmx.net" />
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "DocumentObject.h"
|
||||
|
||||
// inclution of the generated files (generated out of PropertyContainerPy.xml)
|
||||
#include "ExtensionContainerPy.h"
|
||||
#include "ExtensionContainerPy.cpp"
|
||||
#include <App/ExtensionContainerPy.h>
|
||||
#include <App/ExtensionContainerPy.cpp>
|
||||
|
||||
using namespace App;
|
||||
|
||||
@@ -42,16 +42,16 @@ std::string ExtensionContainerPy::representation(void) const
|
||||
return std::string("<extension>");
|
||||
}
|
||||
|
||||
int ExtensionContainerPy::initialisation() {
|
||||
|
||||
int ExtensionContainerPy::initialization() {
|
||||
|
||||
if (this->ob_type->tp_dict == NULL) {
|
||||
if (PyType_Ready(this->ob_type) < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin();
|
||||
for(; it != this->getExtensionContainerPtr()->extensionEnd(); ++it) {
|
||||
|
||||
|
||||
PyObject* obj = (*it).second->getExtensionPyObject();
|
||||
PyMethodDef* tmpptr = (PyMethodDef*)obj->ob_type->tp_methods;
|
||||
while(tmpptr->ml_name) {
|
||||
@@ -66,10 +66,10 @@ int ExtensionContainerPy::initialisation() {
|
||||
++tmpptr;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ExtensionContainerPy::deinitialisation() {
|
||||
int ExtensionContainerPy::finalization() {
|
||||
/*
|
||||
//we need to delete all added python extensions, as we are the owner!
|
||||
ExtensionContainer::ExtensionIterator it = this->getExtensionContainerPtr()->extensionBegin();
|
||||
@@ -78,7 +78,7 @@ int ExtensionContainerPy::deinitialisation() {
|
||||
delete (*it).second;
|
||||
}*/
|
||||
return 1;
|
||||
};
|
||||
}
|
||||
|
||||
PyObject* ExtensionContainerPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
{
|
||||
@@ -92,18 +92,18 @@ int ExtensionContainerPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject *ExtensionContainerPy::getCustomAttributes(const char* attr) const
|
||||
{
|
||||
PyObject *ExtensionContainerPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExtensionContainerPy::setCustomAttributes(const char* attr, PyObject *obj)
|
||||
{
|
||||
int ExtensionContainerPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
|
||||
|
||||
|
||||
char *type;
|
||||
if (!PyArg_ParseTuple(args, "s", &type))
|
||||
return NULL; // NULL triggers exception
|
||||
@@ -115,7 +115,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
|
||||
str << "No extension found of type '" << type << "'" << std::ends;
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
|
||||
}
|
||||
|
||||
|
||||
if(getExtensionContainerPtr()->hasExtension(extension)) {
|
||||
Py_INCREF(Py_True);
|
||||
return Py_True;
|
||||
@@ -125,7 +125,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
|
||||
}
|
||||
|
||||
PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
|
||||
|
||||
|
||||
char *type;
|
||||
PyObject* proxy;
|
||||
if (!PyArg_ParseTuple(args, "sO", &type, &proxy))
|
||||
@@ -138,7 +138,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
|
||||
str << "No extension found of type '" << type << "'" << std::ends;
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
|
||||
}
|
||||
|
||||
|
||||
//register the extension
|
||||
App::Extension* ext = static_cast<App::Extension*>(extension.createInstance());
|
||||
//check if this really is a python extension!
|
||||
@@ -147,10 +147,10 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
|
||||
std::stringstream str;
|
||||
str << "Extension is not a python addable version: '" << type << "'" << std::ends;
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ext->initExtension(getExtensionContainerPtr());
|
||||
|
||||
|
||||
//set the proxy to allow python overrides
|
||||
App::Property* pp = ext->extensionGetPropertyByName("ExtensionProxy");
|
||||
if(!pp) {
|
||||
@@ -159,7 +159,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
|
||||
}
|
||||
static_cast<PropertyPythonObject*>(pp)->setPyObject(proxy);
|
||||
|
||||
|
||||
//make sure all functions of the extension are acessible through this object
|
||||
PyMethodDef* tmpptr = (PyMethodDef*)ext->getExtensionPyObject()->ob_type->tp_methods;
|
||||
while(tmpptr->ml_name) {
|
||||
@@ -167,12 +167,12 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
|
||||
// self is added to the functions arguments list. FreeCAD py implementations are not
|
||||
// made to handle this, the do not accept self as argument. Hence we only use function
|
||||
PyObject *func = PyCFunction_New(tmpptr, ext->getExtensionPyObject());
|
||||
//PyObject *method = PyMethod_New(func, (PyObject*)this, PyObject_Type((PyObject*)this));
|
||||
//PyObject *method = PyMethod_New(func, (PyObject*)this, PyObject_Type((PyObject*)this));
|
||||
PyDict_SetItem(this->ob_type->tp_dict, PyString_FromString(tmpptr->ml_name), func);
|
||||
Py_DECREF(func);
|
||||
//Py_DECREF(method);
|
||||
++tmpptr;
|
||||
}
|
||||
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "Application.h"
|
||||
|
||||
// inclution of the generated files (generated out of PropertyContainerPy.xml)
|
||||
#include "ExtensionPy.h"
|
||||
#include "ExtensionPy.cpp"
|
||||
#include <App/ExtensionPy.h>
|
||||
#include <App/ExtensionPy.cpp>
|
||||
|
||||
using namespace App;
|
||||
|
||||
@@ -41,12 +41,12 @@ std::string ExtensionPy::representation(void) const
|
||||
return std::string("<extension>");
|
||||
}
|
||||
|
||||
PyObject *ExtensionPy::getCustomAttributes(const char* attr) const
|
||||
PyObject *ExtensionPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExtensionPy::setCustomAttributes(const char* attr, PyObject *obj)
|
||||
int ExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -152,4 +152,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::GeoFeatureGroupExtensionPython, App::Geo
|
||||
|
||||
// explicit template instantiation
|
||||
template class AppExport ExtensionPythonT<GroupExtensionPythonT<GeoFeatureGroupExtension>>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,4 +137,4 @@ EXTENSION_PROPERTY_SOURCE_TEMPLATE(App::OriginGroupExtensionPython, App::OriginG
|
||||
|
||||
// explicit template instantiation
|
||||
template class AppExport ExtensionPythonT<GroupExtensionPythonT<OriginGroupExtension>>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user