Points: modernize C++11

* remove redundant void-arg
* use nullptr
This commit is contained in:
wmayer
2022-01-26 17:53:41 +01:00
parent 4b788d0413
commit 4398ae54dd
19 changed files with 118 additions and 117 deletions

View File

@@ -115,7 +115,7 @@ private:
App::Document* pcDoc = App::GetApplication().newDocument("Unnamed"); App::Document* pcDoc = App::GetApplication().newDocument("Unnamed");
Points::Feature* pcFeature = 0; Points::Feature* pcFeature = nullptr;
if (reader->hasProperties()) { if (reader->hasProperties()) {
// Scattered or structured points? // Scattered or structured points?
if (reader->isStructured()) { if (reader->isStructured()) {
@@ -234,7 +234,7 @@ private:
pcDoc = App::GetApplication().newDocument(DocName); pcDoc = App::GetApplication().newDocument(DocName);
} }
Points::Feature* pcFeature = 0; Points::Feature* pcFeature = nullptr;
if (reader->hasProperties()) { if (reader->hasProperties()) {
// Scattered or structured points? // Scattered or structured points?
if (reader->isStructured()) { if (reader->isStructured()) {

View File

@@ -56,7 +56,7 @@ PointKernel::PointKernel(const PointKernel& pts)
} }
std::vector<const char*> PointKernel::getElementTypes(void) const std::vector<const char*> PointKernel::getElementTypes() const
{ {
std::vector<const char*> temp; std::vector<const char*> temp;
//temp.push_back("Segment"); //temp.push_back("Segment");
@@ -79,7 +79,7 @@ Data::Segment* PointKernel::getSubElement(const char* /*Type*/, unsigned long /*
// return 0; // return 0;
//} //}
return 0; return nullptr;
} }
void PointKernel::transformGeometry(const Base::Matrix4D &rclMat) void PointKernel::transformGeometry(const Base::Matrix4D &rclMat)
@@ -99,7 +99,7 @@ void PointKernel::transformGeometry(const Base::Matrix4D &rclMat)
#endif #endif
} }
Base::BoundBox3d PointKernel::getBoundBox(void)const Base::BoundBox3d PointKernel::getBoundBox()const
{ {
Base::BoundBox3d bnd; Base::BoundBox3d bnd;
@@ -131,12 +131,12 @@ void PointKernel::operator = (const PointKernel& Kernel)
} }
} }
unsigned int PointKernel::getMemSize (void) const unsigned int PointKernel::getMemSize () const
{ {
return _Points.size() * sizeof(value_type); return _Points.size() * sizeof(value_type);
} }
PointKernel::size_type PointKernel::countValid(void) const PointKernel::size_type PointKernel::countValid() const
{ {
size_type num = 0; size_type num = 0;
for (const_point_iterator it = begin(); it != end(); ++it) { for (const_point_iterator it = begin(); it != end(); ++it) {

View File

@@ -52,7 +52,7 @@ public:
typedef std::vector<value_type>::difference_type difference_type; typedef std::vector<value_type>::difference_type difference_type;
typedef std::vector<value_type>::size_type size_type; typedef std::vector<value_type>::size_type size_type;
PointKernel(void) PointKernel()
{ {
} }
PointKernel(size_type size) PointKernel(size_type size)
@@ -72,14 +72,14 @@ public:
* List of different subelement types * List of different subelement types
* its NOT a list of the subelements itself * its NOT a list of the subelements itself
*/ */
virtual std::vector<const char*> getElementTypes(void) const; virtual std::vector<const char*> getElementTypes() const;
virtual unsigned long countSubElements(const char* Type) const; virtual unsigned long countSubElements(const char* Type) const;
/// get the subelement by type and number /// get the subelement by type and number
virtual Data::Segment* getSubElement(const char* Type, unsigned long) const; virtual Data::Segment* getSubElement(const char* Type, unsigned long) const;
//@} //@}
inline void setTransform(const Base::Matrix4D& rclTrf){_Mtrx = rclTrf;} inline void setTransform(const Base::Matrix4D& rclTrf){_Mtrx = rclTrf;}
inline Base::Matrix4D getTransform(void) const{return _Mtrx;} inline Base::Matrix4D getTransform() const{return _Mtrx;}
std::vector<value_type>& getBasicPoints() std::vector<value_type>& getBasicPoints()
{ return this->_Points; } { return this->_Points; }
const std::vector<value_type>& getBasicPoints() const const std::vector<value_type>& getBasicPoints() const
@@ -93,12 +93,12 @@ public:
std::vector<Base::Vector3d> &Normals, std::vector<Base::Vector3d> &Normals,
float Accuracy, uint16_t flags=0) const; float Accuracy, uint16_t flags=0) const;
virtual void transformGeometry(const Base::Matrix4D &rclMat); virtual void transformGeometry(const Base::Matrix4D &rclMat);
virtual Base::BoundBox3d getBoundBox(void)const; virtual Base::BoundBox3d getBoundBox()const;
/** @name I/O */ /** @name I/O */
//@{ //@{
// Implemented from Persistence // Implemented from Persistence
unsigned int getMemSize (void) const; unsigned int getMemSize () const;
void Save (Base::Writer &writer) const; void Save (Base::Writer &writer) const;
void SaveDocFile (Base::Writer &writer) const; void SaveDocFile (Base::Writer &writer) const;
void Restore(Base::XMLReader &reader); void Restore(Base::XMLReader &reader);
@@ -115,8 +115,8 @@ private:
public: public:
/// number of points stored /// number of points stored
size_type size(void) const {return this->_Points.size();} size_type size() const {return this->_Points.size();}
size_type countValid(void) const; size_type countValid() const;
std::vector<value_type> getValidPoints() const; std::vector<value_type> getValidPoints() const;
void resize(size_type n){_Points.resize(n);} void resize(size_type n){_Points.resize(n);}
void reserve(size_type n){_Points.reserve(n);} void reserve(size_type n){_Points.reserve(n);}
@@ -124,7 +124,7 @@ public:
_Points.erase(_Points.begin()+first,_Points.begin()+last); _Points.erase(_Points.begin()+first,_Points.begin()+last);
} }
void clear(void){_Points.clear();} void clear(){_Points.clear();}
/// get the points /// get the points

View File

@@ -980,7 +980,7 @@ void PcdReader::read(const std::string& filename)
std::vector<char> uncompressed(u); std::vector<char> uncompressed(u);
if (lzfDecompress(&compressed[0], c, &uncompressed[0], u) == u) { if (lzfDecompress(&compressed[0], c, &uncompressed[0], u) == u) {
DataStreambuf ibuf(uncompressed); DataStreambuf ibuf(uncompressed);
std::istream istr(0); std::istream istr(nullptr);
istr.rdbuf(&ibuf); istr.rdbuf(&ibuf);
readBinary(true, istr, types, sizes, data); readBinary(true, istr, types, sizes, data);
} }

View File

@@ -59,7 +59,7 @@ short Feature::mustExecute() const
return 0; return 0;
} }
App::DocumentObjectExecReturn *Feature::execute(void) App::DocumentObjectExecReturn *Feature::execute()
{ {
this->Points.touch(); this->Points.touch();
return App::DocumentObject::StdReturn; return App::DocumentObject::StdReturn;
@@ -110,7 +110,7 @@ template class PointsExport FeatureCustomT<Points::Feature>;
namespace App { namespace App {
/// @cond DOXERR /// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(Points::FeaturePython, Points::Feature) PROPERTY_SOURCE_TEMPLATE(Points::FeaturePython, Points::Feature)
template<> const char* Points::FeaturePython::getViewProviderName(void) const { template<> const char* Points::FeaturePython::getViewProviderName() const {
return "PointsGui::ViewProviderPython"; return "PointsGui::ViewProviderPython";
} }
/// @endcond /// @endcond

View File

@@ -55,8 +55,8 @@ class PointsExport Feature : public App::GeoFeature
public: public:
/// Constructor /// Constructor
Feature(void); Feature();
virtual ~Feature(void); virtual ~Feature();
/** @name methods override Feature */ /** @name methods override Feature */
//@{ //@{
@@ -64,9 +64,9 @@ public:
void RestoreDocFile(Base::Reader &reader); void RestoreDocFile(Base::Reader &reader);
short mustExecute() const; short mustExecute() const;
/// recalculate the Feature /// recalculate the Feature
virtual App::DocumentObjectExecReturn *execute(void); virtual App::DocumentObjectExecReturn *execute();
/// returns the type name of the ViewProvider /// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const { virtual const char* getViewProviderName() const {
return "PointsGui::ViewProviderScattered"; return "PointsGui::ViewProviderScattered";
} }

View File

@@ -43,8 +43,8 @@ PointsGrid::PointsGrid (const PointKernel &rclM)
RebuildGrid(); RebuildGrid();
} }
PointsGrid::PointsGrid (void) PointsGrid::PointsGrid ()
: _pclPoints(NULL), : _pclPoints(nullptr),
_ulCtElements(0), _ulCtElements(0),
_ulCtGridsX(POINTS_CT_GRID), _ulCtGridsY(POINTS_CT_GRID), _ulCtGridsZ(POINTS_CT_GRID), _ulCtGridsX(POINTS_CT_GRID), _ulCtGridsY(POINTS_CT_GRID), _ulCtGridsZ(POINTS_CT_GRID),
_fGridLenX(0.0f), _fGridLenY(0.0f), _fGridLenZ(0.0f), _fGridLenX(0.0f), _fGridLenY(0.0f), _fGridLenZ(0.0f),
@@ -93,10 +93,10 @@ void PointsGrid::Attach (const PointKernel &rclM)
RebuildGrid(); RebuildGrid();
} }
void PointsGrid::Clear (void) void PointsGrid::Clear ()
{ {
_aulGrid.clear(); _aulGrid.clear();
_pclPoints = NULL; _pclPoints = nullptr;
} }
void PointsGrid::Rebuild (unsigned long ulX, unsigned long ulY, unsigned long ulZ) void PointsGrid::Rebuild (unsigned long ulX, unsigned long ulY, unsigned long ulZ)
@@ -122,9 +122,9 @@ void PointsGrid::Rebuild (int iCtGridPerAxis)
RebuildGrid(); RebuildGrid();
} }
void PointsGrid::InitGrid (void) void PointsGrid::InitGrid ()
{ {
assert(_pclPoints != NULL); assert(_pclPoints != nullptr);
unsigned long i, j; unsigned long i, j;
@@ -645,9 +645,9 @@ void PointsGrid::Validate (const PointKernel &rclPoints)
RebuildGrid(); RebuildGrid();
} }
void PointsGrid::Validate (void) void PointsGrid::Validate ()
{ {
if (_pclPoints == NULL) if (_pclPoints == nullptr)
return; return;
if (_pclPoints->size() != _ulCtElements) if (_pclPoints->size() != _ulCtElements)
@@ -677,7 +677,7 @@ bool PointsGrid::Verify() const
return true; return true;
} }
void PointsGrid::RebuildGrid (void) void PointsGrid::RebuildGrid ()
{ {
_ulCtElements = _pclPoints->size(); _ulCtElements = _pclPoints->size();
@@ -817,8 +817,9 @@ bool PointsGridIterator::NextOnRay (std::vector<unsigned long> &raulElements)
GridElement pos(_ulX, _ulY, _ulZ); _cSearchPositions.insert(pos); GridElement pos(_ulX, _ulY, _ulZ); _cSearchPositions.insert(pos);
raulElements.insert(raulElements.end(), _rclGrid._aulGrid[_ulX][_ulY][_ulZ].begin(), _rclGrid._aulGrid[_ulX][_ulY][_ulZ].end()); raulElements.insert(raulElements.end(), _rclGrid._aulGrid[_ulX][_ulY][_ulZ].begin(), _rclGrid._aulGrid[_ulX][_ulY][_ulZ].end());
} }
else else {
_bValidRay = false; // Beam escaped _bValidRay = false; // ray exited
}
return _bValidRay; return _bValidRay;
} }

