Part: Move default geometry extension for int to internally use long

This commit is contained in:
Abdullah Tahiri
2019-02-10 14:28:46 +01:00
committed by wmayer
parent 75fdacb342
commit 062037ffff
3 changed files with 6 additions and 6 deletions

View File

@@ -83,20 +83,20 @@ PyObject * GeometryDefaultExtension<T>::getPyObject(void)
// ----------------------------- Template specialisations----------------------------------------------------
//typedef Part::GeometryDefaultExtension<int> GeometryIntExtension;
//typedef Part::GeometryDefaultExtension<long> GeometryIntExtension;
//typedef Part::GeometryStringExtension<std::string> GeometryStringExtension;
// ---------- GeometryIntExtension ----------
TYPESYSTEM_SOURCE_TEMPLATE_T(Part::GeometryIntExtension,Part::GeometryExtension)
template <>
PyObject * GeometryDefaultExtension<int>::getPyObject(void)
PyObject * GeometryDefaultExtension<long>::getPyObject(void)
{
return new GeometryIntExtensionPy(new GeometryIntExtension(this->value));
}
template <>
void GeometryDefaultExtension<int>::Restore(Base::XMLReader &reader)
void GeometryDefaultExtension<long>::Restore(Base::XMLReader &reader)
{
value = reader.getAttributeAsInteger("value");
}

View File

@@ -83,7 +83,7 @@ namespace Part {
// 6. Register your type and corresponding python type in AppPart.cpp
// Prefer alias to typedef item 9
using GeometryIntExtension = GeometryDefaultExtension<int>;
using GeometryIntExtension = GeometryDefaultExtension<long>;
using GeometryStringExtension = GeometryDefaultExtension<std::string>;
}

View File

@@ -55,7 +55,7 @@ int GeometryIntExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
PyErr_Clear();
int Id;
long Id;
if (PyArg_ParseTuple(args, "i", &Id)) {
this->getGeometryIntExtensionPtr()->setValue(Id);
return 0;
@@ -65,7 +65,7 @@ int GeometryIntExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
PyErr_SetString(PyExc_TypeError, "GeometryIntExtension constructor accepts:\n"
"-- empty parameter list\n"
"-- int\n");
"-- long int\n");
return -1;
}