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:
@@ -216,7 +216,7 @@ class GenerateModel:
|
||||
|
||||
class PythonExport:
|
||||
subclass = None
|
||||
def __init__(self, FatherNamespace='', RichCompare=0, Name='', Reference=0, FatherInclude='', Father='', Namespace='', Twin='', Constructor=0, TwinPointer='', Include='', NumberProtocol=0, Delete=0, Documentation=None, Methode=None, Attribute=None, Sequence=None, CustomAttributes='', ClassDeclarations='', Initialisation=0):
|
||||
def __init__(self, FatherNamespace='', RichCompare=0, Name='', Reference=0, FatherInclude='', Father='', Namespace='', Twin='', Constructor=0, TwinPointer='', Include='', NumberProtocol=0, Delete=0, Documentation=None, Methode=None, Attribute=None, Sequence=None, CustomAttributes='', ClassDeclarations='', Initialization=0):
|
||||
self.FatherNamespace = FatherNamespace
|
||||
self.RichCompare = RichCompare
|
||||
self.Name = Name
|
||||
@@ -231,7 +231,7 @@ class PythonExport:
|
||||
self.NumberProtocol = NumberProtocol
|
||||
self.Delete = Delete
|
||||
self.Documentation = Documentation
|
||||
self.Initialisation = Initialisation
|
||||
self.Initialization = Initialization
|
||||
if Methode is None:
|
||||
self.Methode = []
|
||||
else:
|
||||
@@ -249,8 +249,8 @@ class PythonExport:
|
||||
else:
|
||||
return PythonExport(*args_, **kwargs_)
|
||||
factory = staticmethod(factory)
|
||||
def getInitialisation(self): return self.Initialisation
|
||||
def setInitialisation(self, Initialisation): self.Initialisation = Initialisation
|
||||
def getInitialization(self): return self.Initialization
|
||||
def setInitialization(self, Initialization): self.Initialization = Initialization
|
||||
def getDocumentation(self): return self.Documentation
|
||||
def setDocumentation(self, Documentation): self.Documentation = Documentation
|
||||
def getMethode(self): return self.Methode
|
||||
@@ -314,8 +314,8 @@ class PythonExport:
|
||||
outfile.write(' Twin="%s"' % (self.getTwin(), ))
|
||||
if self.getConstructor() is not None:
|
||||
outfile.write(' Constructor="%s"' % (self.getConstructor(), ))
|
||||
if self.getInitialisation() is not None:
|
||||
outfile.write(' Initialisation="%s"' % (self.getInitialisation(), ))
|
||||
if self.getInitialization() is not None:
|
||||
outfile.write(' Initialization="%s"' % (self.getInitialization(), ))
|
||||
outfile.write(' TwinPointer="%s"' % (self.getTwinpointer(), ))
|
||||
outfile.write(' Include="%s"' % (self.getInclude(), ))
|
||||
if self.getNumberprotocol() is not None:
|
||||
@@ -359,7 +359,7 @@ class PythonExport:
|
||||
showIndent(outfile, level)
|
||||
outfile.write('Constructor = "%s",\n' % (self.getConstructor(),))
|
||||
showIndent(outfile, level)
|
||||
outfile.write('Initialisation = "%s",\n' % (self.getInitialisation(),))
|
||||
outfile.write('Initialization = "%s",\n' % (self.getInitialization(),))
|
||||
outfile.write('TwinPointer = "%s",\n' % (self.getTwinpointer(),))
|
||||
showIndent(outfile, level)
|
||||
outfile.write('Include = "%s",\n' % (self.getInclude(),))
|
||||
@@ -448,13 +448,13 @@ class PythonExport:
|
||||
self.Constructor = 0
|
||||
else:
|
||||
raise ValueError('Bad boolean attribute (Constructor)')
|
||||
if attrs.get('Initialisation'):
|
||||
if attrs.get('Initialisation').value in ('true', '1'):
|
||||
self.Initialisation = 1
|
||||
elif attrs.get('Initialisation').value in ('false', '0'):
|
||||
self.Initialisation = 0
|
||||
if attrs.get('Initialization'):
|
||||
if attrs.get('Initialization').value in ('true', '1'):
|
||||
self.Initialization = 1
|
||||
elif attrs.get('Initialization').value in ('false', '0'):
|
||||
self.Initialization = 0
|
||||
else:
|
||||
raise ValueError('Bad boolean attribute (Initialisation)')
|
||||
raise ValueError('Bad boolean attribute (Initialization)')
|
||||
if attrs.get('TwinPointer'):
|
||||
self.TwinPointer = attrs.get('TwinPointer').value
|
||||
if attrs.get('Include'):
|
||||
@@ -507,7 +507,7 @@ class PythonExport:
|
||||
ClassDeclarations_ += text__content_.nodeValue
|
||||
self.ClassDeclarations = ClassDeclarations_
|
||||
elif child_.nodeType == Node.ELEMENT_NODE and \
|
||||
nodeName_ == 'Initialisation':
|
||||
nodeName_ == 'Initialization':
|
||||
obj_ = Documentation.factory()
|
||||
obj_.build(child_)
|
||||
self.setDocumentation(obj_)
|
||||
@@ -1845,14 +1845,14 @@ class SaxGeneratemodelHandler(handler.ContentHandler):
|
||||
obj.setConstructor(0)
|
||||
else:
|
||||
self.reportError('"Constructor" attribute must be boolean ("true", "1", "false", "0")')
|
||||
val = attrs.get('Initialisation', None)
|
||||
val = attrs.get('Initialization', None)
|
||||
if val is not None:
|
||||
if val in ('true', '1'):
|
||||
obj.setInitialisation(1)
|
||||
obj.setInitialization(1)
|
||||
elif val in ('false', '0'):
|
||||
obj.setInitialisation(0)
|
||||
obj.setInitialization(0)
|
||||
else:
|
||||
self.reportError('"Initialisation" attribute must be boolean ("true", "1", "false", "0")')
|
||||
self.reportError('"Initialization" attribute must be boolean ("true", "1", "false", "0")')
|
||||
val = attrs.get('TwinPointer', None)
|
||||
if val is not None:
|
||||
obj.setTwinpointer(val)
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
static PyObject * richCompare(PyObject *v, PyObject *w, int op);
|
||||
-
|
||||
static PyGetSetDef GetterSetter[];
|
||||
virtual PyTypeObject *GetType(void) {return &Type;};
|
||||
virtual PyTypeObject *GetType(void) {return &Type;}
|
||||
|
||||
public:
|
||||
@self.export.Name@(@self.export.TwinPointer@ *pcObject, PyTypeObject *T = &Type);
|
||||
@@ -68,9 +68,9 @@ public:
|
||||
virtual int PyInit(PyObject* args, PyObject*k);
|
||||
~@self.export.Name@();
|
||||
|
||||
+ if (self.export.Initialisation):
|
||||
int initialisation();
|
||||
int deinitialisation();
|
||||
+ if (self.export.Initialization):
|
||||
int initialization();
|
||||
int finalization();
|
||||
-
|
||||
|
||||
typedef @self.export.TwinPointer@* PointerType ;
|
||||
@@ -612,8 +612,8 @@ int @self.export.Name@::staticCallback_set@i.Name@ (PyObject *self, PyObject *va
|
||||
pcObject->ref();
|
||||
-
|
||||
|
||||
+ if (self.export.Initialisation):
|
||||
initialisation();
|
||||
+ if (self.export.Initialization):
|
||||
initialization();
|
||||
-
|
||||
}
|
||||
|
||||
@@ -645,8 +645,8 @@ int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
@self.export.Name@::PointerType ptr = static_cast<@self.export.Name@::PointerType>(_pcTwinPointer);
|
||||
delete ptr;
|
||||
-
|
||||
+ if (self.export.Initialisation):
|
||||
deinitialisation();
|
||||
+ if (self.export.Initialization):
|
||||
finalization();
|
||||
-
|
||||
}
|
||||
|
||||
@@ -820,12 +820,12 @@ int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
}
|
||||
-
|
||||
|
||||
+ if (self.export.Initialisation):
|
||||
int @self.export.Name@::initialisation()
|
||||
+ if (self.export.Initialization):
|
||||
int @self.export.Name@::initialization()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int @self.export.Name@::deinitialisation()
|
||||
int @self.export.Name@::finalization()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user