View File

@@ -54,7 +54,7 @@ public:
/// Construction /// Construction
PointsGrid (const PointKernel &rclM); PointsGrid (const PointKernel &rclM);
/// Construction /// Construction
PointsGrid (void); PointsGrid ();
/// Construction /// Construction
PointsGrid (const PointKernel &rclM, int iCtGridPerAxis); PointsGrid (const PointKernel &rclM, int iCtGridPerAxis);
/// Construction /// Construction
@@ -62,7 +62,7 @@ public:
/// Construction /// Construction
PointsGrid (const PointKernel &rclM, unsigned long ulX, unsigned long ulY, unsigned long ulZ); PointsGrid (const PointKernel &rclM, unsigned long ulX, unsigned long ulY, unsigned long ulZ);
/// Destruction /// Destruction
virtual ~PointsGrid (void) { } virtual ~PointsGrid () { }
//@} //@}
public: public:
@@ -101,7 +101,7 @@ public:
/** Returns the bounding box of a given grid element. */ /** Returns the bounding box of a given grid element. */
inline Base::BoundBox3d GetBoundBox (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const; inline Base::BoundBox3d GetBoundBox (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const;
/** Returns the bounding box of the whole. */ /** Returns the bounding box of the whole. */
inline Base::BoundBox3d GetBoundBox (void) const; inline Base::BoundBox3d GetBoundBox () const;
//@} //@}
/** Returns the number of elements in a given grid. */ /** Returns the number of elements in a given grid. */
unsigned long GetCtElements(unsigned long ulX, unsigned long ulY, unsigned long ulZ) const unsigned long GetCtElements(unsigned long ulX, unsigned long ulY, unsigned long ulZ) const
@@ -111,7 +111,7 @@ public:
/** Validates the grid structure and rebuilds it if needed. */ /** Validates the grid structure and rebuilds it if needed. */
virtual void Validate (const PointKernel &rclM); virtual void Validate (const PointKernel &rclM);
/** Validates the grid structure and rebuilds it if needed. */ /** Validates the grid structure and rebuilds it if needed. */
virtual void Validate (void); virtual void Validate ();
/** Verifies the grid structure and returns false if inconsistencies are found. */ /** Verifies the grid structure and returns false if inconsistencies are found. */
virtual bool Verify() const; virtual bool Verify() const;
/** Returns the indices of the grid this point lies in. If the point is outside the grid then the indices of /** Returns the indices of the grid this point lies in. If the point is outside the grid then the indices of
@@ -124,17 +124,17 @@ protected:
/** Checks if this is a valid grid position. */ /** Checks if this is a valid grid position. */
inline bool CheckPos (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const; inline bool CheckPos (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const;
/** Initializes the size of the internal structure. */ /** Initializes the size of the internal structure. */
virtual void InitGrid (void); virtual void InitGrid ();
/** Deletes the grid structure. */ /** Deletes the grid structure. */
virtual void Clear (void); virtual void Clear ();
/** Calculates the grid length dependent on maximum number of grids. */ /** Calculates the grid length dependent on maximum number of grids. */
virtual void CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids); virtual void CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids);
/** Calculates the grid length dependent on the number of grids per axis. */ /** Calculates the grid length dependent on the number of grids per axis. */
virtual void CalculateGridLength (int iCtGridPerAxis); virtual void CalculateGridLength (int iCtGridPerAxis);
/** Rebuilds the grid structure. */ /** Rebuilds the grid structure. */
virtual void RebuildGrid (void); virtual void RebuildGrid ();
/** Returns the number of stored elements. */ /** Returns the number of stored elements. */
unsigned long HasElements (void) const unsigned long HasElements () const
{ return _pclPoints->size(); } { return _pclPoints->size(); }
/** Get the indices of all elements lying in the grids around a given grid with distance \a ulDistance. */ /** Get the indices of all elements lying in the grids around a given grid with distance \a ulDistance. */
void GetHull (unsigned long ulX, unsigned long ulY, unsigned long ulZ, unsigned long ulDistance, std::set<unsigned long> &raclInd) const; void GetHull (unsigned long ulX, unsigned long ulY, unsigned long ulZ, unsigned long ulDistance, std::set<unsigned long> &raclInd) const;
@@ -177,7 +177,7 @@ public:
/// Construction /// Construction
PointsGridIterator (const PointsGrid &rclG); PointsGridIterator (const PointsGrid &rclG);
/** Returns the bounding box of the current grid element. */ /** Returns the bounding box of the current grid element. */
Base::BoundBox3d GetBoundBox (void) const Base::BoundBox3d GetBoundBox () const
{ return _rclGrid.GetBoundBox(_ulX, _ulY, _ulZ); } { return _rclGrid.GetBoundBox(_ulX, _ulY, _ulZ); }
/** Returns indices of the elements in the current grid. */ /** Returns indices of the elements in the current grid. */
void GetElements (std::vector<unsigned long> &raulElements) const void GetElements (std::vector<unsigned long> &raulElements) const
@@ -187,13 +187,13 @@ public:
/** @name Iteration */ /** @name Iteration */
//@{ //@{
/** Sets the iterator to the first element*/ /** Sets the iterator to the first element*/
void Init (void) void Init ()
{ _ulX = _ulY = _ulZ = 0; } { _ulX = _ulY = _ulZ = 0; }
/** Checks if the iterator has not yet reached the end position. */ /** Checks if the iterator has not yet reached the end position. */
bool More (void) const bool More () const
{ return (_ulZ < _rclGrid._ulCtGridsZ); } { return (_ulZ < _rclGrid._ulCtGridsZ); }
/** Go to the next grid. */ /** Go to the next grid. */
void Next (void) void Next ()
{ {
if (++_ulX >= (_rclGrid._ulCtGridsX)) _ulX = 0; else return; if (++_ulX >= (_rclGrid._ulCtGridsX)) _ulX = 0; else return;
if (++_ulY >= (_rclGrid._ulCtGridsY)) { _ulY = 0; _ulZ++; } else return; if (++_ulY >= (_rclGrid._ulCtGridsY)) { _ulY = 0; _ulZ++; } else return;
@@ -254,7 +254,7 @@ inline Base::BoundBox3d PointsGrid::GetBoundBox (unsigned long ulX, unsigned lo
return Base::BoundBox3d(fX, fY, fZ, fX + _fGridLenX, fY + _fGridLenY, fZ + _fGridLenZ); return Base::BoundBox3d(fX, fY, fZ, fX + _fGridLenX, fY + _fGridLenY, fZ + _fGridLenZ);
} }
inline Base::BoundBox3d PointsGrid::GetBoundBox (void) const inline Base::BoundBox3d PointsGrid::GetBoundBox () const
{ {
return Base::BoundBox3d(_fMinX, _fMinY, _fMinZ, _fMinX + (_fGridLenX * double(_ulCtGridsX)), return Base::BoundBox3d(_fMinX, _fMinY, _fMinZ, _fMinX + (_fGridLenX * double(_ulCtGridsX)),
_fMinY + (_fGridLenY * double(_ulCtGridsY)), _fMinZ + (_fGridLenZ * double(_ulCtGridsZ))); _fMinY + (_fGridLenY * double(_ulCtGridsY)), _fMinZ + (_fGridLenZ * double(_ulCtGridsZ)));

View File

@@ -36,7 +36,7 @@
using namespace Points; using namespace Points;
// returns a string which represents the object e.g. when printed in python // returns a string which represents the object e.g. when printed in python
std::string PointsPy::representation(void) const std::string PointsPy::representation() const
{ {
return std::string("<PointKernel object>"); return std::string("<PointKernel object>");
} }
@@ -50,7 +50,7 @@ PyObject *PointsPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pyt
// constructor method // constructor method
int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/) int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{ {
PyObject *pcObj=0; PyObject *pcObj=nullptr;
if (!PyArg_ParseTuple(args, "|O", &pcObj)) // convert args: Python->C if (!PyArg_ParseTuple(args, "|O", &pcObj)) // convert args: Python->C
return -1; // NULL triggers exception return -1; // NULL triggers exception
@@ -81,7 +81,7 @@ int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
PyObject* PointsPy::copy(PyObject *args) PyObject* PointsPy::copy(PyObject *args)
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ""))
return NULL; return nullptr;
PointKernel* kernel = new PointKernel(); PointKernel* kernel = new PointKernel();
// assign data // assign data
@@ -93,7 +93,7 @@ PyObject* PointsPy::read(PyObject * args)
{ {
const char* Name; const char* Name;
if (!PyArg_ParseTuple(args, "s",&Name)) if (!PyArg_ParseTuple(args, "s",&Name))
return NULL; return nullptr;
PY_TRY { PY_TRY {
getPointKernelPtr()->load(Name); getPointKernelPtr()->load(Name);
@@ -106,7 +106,7 @@ PyObject* PointsPy::write(PyObject * args)
{ {
const char* Name; const char* Name;
if (!PyArg_ParseTuple(args, "s",&Name)) if (!PyArg_ParseTuple(args, "s",&Name))
return NULL; return nullptr;
PY_TRY { PY_TRY {
getPointKernelPtr()->save(Name); getPointKernelPtr()->save(Name);
@@ -118,7 +118,7 @@ PyObject* PointsPy::write(PyObject * args)
PyObject* PointsPy::writeInventor(PyObject * args) PyObject* PointsPy::writeInventor(PyObject * args)
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ""))
return NULL; return nullptr;
std::stringstream result; std::stringstream result;
Base::InventorBuilder builder(result); Base::InventorBuilder builder(result);
@@ -137,7 +137,7 @@ PyObject* PointsPy::addPoints(PyObject * args)
{ {
PyObject *obj; PyObject *obj;
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return 0; return nullptr;
try { try {
Py::Sequence list(obj); Py::Sequence list(obj);
@@ -163,7 +163,7 @@ PyObject* PointsPy::addPoints(PyObject * args)
PyErr_SetString(Base::BaseExceptionFreeCADError, "either expect\n" PyErr_SetString(Base::BaseExceptionFreeCADError, "either expect\n"
"-- [Vector,...] \n" "-- [Vector,...] \n"
"-- [(x,y,z),...]"); "-- [(x,y,z),...]");
return 0; return nullptr;
} }
Py_Return; Py_Return;
@@ -173,7 +173,7 @@ PyObject* PointsPy::fromSegment(PyObject * args)
{ {
PyObject *obj; PyObject *obj;
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return 0; return nullptr;
try { try {
const PointKernel* points = getPointKernelPtr(); const PointKernel* points = getPointKernelPtr();
@@ -191,14 +191,14 @@ PyObject* PointsPy::fromSegment(PyObject * args)
} }
catch (const Py::Exception&) { catch (const Py::Exception&) {
PyErr_SetString(Base::BaseExceptionFreeCADError, "expect a list of int"); PyErr_SetString(Base::BaseExceptionFreeCADError, "expect a list of int");
return 0; return nullptr;
} }
} }
PyObject* PointsPy::fromValid(PyObject * args) PyObject* PointsPy::fromValid(PyObject * args)
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ""))
return 0; return nullptr;
try { try {
const PointKernel* points = getPointKernelPtr(); const PointKernel* points = getPointKernelPtr();
@@ -213,16 +213,16 @@ PyObject* PointsPy::fromValid(PyObject * args)
} }
catch (const Py::Exception&) { catch (const Py::Exception&) {
PyErr_SetString(Base::BaseExceptionFreeCADError, "expect a list of int"); PyErr_SetString(Base::BaseExceptionFreeCADError, "expect a list of int");
return 0; return nullptr;
} }
} }
Py::Long PointsPy::getCountPoints(void) const Py::Long PointsPy::getCountPoints() const
{ {
return Py::Long((long)getPointKernelPtr()->size()); return Py::Long((long)getPointKernelPtr()->size());
} }
Py::List PointsPy::getPoints(void) const Py::List PointsPy::getPoints() const
{ {
Py::List PointList; Py::List PointList;
const PointKernel* points = getPointKernelPtr(); const PointKernel* points = getPointKernelPtr();
@@ -234,7 +234,7 @@ Py::List PointsPy::getPoints(void) const
PyObject *PointsPy::getCustomAttributes(const char* /*attr*/) const PyObject *PointsPy::getCustomAttributes(const char* /*attr*/) const
{ {
return 0; return nullptr;
} }
int PointsPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) int PointsPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)

View File

@@ -68,7 +68,7 @@ void PropertyGreyValueList::setSize(int newSize)
_lValueList.resize(newSize); _lValueList.resize(newSize);
} }
int PropertyGreyValueList::getSize(void) const int PropertyGreyValueList::getSize() const
{ {
return static_cast<int>(_lValueList.size()); return static_cast<int>(_lValueList.size());
} }
@@ -88,7 +88,7 @@ void PropertyGreyValueList::setValues(const std::vector<float>& values)
hasSetValue(); hasSetValue();
} }
PyObject *PropertyGreyValueList::getPyObject(void) PyObject *PropertyGreyValueList::getPyObject()
{ {
PyObject* list = PyList_New(getSize()); PyObject* list = PyList_New(getSize());
for (int i = 0;i<getSize(); i++) for (int i = 0;i<getSize(); i++)
@@ -175,7 +175,7 @@ void PropertyGreyValueList::RestoreDocFile(Base::Reader &reader)
setValues(values); setValues(values);
} }
App::Property *PropertyGreyValueList::Copy(void) const App::Property *PropertyGreyValueList::Copy() const
{ {
PropertyGreyValueList *p= new PropertyGreyValueList(); PropertyGreyValueList *p= new PropertyGreyValueList();
p->_lValueList = _lValueList; p->_lValueList = _lValueList;
@@ -189,7 +189,7 @@ void PropertyGreyValueList::Paste(const App::Property &from)
hasSetValue(); hasSetValue();
} }
unsigned int PropertyGreyValueList::getMemSize (void) const unsigned int PropertyGreyValueList::getMemSize () const
{ {
return static_cast<unsigned int>(_lValueList.size() * sizeof(float)); return static_cast<unsigned int>(_lValueList.size() * sizeof(float));
} }
@@ -238,7 +238,7 @@ void PropertyNormalList::setSize(int newSize)
_lValueList.resize(newSize); _lValueList.resize(newSize);
} }
int PropertyNormalList::getSize(void) const int PropertyNormalList::getSize() const
{ {
return static_cast<int>(_lValueList.size()); return static_cast<int>(_lValueList.size());
} }
@@ -266,7 +266,7 @@ void PropertyNormalList::setValues(const std::vector<Base::Vector3f>& values)
hasSetValue(); hasSetValue();
} }
PyObject *PropertyNormalList::getPyObject(void) PyObject *PropertyNormalList::getPyObject()
{ {
PyObject* list = PyList_New(getSize()); PyObject* list = PyList_New(getSize());
@@ -349,7 +349,7 @@ void PropertyNormalList::RestoreDocFile(Base::Reader &reader)
setValues(values); setValues(values);
} }
App::Property *PropertyNormalList::Copy(void) const App::Property *PropertyNormalList::Copy() const
{ {
PropertyNormalList *p= new PropertyNormalList(); PropertyNormalList *p= new PropertyNormalList();
p->_lValueList = _lValueList; p->_lValueList = _lValueList;
@@ -363,7 +363,7 @@ void PropertyNormalList::Paste(const App::Property &from)
hasSetValue(); hasSetValue();
} }
unsigned int PropertyNormalList::getMemSize (void) const unsigned int PropertyNormalList::getMemSize () const
{ {
return static_cast<unsigned int>(_lValueList.size() * sizeof(Base::Vector3f)); return static_cast<unsigned int>(_lValueList.size() * sizeof(Base::Vector3f));
} }
@@ -565,7 +565,7 @@ void PropertyCurvatureList::removeIndices( const std::vector<unsigned long>& uIn
setValues(remainValue); setValues(remainValue);
} }
PyObject *PropertyCurvatureList::getPyObject(void) PyObject *PropertyCurvatureList::getPyObject()
{ {
throw Py::NotImplementedError("Not yet implemented"); throw Py::NotImplementedError("Not yet implemented");
} }
@@ -621,7 +621,7 @@ void PropertyCurvatureList::RestoreDocFile(Base::Reader &reader)
setValues(values); setValues(values);
} }
App::Property *PropertyCurvatureList::Copy(void) const App::Property *PropertyCurvatureList::Copy() const
{ {
PropertyCurvatureList* prop = new PropertyCurvatureList(); PropertyCurvatureList* prop = new PropertyCurvatureList();
prop->_lValueList = this->_lValueList; prop->_lValueList = this->_lValueList;
@@ -636,7 +636,7 @@ void PropertyCurvatureList::Paste(const App::Property &from)
hasSetValue(); hasSetValue();
} }
unsigned int PropertyCurvatureList::getMemSize (void) const unsigned int PropertyCurvatureList::getMemSize () const
{ {
return sizeof(CurvatureInfo) * this->_lValueList.size(); return sizeof(CurvatureInfo) * this->_lValueList.size();
} }

View File

@@ -47,7 +47,7 @@ class PointsExport PropertyGreyValue : public App::PropertyFloat
TYPESYSTEM_HEADER(); TYPESYSTEM_HEADER();
public: public:
PropertyGreyValue(void) PropertyGreyValue()
{ {
} }
virtual ~PropertyGreyValue() virtual ~PropertyGreyValue()
@@ -64,7 +64,7 @@ public:
virtual ~PropertyGreyValueList(); virtual ~PropertyGreyValueList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize() const;
/** Sets the property /** Sets the property
*/ */
@@ -80,11 +80,11 @@ public:
} }
void setValues (const std::vector<float>& values); void setValues (const std::vector<float>& values);
const std::vector<float> &getValues(void) const { const std::vector<float> &getValues() const {
return _lValueList; return _lValueList;
} }
virtual PyObject *getPyObject(void); virtual PyObject *getPyObject();
virtual void setPyObject(PyObject *); virtual void setPyObject(PyObject *);
virtual void Save (Base::Writer &writer) const; virtual void Save (Base::Writer &writer) const;
@@ -93,9 +93,9 @@ public:
virtual void SaveDocFile (Base::Writer &writer) const; virtual void SaveDocFile (Base::Writer &writer) const;
virtual void RestoreDocFile(Base::Reader &reader); virtual void RestoreDocFile(Base::Reader &reader);
virtual App::Property *Copy(void) const; virtual App::Property *Copy() const;
virtual void Paste(const App::Property &from); virtual void Paste(const App::Property &from);
virtual unsigned int getMemSize (void) const; virtual unsigned int getMemSize () const;
/** @name Modify */ /** @name Modify */
//@{ //@{
@@ -115,7 +115,7 @@ public:
~PropertyNormalList(); ~PropertyNormalList();
virtual void setSize(int newSize); virtual void setSize(int newSize);
virtual int getSize(void) const; virtual int getSize() const;
void setValue(const Base::Vector3f&); void setValue(const Base::Vector3f&);
void setValue(float x, float y, float z); void setValue(float x, float y, float z);
@@ -130,11 +130,11 @@ public:
void setValues (const std::vector<Base::Vector3f>& values); void setValues (const std::vector<Base::Vector3f>& values);
const std::vector<Base::Vector3f> &getValues(void) const { const std::vector<Base::Vector3f> &getValues() const {
return _lValueList; return _lValueList;
} }
virtual PyObject *getPyObject(void); virtual PyObject *getPyObject();
virtual void setPyObject(PyObject *); virtual void setPyObject(PyObject *);
virtual void Save (Base::Writer &writer) const; virtual void Save (Base::Writer &writer) const;
@@ -143,10 +143,10 @@ public:
virtual void SaveDocFile (Base::Writer &writer) const; virtual void SaveDocFile (Base::Writer &writer) const;
virtual void RestoreDocFile(Base::Reader &reader); virtual void RestoreDocFile(Base::Reader &reader);
virtual App::Property *Copy(void) const; virtual App::Property *Copy() const;
virtual void Paste(const App::Property &from); virtual void Paste(const App::Property &from);
virtual unsigned int getMemSize (void) const; virtual unsigned int getMemSize () const;
/** @name Modify */ /** @name Modify */
//@{ //@{
@@ -187,7 +187,7 @@ public:
void setSize(int newSize) { void setSize(int newSize) {
_lValueList.resize(newSize); _lValueList.resize(newSize);
} }
int getSize(void) const { int getSize() const {
return _lValueList.size(); return _lValueList.size();
} }
void setValue(const CurvatureInfo&); void setValue(const CurvatureInfo&);
@@ -201,11 +201,11 @@ public:
void set1Value (const int idx, const CurvatureInfo& value) { void set1Value (const int idx, const CurvatureInfo& value) {
_lValueList[idx] = value; _lValueList[idx] = value;
} }
const std::vector<CurvatureInfo> &getValues(void) const { const std::vector<CurvatureInfo> &getValues() const {
return _lValueList; return _lValueList;
} }
virtual PyObject *getPyObject(void); virtual PyObject *getPyObject();
virtual void setPyObject(PyObject *); virtual void setPyObject(PyObject *);
/** @name Save/restore */ /** @name Save/restore */
@@ -220,10 +220,10 @@ public:
/** @name Undo/Redo */ /** @name Undo/Redo */
//@{ //@{
/// returns a new copy of the property (mainly for Undo/Redo and transactions) /// returns a new copy of the property (mainly for Undo/Redo and transactions)
App::Property *Copy(void) const; App::Property *Copy() const;
/// paste the value from the property (mainly for Undo/Redo and transactions) /// paste the value from the property (mainly for Undo/Redo and transactions)
void Paste(const App::Property &from); void Paste(const App::Property &from);
unsigned int getMemSize (void) const; unsigned int getMemSize () const;
//@} //@}
/** @name Modify */ /** @name Modify */

View File

@@ -58,7 +58,7 @@ void PropertyPointKernel::setValue(const PointKernel& m)
hasSetValue(); hasSetValue();
} }
const PointKernel& PropertyPointKernel::getValue(void) const const PointKernel& PropertyPointKernel::getValue() const
{ {
return *_cPoints; return *_cPoints;
} }
@@ -73,7 +73,7 @@ Base::BoundBox3d PropertyPointKernel::getBoundingBox() const
return _cPoints->getBoundBox(); return _cPoints->getBoundBox();
} }
PyObject *PropertyPointKernel::getPyObject(void) PyObject *PropertyPointKernel::getPyObject()
{ {
PointsPy* points = new PointsPy(&*_cPoints); PointsPy* points = new PointsPy(&*_cPoints);
points->setConst(); // set immutable points->setConst(); // set immutable
@@ -132,7 +132,7 @@ void PropertyPointKernel::RestoreDocFile(Base::Reader &reader)
hasSetValue(); hasSetValue();
} }
App::Property *PropertyPointKernel::Copy(void) const App::Property *PropertyPointKernel::Copy() const
{ {
PropertyPointKernel* prop = new PropertyPointKernel(); PropertyPointKernel* prop = new PropertyPointKernel();
(*prop->_cPoints) = (*this->_cPoints); (*prop->_cPoints) = (*this->_cPoints);
@@ -147,7 +147,7 @@ void PropertyPointKernel::Paste(const App::Property &from)
hasSetValue(); hasSetValue();
} }
unsigned int PropertyPointKernel::getMemSize (void) const unsigned int PropertyPointKernel::getMemSize () const
{ {
return sizeof(Base::Vector3f) * this->_cPoints->size(); return sizeof(Base::Vector3f) * this->_cPoints->size();
} }

View File

@@ -44,7 +44,7 @@ public:
/// Sets the points to the property /// Sets the points to the property
void setValue( const PointKernel& m); void setValue( const PointKernel& m);
/// get the points (only const possible!) /// get the points (only const possible!)
const PointKernel &getValue(void) const; const PointKernel &getValue() const;
const Data::ComplexGeoData* getComplexData() const; const Data::ComplexGeoData* getComplexData() const;
//@} //@}
@@ -56,17 +56,17 @@ public:
/** @name Python interface */ /** @name Python interface */
//@{ //@{
PyObject* getPyObject(void); PyObject* getPyObject();
void setPyObject(PyObject *value); void setPyObject(PyObject *value);
//@} //@}
/** @name Undo/Redo */ /** @name Undo/Redo */
//@{ //@{
/// returns a new copy of the property (mainly for Undo/Redo and transactions) /// returns a new copy of the property (mainly for Undo/Redo and transactions)
App::Property *Copy(void) const; App::Property *Copy() const;
/// paste the value from the property (mainly for Undo/Redo and transactions) /// paste the value from the property (mainly for Undo/Redo and transactions)
void Paste(const App::Property &from); void Paste(const App::Property &from);
unsigned int getMemSize (void) const; unsigned int getMemSize () const;
//@} //@}
/** @name Save/restore */ /** @name Save/restore */

View File

@@ -79,7 +79,7 @@ Structured::~Structured()
{ {
} }
App::DocumentObjectExecReturn *Structured::execute(void) App::DocumentObjectExecReturn *Structured::execute()
{ {
std::size_t size = Height.getValue() * Width.getValue(); std::size_t size = Height.getValue() * Width.getValue();
if (size != Points.getValue().size()) if (size != Points.getValue().size())

View File

@@ -40,8 +40,8 @@ class PointsExport Structured : public Feature
public: public:
/// Constructor /// Constructor
Structured(void); Structured();
virtual ~Structured(void); virtual ~Structured();
App::PropertyInteger Width; /**< The width of the structured cloud. */ App::PropertyInteger Width; /**< The width of the structured cloud. */
App::PropertyInteger Height; /**< The height of the structured cloud. */ App::PropertyInteger Height; /**< The height of the structured cloud. */
@@ -49,9 +49,9 @@ public:
/** @name methods override Feature */ /** @name methods override Feature */
//@{ //@{
/// recalculate the Feature /// recalculate the Feature
virtual App::DocumentObjectExecReturn *execute(void); virtual App::DocumentObjectExecReturn *execute();
/// returns the type name of the ViewProvider /// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const { virtual const char* getViewProviderName() const {
return "PointsGui::ViewProviderStructured"; return "PointsGui::ViewProviderStructured";
} }
//@} //@}

View File

@@ -38,7 +38,7 @@
#include <Mod/Points/App/PropertyPointKernel.h> #include <Mod/Points/App/PropertyPointKernel.h>
// use a different name to CreateCommand() // use a different name to CreateCommand()
void CreatePointsCommands(void); void CreatePointsCommands();
void loadPointsResource() void loadPointsResource()
{ {
@@ -74,7 +74,7 @@ PyMOD_INIT_FUNC(PointsGui)
{ {
if (!Gui::Application::Instance) { if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
PyMOD_Return(0); PyMOD_Return(nullptr);
} }
// load dependent module // load dependent module
@@ -83,7 +83,7 @@ PyMOD_INIT_FUNC(PointsGui)
} }
catch(const Base::Exception& e) { catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what()); PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0); PyMOD_Return(nullptr);
} }
Base::Console().Log("Loading GUI of Points module... done\n"); Base::Console().Log("Loading GUI of Points module... done\n");

View File

@@ -96,7 +96,7 @@ void CmdPointsImport::activated(int iMsg)
} }
} }
bool CmdPointsImport::isActive(void) bool CmdPointsImport::isActive()
{ {
if (getActiveGuiDocument()) if (getActiveGuiDocument())
return true; return true;
@@ -139,7 +139,7 @@ void CmdPointsExport::activated(int iMsg)
} }
} }
bool CmdPointsExport::isActive(void) bool CmdPointsExport::isActive()
{ {
return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 0; return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 0;
} }
@@ -176,7 +176,7 @@ void CmdPointsTransform::activated(int iMsg)
commitCommand(); commitCommand();
} }
bool CmdPointsTransform::isActive(void) bool CmdPointsTransform::isActive()
{ {
return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 0; return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 0;
} }
@@ -227,7 +227,7 @@ void CmdPointsConvert::activated(int iMsg)
std::vector<Base::Vector3d> normals; std::vector<Base::Vector3d> normals;
data->getPoints(vertexes, normals, static_cast<float>(tol)); data->getPoints(vertexes, normals, static_cast<float>(tol));
if (!vertexes.empty()) { if (!vertexes.empty()) {
Points::Feature* fea = 0; Points::Feature* fea = nullptr;
if (vertexes.size() == normals.size()) { if (vertexes.size() == normals.size()) {
fea = static_cast<Points::Feature*>(Base::Type::fromName("Points::FeatureCustom").createInstance()); fea = static_cast<Points::Feature*>(Base::Type::fromName("Points::FeatureCustom").createInstance());
if (!fea) { if (!fea) {
@@ -268,7 +268,7 @@ void CmdPointsConvert::activated(int iMsg)
abortCommand(); abortCommand();
} }
bool CmdPointsConvert::isActive(void) bool CmdPointsConvert::isActive()
{ {
return getSelection().countObjectsOfType(Base::Type::fromName("App::GeoFeature")) > 0; return getSelection().countObjectsOfType(Base::Type::fromName("App::GeoFeature")) > 0;
} }
@@ -312,7 +312,7 @@ void CmdPointsPolyCut::activated(int iMsg)
} }
} }
bool CmdPointsPolyCut::isActive(void) bool CmdPointsPolyCut::isActive()
{ {
// Check for the selected mesh feature (all Mesh types) // Check for the selected mesh feature (all Mesh types)
return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 0; return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 0;
@@ -356,7 +356,7 @@ void CmdPointsMerge::activated(int iMsg)
updateActive(); updateActive();
} }
bool CmdPointsMerge::isActive(void) bool CmdPointsMerge::isActive()
{ {
return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 1; return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) > 1;
} }
@@ -464,12 +464,12 @@ void CmdPointsStructure::activated(int iMsg)
updateActive(); updateActive();
} }
bool CmdPointsStructure::isActive(void) bool CmdPointsStructure::isActive()
{ {
return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) == 1; return getSelection().countObjectsOfType(Points::Feature::getClassTypeId()) == 1;
} }
void CreatePointsCommands(void) void CreatePointsCommands()
{ {
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdPointsImport()); rcCmdMgr.addCommand(new CmdPointsImport());

View File

@@ -247,7 +247,7 @@ void ViewProviderPoints::setDisplayMode(const char* ModeName)
ViewProviderGeometryObject::setDisplayMode(ModeName); ViewProviderGeometryObject::setDisplayMode(ModeName);
} }
std::vector<std::string> ViewProviderPoints::getDisplayModes(void) const std::vector<std::string> ViewProviderPoints::getDisplayModes() const
{ {
std::vector<std::string> StrList; std::vector<std::string> StrList;
StrList.push_back("Points"); StrList.push_back("Points");
@@ -650,8 +650,8 @@ template class PointsGuiExport ViewProviderPythonFeatureT<PointsGui::ViewProvide
void ViewProviderPointsBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>& nodes) const void ViewProviderPointsBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>& nodes) const
{ {
SoCoordinate3 *pcPointsCoord=0; SoCoordinate3 *pcPointsCoord=nullptr;
SoPointSet *pcPoints=0; SoPointSet *pcPoints=nullptr;
if (nodes.empty()) { if (nodes.empty()) {
pcPointsCoord = new SoCoordinate3(); pcPointsCoord = new SoCoordinate3();

View File

@@ -84,7 +84,7 @@ public:
/// set the viewing mode /// set the viewing mode
virtual void setDisplayMode(const char* ModeName); virtual void setDisplayMode(const char* ModeName);
/// returns a list of all possible modes /// returns a list of all possible modes
virtual std::vector<std::string> getDisplayModes(void) const; virtual std::vector<std::string> getDisplayModes() const;
virtual QIcon getIcon() const; virtual QIcon getIcon() const;
/// Sets the edit mnode /// Sets the edit mnode