diff --git a/src/Base/Axis.h b/src/Base/Axis.h index 50406b1564..86733abef1 100644 --- a/src/Base/Axis.h +++ b/src/Base/Axis.h @@ -36,14 +36,14 @@ class BaseExport Axis { public: /// default constructor - Axis(void); + Axis(); Axis(const Axis&); Axis(const Vector3d& Orig, const Vector3d& Dir); /// Destruction ~Axis () {} - const Vector3d& getBase(void) const {return _base;} - const Vector3d& getDirection(void) const {return _dir;} + const Vector3d& getBase() const {return _base;} + const Vector3d& getDirection() const {return _dir;} void setBase(const Vector3d& Orig) {_base=Orig;} void setDirection(const Vector3d& Dir) {_dir=Dir;} diff --git a/src/Base/AxisPyImp.cpp b/src/Base/AxisPyImp.cpp index bbe401e839..406d2b54a3 100644 --- a/src/Base/AxisPyImp.cpp +++ b/src/Base/AxisPyImp.cpp @@ -35,7 +35,7 @@ using namespace Base; // returns a string which represents the object e.g. when printed in python -std::string AxisPy::representation(void) const +std::string AxisPy::representation() const { AxisPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); std::stringstream str; @@ -86,7 +86,7 @@ PyObject* AxisPy::move(PyObject * args) { PyObject *vec; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vec)) - return NULL; + return nullptr; getAxisPtr()->move(static_cast(vec)->value()); Py_Return; } @@ -95,7 +95,7 @@ PyObject* AxisPy::multiply(PyObject * args) { PyObject *plm; if (!PyArg_ParseTuple(args, "O!", &(PlacementPy::Type), &plm)) - return NULL; + return nullptr; Axis mult = (*getAxisPtr()) * (*static_cast(plm)->getPlacementPtr()); return new AxisPy(new Axis(mult)); } @@ -103,19 +103,19 @@ PyObject* AxisPy::multiply(PyObject * args) PyObject* AxisPy::copy(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; return new AxisPy(new Axis(*getAxisPtr())); } PyObject* AxisPy::reversed(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Base::Axis a = getAxisPtr()->reversed(); return new AxisPy(new Axis(a)); } -Py::Object AxisPy::getBase(void) const +Py::Object AxisPy::getBase() const { return Py::Vector(getAxisPtr()->getBase()); } @@ -125,7 +125,7 @@ void AxisPy::setBase(Py::Object arg) getAxisPtr()->setBase(Py::Vector(arg).toVector()); } -Py::Object AxisPy::getDirection(void) const +Py::Object AxisPy::getDirection() const { return Py::Vector(getAxisPtr()->getDirection()); } @@ -137,7 +137,7 @@ void AxisPy::setDirection(Py::Object arg) PyObject *AxisPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int AxisPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Base/Base64.h b/src/Base/Base64.h index fbea6be625..d5430a0acb 100644 --- a/src/Base/Base64.h +++ b/src/Base/Base64.h @@ -24,12 +24,15 @@ René Nyffenegger rene.nyffenegger@adp-gmbh.ch */ -#ifndef BASE_BASE64_H -#define BASE_BASE64_H +#ifndef BASE_BASE64_H +#define BASE_BASE64_H + +#include +#include -namespace Base -{ +namespace Base +{ std::string BaseExport base64_encode(unsigned char const* , unsigned int len); std::string BaseExport base64_decode(std::string const& s); diff --git a/src/Base/BaseClass.cpp b/src/Base/BaseClass.cpp index e24ac78c5d..7b98147c0a 100644 --- a/src/Base/BaseClass.cpp +++ b/src/Base/BaseClass.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... @@ -60,7 +60,7 @@ BaseClass::~BaseClass() //************************************************************************** // separator for other implementation aspects -void BaseClass::init(void) +void BaseClass::init() { assert(BaseClass::classTypeId == Type::badType() && "don't init() twice!"); /* Make sure superclass gets initialized before subclass. */ @@ -75,12 +75,12 @@ void BaseClass::init(void) BaseClass::create); } -Type BaseClass::getClassTypeId(void) +Type BaseClass::getClassTypeId() { return BaseClass::classTypeId; } -Type BaseClass::getTypeId(void) const +Type BaseClass::getTypeId() const { return BaseClass::classTypeId; } @@ -110,7 +110,7 @@ void BaseClass::initSubclass(Base::Type &toInit,const char* ClassName, const cha * * The default implementation returns 'None'. */ -PyObject *BaseClass::getPyObject(void) +PyObject *BaseClass::getPyObject() { assert(0); Py_Return; diff --git a/src/Base/BaseClass.h b/src/Base/BaseClass.h index f5b5a20f4f..976c54b54f 100644 --- a/src/Base/BaseClass.h +++ b/src/Base/BaseClass.h @@ -63,6 +63,7 @@ void * _class_::create(void){\ /// define to implement a subclass of Base::BaseClass #define TYPESYSTEM_SOURCE_TEMPLATE_P(_class_) \ +template<> Base::Type _class_::classTypeId = Base::Type::badType(); \ template<> Base::Type _class_::getClassTypeId(void) { return _class_::classTypeId; } \ template<> Base::Type _class_::getTypeId(void) const { return _class_::classTypeId; } \ template<> void * _class_::create(void){\ @@ -104,16 +105,16 @@ namespace Base class BaseExport BaseClass { public: - static Type getClassTypeId(void); - virtual Type getTypeId(void) const; + static Type getClassTypeId(); + virtual Type getTypeId() const; bool isDerivedFrom(const Type type) const {return getTypeId().isDerivedFrom(type);} - static void init(void); + static void init(); - virtual PyObject *getPyObject(void); + virtual PyObject *getPyObject(); virtual void setPyObject(PyObject *); - static void *create(void){return nullptr;} + static void *create(){return nullptr;} private: static Type classTypeId; protected: @@ -122,6 +123,8 @@ protected: public: /// Construction BaseClass(); + BaseClass(const BaseClass&) = default; + BaseClass& operator=(const BaseClass&) = default; /// Destruction virtual ~BaseClass(); @@ -137,7 +140,7 @@ template T * freecad_dynamic_cast(Base::BaseClass * t) if (t && t->isDerivedFrom(T::getClassTypeId())) return static_cast(t); else - return 0; + return nullptr; } /** @@ -150,7 +153,7 @@ template const T * freecad_dynamic_cast(const Base::BaseClass * t) if (t && t->isDerivedFrom(T::getClassTypeId())) return static_cast(t); else - return 0; + return nullptr; } diff --git a/src/Base/BaseClassPyImp.cpp b/src/Base/BaseClassPyImp.cpp index d1c8324c21..dd3e719e32 100644 --- a/src/Base/BaseClassPyImp.cpp +++ b/src/Base/BaseClassPyImp.cpp @@ -32,7 +32,7 @@ using namespace Base; // returns a string which represent the object e.g. when printed in python -std::string BaseClassPy::representation(void) const +std::string BaseClassPy::representation() const { return std::string(""); } @@ -42,7 +42,7 @@ PyObject* BaseClassPy::isDerivedFrom(PyObject *args) { char *name; if (!PyArg_ParseTuple(args, "s", &name)) // convert args: Python->C - return NULL; // NULL triggers exception + return nullptr; // NULL triggers exception Base::Type type = Base::Type::fromName(name); bool v = (type != Base::Type::badType() && getBaseClassPtr()->getTypeId().isDerivedFrom(type)); @@ -52,7 +52,7 @@ PyObject* BaseClassPy::isDerivedFrom(PyObject *args) PyObject* BaseClassPy::getAllDerivedFrom(PyObject *args) { if (!PyArg_ParseTuple(args, "")) // convert args: Python->C - return NULL; // NULL triggers exception + return nullptr; // NULL triggers exception std::vector ary; Base::Type::getAllDerivedFrom(getBaseClassPtr()->getTypeId(), ary); @@ -62,12 +62,12 @@ PyObject* BaseClassPy::getAllDerivedFrom(PyObject *args) return Py::new_reference_to(res); } -Py::String BaseClassPy::getTypeId(void) const +Py::String BaseClassPy::getTypeId() const { return Py::String(std::string(getBaseClassPtr()->getTypeId().getName())); } -Py::String BaseClassPy::getModule(void) const +Py::String BaseClassPy::getModule() const { std::string module(getBaseClassPtr()->getTypeId().getName()); std::string::size_type pos = module.find_first_of("::"); @@ -82,7 +82,7 @@ Py::String BaseClassPy::getModule(void) const PyObject *BaseClassPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BaseClassPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Base/BoundBox.h b/src/Base/BoundBox.h index 9d9f8ca12f..3f7c889f91 100644 --- a/src/Base/BoundBox.h +++ b/src/Base/BoundBox.h @@ -113,7 +113,7 @@ public: */ inline bool IsInBox (const BoundBox2d &rcbb) const; /** Checks whether the bounding box is valid. */ - bool IsValid (void) const; + bool IsValid () const; //@} enum OCTANT {OCT_LDB = 0, OCT_RDB, OCT_LUB, OCT_RUB, @@ -173,12 +173,12 @@ public: BoundBox3<_Precision> Transformed(const Matrix4D& mat) const; /** Returns the center.of the box. */ - inline Vector3<_Precision> GetCenter (void) const; + inline Vector3<_Precision> GetCenter () const; /** Compute the diagonal length of this bounding box. * @note It's up to the client programmer to make sure that this bounding box is valid. */ - inline _Precision CalcDiagonalLength (void) const; - void SetVoid (void); + inline _Precision CalcDiagonalLength () const; + void SetVoid (); /** Enlarges the box with factor \a fLen. */ inline void Enlarge (_Precision fLen); @@ -186,11 +186,11 @@ public: inline void Shrink (_Precision fLen); /** Calculates expansion in x-direction. */ - inline _Precision LengthX (void) const; + inline _Precision LengthX () const; /** Calculates expansion in y-direction. */ - inline _Precision LengthY (void) const; + inline _Precision LengthY () const; /** Calculates expansion in z-direction. */ - inline _Precision LengthZ (void) const; + inline _Precision LengthZ () const; /** Moves in x-direction. */ inline void MoveX (_Precision f); /** Moves in y-direction. */ @@ -400,7 +400,7 @@ inline bool BoundBox3<_Precision>::IsInBox (const BoundBox2d &rcBB) const } template -inline bool BoundBox3<_Precision>::IsValid (void) const +inline bool BoundBox3<_Precision>::IsValid () const { return ((MinX <= MaxX) && (MinY <= MaxY) && (MinZ <= MaxZ)); } @@ -894,7 +894,7 @@ inline BoundBox3<_Precision> BoundBox3<_Precision>::Transformed(const Matrix4D& } template -inline Vector3<_Precision> BoundBox3<_Precision>::GetCenter (void) const +inline Vector3<_Precision> BoundBox3<_Precision>::GetCenter () const { return Vector3<_Precision>((MaxX + MinX) / 2, (MaxY + MinY) / 2, @@ -902,7 +902,7 @@ inline Vector3<_Precision> BoundBox3<_Precision>::GetCenter (void) const } template -inline _Precision BoundBox3<_Precision>::CalcDiagonalLength (void) const +inline _Precision BoundBox3<_Precision>::CalcDiagonalLength () const { return static_cast<_Precision>(sqrt (((MaxX - MinX) * (MaxX - MinX)) + ((MaxY - MinY) * (MaxY - MinY)) + @@ -910,7 +910,7 @@ inline _Precision BoundBox3<_Precision>::CalcDiagonalLength (void) const } template -inline void BoundBox3<_Precision>::SetVoid (void) +inline void BoundBox3<_Precision>::SetVoid () { MinX = MinY = MinZ = std::numeric_limits<_Precision>::max(); MaxX = MaxY = MaxZ = -std::numeric_limits<_Precision>::max(); @@ -931,19 +931,19 @@ inline void BoundBox3<_Precision>::Shrink (_Precision fLen) } template -inline _Precision BoundBox3<_Precision>::LengthX (void) const +inline _Precision BoundBox3<_Precision>::LengthX () const { return MaxX - MinX; } template -inline _Precision BoundBox3<_Precision>::LengthY (void) const +inline _Precision BoundBox3<_Precision>::LengthY () const { return MaxY - MinY; } template -inline _Precision BoundBox3<_Precision>::LengthZ (void) const +inline _Precision BoundBox3<_Precision>::LengthZ () const { return MaxZ - MinZ; } diff --git a/src/Base/BoundBoxPyImp.cpp b/src/Base/BoundBoxPyImp.cpp index f3da07ceb9..f71e6c9e7a 100644 --- a/src/Base/BoundBoxPyImp.cpp +++ b/src/Base/BoundBoxPyImp.cpp @@ -35,7 +35,7 @@ using namespace Base; // returns a string which represent the object e.g. when printed in python -std::string BoundBoxPy::representation(void) const +std::string BoundBoxPy::representation() const { std::stringstream str; str << "BoundBox ("; @@ -113,7 +113,7 @@ int BoundBoxPy::PyInit(PyObject* args, PyObject* /*kwd*/) PyObject* BoundBoxPy::setVoid(PyObject *args) { if (!PyArg_ParseTuple(args,"")) - return 0; + return nullptr; getBoundBoxPtr()->SetVoid(); Py_Return; @@ -122,7 +122,7 @@ PyObject* BoundBoxPy::setVoid(PyObject *args) PyObject* BoundBoxPy::isValid(PyObject *args) { if (!PyArg_ParseTuple(args,"")) - return 0; + return nullptr; return PyBool_FromLong(getBoundBoxPtr()->IsValid() ? 1 : 0); } @@ -155,18 +155,18 @@ PyObject* BoundBoxPy::add(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Either three floats, instance of Vector or instance of BoundBox expected"); - return 0; + return nullptr; } PyObject* BoundBoxPy::getPoint(PyObject *args) { - int index; - if (!PyArg_ParseTuple(args,"i",&index)) - return 0; + unsigned short index; + if (!PyArg_ParseTuple(args,"H",&index)) + return nullptr; - if (index < 0 || index > 7) { - PyErr_SetString (PyExc_IndexError, "Invalid bounding box"); - return 0; + if (index > 7) { + PyErr_SetString (PyExc_IndexError, "Invalid point index"); + return nullptr; } Base::Vector3d pnt = getBoundBoxPtr()->CalcPoint(index); @@ -175,13 +175,13 @@ PyObject* BoundBoxPy::getPoint(PyObject *args) PyObject* BoundBoxPy::getEdge(PyObject *args) { - int index; - if (!PyArg_ParseTuple(args,"i",&index)) - return 0; + unsigned short index; + if (!PyArg_ParseTuple(args,"H",&index)) + return nullptr; - if (index < 0 || index > 11) { - PyErr_SetString (PyExc_IndexError, "Invalid bounding box"); - return 0; + if (index > 11) { + PyErr_SetString (PyExc_IndexError, "Invalid edge index"); + return nullptr; } Base::Vector3d pnt1, pnt2; @@ -218,7 +218,7 @@ PyObject* BoundBoxPy::closestPoint(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "Either three floats or vector expected"); - return 0; + return nullptr; } } while(false); @@ -234,7 +234,7 @@ PyObject* BoundBoxPy::intersect(PyObject *args) if (!getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box"); - return 0; + return nullptr; } do { @@ -250,14 +250,14 @@ PyObject* BoundBoxPy::intersect(PyObject *args) if (PyArg_ParseTuple(args,"O!",&(Base::BoundBoxPy::Type), &object)) { if (!static_cast(object)->getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument"); - return 0; + return nullptr; } retVal = getBoundBoxPtr()->Intersect(*(static_cast(object)->getBoundBoxPtr())); break; } PyErr_SetString(PyExc_TypeError, "Either BoundBox or two Vectors expected"); - return 0; + return nullptr; } while(false); @@ -268,15 +268,15 @@ PyObject* BoundBoxPy::intersected(PyObject *args) { if (!getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box"); - return 0; + return nullptr; } PyObject *object; if (!PyArg_ParseTuple(args,"O!",&(Base::BoundBoxPy::Type), &object)) - return 0; + return nullptr; if (!static_cast(object)->getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument"); - return 0; + return nullptr; } Base::BoundBox3d bbox = getBoundBoxPtr()->Intersected(*static_cast(object)->getBoundBoxPtr()); @@ -287,15 +287,15 @@ PyObject* BoundBoxPy::united(PyObject *args) { if (!getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box"); - return 0; + return nullptr; } PyObject *object; if (!PyArg_ParseTuple(args,"O!",&(Base::BoundBoxPy::Type), &object)) - return 0; + return nullptr; if (!static_cast(object)->getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument"); - return 0; + return nullptr; } Base::BoundBox3d bbox = getBoundBoxPtr()->United(*static_cast(object)->getBoundBoxPtr()); @@ -306,7 +306,7 @@ PyObject* BoundBoxPy::enlarge(PyObject *args) { double s; if (!PyArg_ParseTuple(args, "d;Need float parameter to enlarge", &s)) - return 0; + return nullptr; getBoundBoxPtr()->Enlarge(s); Py_Return; } @@ -327,11 +327,11 @@ PyObject* BoundBoxPy::getIntersectionPoint(PyObject *args) } else { PyErr_SetString(Base::BaseExceptionFreeCADError, "No intersection"); - return 0; + return nullptr; } } else - return 0; + return nullptr; } PyObject* BoundBoxPy::move(PyObject *args) @@ -360,7 +360,7 @@ PyObject* BoundBoxPy::move(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "Either three floats or vector expected"); - return 0; + return nullptr; } } while(false); @@ -398,7 +398,7 @@ PyObject* BoundBoxPy::scale(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "Either three floats or vector expected"); - return 0; + return nullptr; } } while(false); @@ -415,7 +415,7 @@ PyObject* BoundBoxPy::transformed(PyObject *args) PyObject *mat; if (!PyArg_ParseTuple(args,"O!", &(Base::MatrixPy::Type), &mat)) - return 0; + return nullptr; if (!getBoundBoxPtr()->IsValid()) throw Py::FloatingPointError("Cannot transform invalid bounding box"); @@ -430,7 +430,7 @@ PyObject* BoundBoxPy::isCutPlane(PyObject *args) if (!getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box"); - return 0; + return nullptr; } if (PyArg_ParseTuple(args,"O!O!:Need base and normal vector of a plane", @@ -439,7 +439,7 @@ PyObject* BoundBoxPy::isCutPlane(PyObject *args) *(static_cast(object)->getVectorPtr()), *(static_cast(object2)->getVectorPtr())); else - return 0; + return nullptr; return Py::new_reference_to(retVal); } @@ -452,7 +452,7 @@ PyObject* BoundBoxPy::isInside(PyObject *args) if (!getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box"); - return 0; + return nullptr; } do { @@ -477,26 +477,26 @@ PyObject* BoundBoxPy::isInside(PyObject *args) if (PyArg_ParseTuple(args,"O!",&(Base::BoundBoxPy::Type), &object)) { if (!static_cast(object)->getBoundBoxPtr()->IsValid()) { PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument"); - return 0; + return nullptr; } retVal = getBoundBoxPtr()->IsInBox(*(static_cast(object)->getBoundBoxPtr())); break; } PyErr_SetString(PyExc_TypeError, "Either three floats, Vector(s) or BoundBox expected"); - return 0; + return nullptr; } while(false); return Py::new_reference_to(retVal); } -Py::Object BoundBoxPy::getCenter(void) const +Py::Object BoundBoxPy::getCenter() const { return Py::Vector(getBoundBoxPtr()->GetCenter()); } -Py::Float BoundBoxPy::getXMax(void) const +Py::Float BoundBoxPy::getXMax() const { return Py::Float(getBoundBoxPtr()->MaxX); } @@ -506,7 +506,7 @@ void BoundBoxPy::setXMax(Py::Float arg) getBoundBoxPtr()->MaxX = arg; } -Py::Float BoundBoxPy::getYMax(void) const +Py::Float BoundBoxPy::getYMax() const { return Py::Float(getBoundBoxPtr()->MaxY); } @@ -516,7 +516,7 @@ void BoundBoxPy::setYMax(Py::Float arg) getBoundBoxPtr()->MaxY = arg; } -Py::Float BoundBoxPy::getZMax(void) const +Py::Float BoundBoxPy::getZMax() const { return Py::Float(getBoundBoxPtr()->MaxZ); } @@ -526,7 +526,7 @@ void BoundBoxPy::setZMax(Py::Float arg) getBoundBoxPtr()->MaxZ = arg; } -Py::Float BoundBoxPy::getXMin(void) const +Py::Float BoundBoxPy::getXMin() const { return Py::Float(getBoundBoxPtr()->MinX); } @@ -536,7 +536,7 @@ void BoundBoxPy::setXMin(Py::Float arg) getBoundBoxPtr()->MinX = arg; } -Py::Float BoundBoxPy::getYMin(void) const +Py::Float BoundBoxPy::getYMin() const { return Py::Float(getBoundBoxPtr()->MinY); } @@ -546,7 +546,7 @@ void BoundBoxPy::setYMin(Py::Float arg) getBoundBoxPtr()->MinY = arg; } -Py::Float BoundBoxPy::getZMin(void) const +Py::Float BoundBoxPy::getZMin() const { return Py::Float(getBoundBoxPtr()->MinZ); } @@ -556,22 +556,22 @@ void BoundBoxPy::setZMin(Py::Float arg) getBoundBoxPtr()->MinZ = arg; } -Py::Float BoundBoxPy::getXLength(void) const +Py::Float BoundBoxPy::getXLength() const { return Py::Float(getBoundBoxPtr()->LengthX()); } -Py::Float BoundBoxPy::getYLength(void) const +Py::Float BoundBoxPy::getYLength() const { return Py::Float(getBoundBoxPtr()->LengthY()); } -Py::Float BoundBoxPy::getZLength(void) const +Py::Float BoundBoxPy::getZLength() const { return Py::Float(getBoundBoxPtr()->LengthZ()); } -Py::Float BoundBoxPy::getDiagonalLength(void) const +Py::Float BoundBoxPy::getDiagonalLength() const { if (!getBoundBoxPtr()->IsValid()) throw Py::FloatingPointError("Cannot determine diagonal length of invalid bounding box"); @@ -580,7 +580,7 @@ Py::Float BoundBoxPy::getDiagonalLength(void) const PyObject *BoundBoxPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BoundBoxPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Base/Builder3D.cpp b/src/Base/Builder3D.cpp index ed2c70993c..51c9971770 100644 --- a/src/Base/Builder3D.cpp +++ b/src/Base/Builder3D.cpp @@ -24,11 +24,11 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include # include #endif -#include +#include /// FreeCAD #includes sorted by Base,App,Gui...... #include "Builder3D.h" @@ -106,7 +106,7 @@ void Builder3D::addPoint(const Vector3f &vec) * Ends the point set operations and write the resulting inventor string. * @see startPoints() */ -void Builder3D::endPoints(void) +void Builder3D::endPoints() { result << "] "; result << "} "; @@ -184,7 +184,7 @@ void Builder3D::clear () //************************************************************************** // line/arrow handling -void Builder3D::addSingleLine(Vector3f pt1, Vector3f pt2, short lineSize, float color_r,float color_g,float color_b, unsigned short linePattern) +void Builder3D::addSingleLine(const Vector3f& pt1, const Vector3f& pt2, short lineSize, float color_r,float color_g,float color_b, unsigned short linePattern) { char lp[20]; sprintf(lp, "0x%x", linePattern); @@ -205,7 +205,7 @@ void Builder3D::addSingleLine(Vector3f pt1, Vector3f pt2, short lineSize, float << "} "; } -void Builder3D::addSingleArrow(Vector3f pt1, Vector3f pt2, short lineSize, float color_r,float color_g,float color_b, unsigned short /*linePattern*/) +void Builder3D::addSingleArrow(const Vector3f& pt1, const Vector3f& pt2, short lineSize, float color_r,float color_g,float color_b, unsigned short /*linePattern*/) { float l = (pt2 - pt1).Length(); float cl = l / 10.0f; @@ -245,7 +245,7 @@ void Builder3D::addSingleArrow(Vector3f pt1, Vector3f pt2, short lineSize, float //************************************************************************** // triangle handling -void Builder3D::addSingleTriangle(Vector3f pt0, Vector3f pt1, Vector3f pt2, bool filled, short lineSize, float color_r, float color_g, float color_b) +void Builder3D::addSingleTriangle(const Vector3f& pt0, const Vector3f& pt1, const Vector3f& pt2, bool filled, short lineSize, float color_r, float color_g, float color_b) { std::string fs = ""; if (filled) @@ -298,7 +298,7 @@ void Builder3D::addTransformation(const Base::Vector3f& translation, const Base: * show more then one representation use saveToFile() instead. * @see saveToFile() */ -void Builder3D::saveToLog(void) +void Builder3D::saveToLog() { result << "} "; // Note: The string can become very long, so that ConsoleSingelton::Log() will internally diff --git a/src/Base/Builder3D.h b/src/Base/Builder3D.h index 927e0880d9..7e421f1530 100644 --- a/src/Base/Builder3D.h +++ b/src/Base/Builder3D.h @@ -78,7 +78,7 @@ public: /// add a vector to a point set void addPoint(const Vector3f &vec); /// ends the points set operation - void endPoints(void); + void endPoints(); /// add a singular point (without startPoints() & endPoints() ) void addSinglePoint(float x, float y, float z, short pointSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0); /// add a singular point (without startPoints() & endPoints() ) @@ -88,15 +88,15 @@ public: /** @name line/direction handling */ //@{ /// add a line defined by 2 Vector3D - void addSingleLine(Vector3f pt1, Vector3f pt2, short lineSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0, unsigned short linePattern = 0xffff); + void addSingleLine(const Vector3f& pt1, const Vector3f& pt2, short lineSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0, unsigned short linePattern = 0xffff); /// add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2. - void addSingleArrow(Vector3f pt1, Vector3f pt2, short lineSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0, unsigned short linePattern = 0xffff); + void addSingleArrow(const Vector3f& pt1, const Vector3f& pt2, short lineSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0, unsigned short linePattern = 0xffff); //@} /** @name triangle handling */ //@{ /// add a (filled) triangle defined by 3 vectors - void addSingleTriangle(Vector3f pt0, Vector3f pt1, Vector3f pt2, bool filled = true, short lineSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0); + void addSingleTriangle(const Vector3f& pt0, const Vector3f& pt1, const Vector3f& pt2, bool filled = true, short lineSize=2, float color_r=1.0,float color_g=1.0,float color_b=1.0); //@} /** @name Transformation */ @@ -115,12 +115,12 @@ public: //@} /// clear the string buffer - void clear (void); + void clear (); /** @name write the result */ //@{ /// sends the result to the log and gui - void saveToLog(void); + void saveToLog(); /// save the result to a file (*.iv) void saveToFile(const char* FileName); //@} diff --git a/src/Base/CoordinateSystemPyImp.cpp b/src/Base/CoordinateSystemPyImp.cpp index 40f86666b0..5bfeffeeb1 100644 --- a/src/Base/CoordinateSystemPyImp.cpp +++ b/src/Base/CoordinateSystemPyImp.cpp @@ -33,7 +33,7 @@ using namespace Base; // returns a string which represents the object e.g. when printed in python -std::string CoordinateSystemPy::representation(void) const +std::string CoordinateSystemPy::representation() const { return std::string(""); } @@ -67,14 +67,14 @@ PyObject* CoordinateSystemPy::setAxes(PyObject * args) } PyErr_SetString(PyExc_TypeError, "Axis and Vector or Vector and Vector expected"); - return 0; + return nullptr; } PyObject* CoordinateSystemPy::displacement(PyObject * args) { PyObject *cs; if (!PyArg_ParseTuple(args, "O!", &(CoordinateSystemPy::Type), &cs)) - return 0; + return nullptr; Placement p = getCoordinateSystemPtr()->displacement( *static_cast(cs)->getCoordinateSystemPtr()); return new PlacementPy(new Placement(p)); @@ -84,7 +84,7 @@ PyObject* CoordinateSystemPy::transformTo(PyObject * args) { PyObject *vec; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vec)) - return 0; + return nullptr; Vector3d v = static_cast(vec)->value(); getCoordinateSystemPtr()->transformTo(v); return new VectorPy(new Vector3d(v)); @@ -105,19 +105,19 @@ PyObject* CoordinateSystemPy::transform(PyObject * args) } PyErr_SetString(PyExc_TypeError, "Rotation or placement expected"); - return 0; + return nullptr; } PyObject* CoordinateSystemPy::setPlacement(PyObject * args) { PyObject *plm; if (!PyArg_ParseTuple(args, "O!", &(PlacementPy::Type), &plm)) - return NULL; + return nullptr; getCoordinateSystemPtr()->setPlacement(*static_cast(plm)->getPlacementPtr()); Py_Return; } -Py::Object CoordinateSystemPy::getAxis(void) const +Py::Object CoordinateSystemPy::getAxis() const { const Axis& axis = getCoordinateSystemPtr()->getAxis(); return Py::asObject(new AxisPy(new Axis(axis))); @@ -134,7 +134,7 @@ void CoordinateSystemPy::setAxis(Py::Object arg) throw Py::TypeError("not an Axis"); } -Py::Object CoordinateSystemPy::getXDirection(void) const +Py::Object CoordinateSystemPy::getXDirection() const { return Py::Vector(getCoordinateSystemPtr()->getXDirection()); } @@ -144,7 +144,7 @@ void CoordinateSystemPy::setXDirection(Py::Object arg) getCoordinateSystemPtr()->setXDirection(Py::Vector(arg).toVector()); } -Py::Object CoordinateSystemPy::getYDirection(void) const +Py::Object CoordinateSystemPy::getYDirection() const { return Py::Vector(getCoordinateSystemPtr()->getYDirection()); } @@ -154,7 +154,7 @@ void CoordinateSystemPy::setYDirection(Py::Object arg) getCoordinateSystemPtr()->setYDirection(Py::Vector(arg).toVector()); } -Py::Object CoordinateSystemPy::getZDirection(void) const +Py::Object CoordinateSystemPy::getZDirection() const { return Py::Vector(getCoordinateSystemPtr()->getZDirection()); } @@ -164,7 +164,7 @@ void CoordinateSystemPy::setZDirection(Py::Object arg) getCoordinateSystemPtr()->setZDirection(Py::Vector(arg).toVector()); } -Py::Object CoordinateSystemPy::getPosition(void) const +Py::Object CoordinateSystemPy::getPosition() const { return Py::Vector(getCoordinateSystemPtr()->getPosition()); } @@ -176,7 +176,7 @@ void CoordinateSystemPy::setPosition(Py::Object arg) PyObject *CoordinateSystemPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int CoordinateSystemPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Base/Debugger.h b/src/Base/Debugger.h index 503b3fba3a..146f39ba90 100644 --- a/src/Base/Debugger.h +++ b/src/Base/Debugger.h @@ -58,7 +58,7 @@ class BaseExport Debugger : public QObject Q_OBJECT public: - Debugger(QObject* parent=0); + Debugger(QObject* parent=nullptr); ~Debugger(); void attach(); diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index 39ce4e582f..c151e75df4 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -88,7 +88,7 @@ const char* Exception::what() const throw() return _sErrMsg.c_str(); } -void Exception::ReportException (void) const +void Exception::ReportException () const { if (!_isReported) { const char *msg; diff --git a/src/Base/ExceptionFactory.cpp b/src/Base/ExceptionFactory.cpp index 5f1f416dee..b0025f1db7 100644 --- a/src/Base/ExceptionFactory.cpp +++ b/src/Base/ExceptionFactory.cpp @@ -27,20 +27,20 @@ using namespace Base; -ExceptionFactory* ExceptionFactory::_pcSingleton = NULL; +ExceptionFactory* ExceptionFactory::_pcSingleton = nullptr; -ExceptionFactory& ExceptionFactory::Instance(void) +ExceptionFactory& ExceptionFactory::Instance() { - if (_pcSingleton == NULL) + if (_pcSingleton == nullptr) _pcSingleton = new ExceptionFactory; return *_pcSingleton; } -void ExceptionFactory::Destruct (void) +void ExceptionFactory::Destruct () { - if (_pcSingleton != 0) + if (_pcSingleton != nullptr) delete _pcSingleton; - _pcSingleton = 0; + _pcSingleton = nullptr; } void ExceptionFactory::raiseException (PyObject * pydict) const diff --git a/src/Base/ExceptionFactory.h b/src/Base/ExceptionFactory.h index ebf9c0766b..99a6ef6a38 100644 --- a/src/Base/ExceptionFactory.h +++ b/src/Base/ExceptionFactory.h @@ -51,8 +51,8 @@ public: class BaseExport ExceptionFactory : public Factory { public: - static ExceptionFactory& Instance(void); - static void Destruct (void); + static ExceptionFactory& Instance(); + static void Destruct (); void raiseException(PyObject * pydict) const; diff --git a/src/Base/Factory.cpp b/src/Base/Factory.cpp index b3c8acf08c..9acf202eba 100644 --- a/src/Base/Factory.cpp +++ b/src/Base/Factory.cpp @@ -49,7 +49,7 @@ void* Factory::Produce (const char *sClassName) const if (pProd != _mpcProducers.end()) return pProd->second->Produce(); else - return NULL; + return nullptr; } void Factory::AddProducer (const char *sClassName, AbstractProducer *pcProducer) @@ -76,22 +76,22 @@ std::list Factory::CanProduce() const // ---------------------------------------------------- -ScriptFactorySingleton* ScriptFactorySingleton::_pcSingleton = NULL; +ScriptFactorySingleton* ScriptFactorySingleton::_pcSingleton = nullptr; -ScriptFactorySingleton& ScriptFactorySingleton::Instance(void) +ScriptFactorySingleton& ScriptFactorySingleton::Instance() { - if (_pcSingleton == NULL) + if (_pcSingleton == nullptr) _pcSingleton = new ScriptFactorySingleton; return *_pcSingleton; } -void ScriptFactorySingleton::Destruct (void) +void ScriptFactorySingleton::Destruct () { - if (_pcSingleton != 0) + if (_pcSingleton != nullptr) delete _pcSingleton; - _pcSingleton = 0; + _pcSingleton = nullptr; } const char* ScriptFactorySingleton::ProduceScript (const char* sScriptName) const diff --git a/src/Base/Factory.h b/src/Base/Factory.h index 92699083cf..e6e22f35fe 100644 --- a/src/Base/Factory.h +++ b/src/Base/Factory.h @@ -44,7 +44,7 @@ public: AbstractProducer() {} virtual ~AbstractProducer() {} /// overwritten by a concrete producer to produce the needed object - virtual void* Produce (void) const = 0; + virtual void* Produce () const = 0; }; @@ -70,7 +70,7 @@ protected: void* Produce (const char* sClassName) const; std::map _mpcProducers; /// construction - Factory (void){} + Factory (){} /// destruction virtual ~Factory (); }; @@ -82,8 +82,8 @@ protected: class BaseExport ScriptFactorySingleton : public Factory { public: - static ScriptFactorySingleton& Instance(void); - static void Destruct (void); + static ScriptFactorySingleton& Instance(); + static void Destruct (); const char* ProduceScript (const char* sScriptName) const; @@ -94,7 +94,7 @@ private: ~ScriptFactorySingleton(){} }; -inline ScriptFactorySingleton& ScriptFactory(void) +inline ScriptFactorySingleton& ScriptFactory() { return ScriptFactorySingleton::Instance(); } @@ -114,10 +114,10 @@ public: ScriptFactorySingleton::Instance().AddProducer(name, this); } - virtual ~ScriptProducer (void){} + virtual ~ScriptProducer (){} /// Produce an instance - virtual void* Produce (void) const + virtual void* Produce () const { return (void*)mScript; } diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 881dc8ae1f..e53e94bae0 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -39,7 +39,7 @@ # elif defined (FC_OS_WIN32) # include # include -# include +# include # endif #endif @@ -110,7 +110,7 @@ FileInfo::FileInfo (const std::string &_FileName) setFile(_FileName.c_str()); } -const std::string &FileInfo::getTempPath(void) +const std::string &FileInfo::getTempPath() { static std::string tempPath; @@ -455,7 +455,7 @@ TimeInfo FileInfo::lastRead() const return ti; } -bool FileInfo::deleteFile(void) const +bool FileInfo::deleteFile() const { #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); @@ -508,7 +508,7 @@ bool FileInfo::copyTo(const char* NewName) const #endif } -bool FileInfo::createDirectory(void) const +bool FileInfo::createDirectory() const { #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); @@ -520,7 +520,7 @@ bool FileInfo::createDirectory(void) const #endif } -bool FileInfo::deleteDirectory(void) const +bool FileInfo::deleteDirectory() const { if (isDir() == false ) return false; #if defined (FC_OS_WIN32) @@ -533,7 +533,7 @@ bool FileInfo::deleteDirectory(void) const #endif } -bool FileInfo::deleteDirectoryRecursive(void) const +bool FileInfo::deleteDirectoryRecursive() const { if (isDir() == false ) return false; std::vector List = getDirectoryContent(); @@ -559,7 +559,7 @@ bool FileInfo::deleteDirectoryRecursive(void) const return deleteDirectory(); } -std::vector FileInfo::getDirectoryContent(void) const +std::vector FileInfo::getDirectoryContent() const { std::vector List; #if defined (FC_OS_WIN32) @@ -581,14 +581,14 @@ std::vector FileInfo::getDirectoryContent(void) const _findclose(hFile); #elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) - DIR* dp(0); - struct dirent* dentry(0); - if ((dp = opendir(FileName.c_str())) == NULL) + DIR* dp(nullptr); + struct dirent* dentry(nullptr); + if ((dp = opendir(FileName.c_str())) == nullptr) { return List; } - while ((dentry = readdir(dp)) != NULL) + while ((dentry = readdir(dp)) != nullptr) { std::string dir = dentry->d_name; if (dir != "." && dir != "..") diff --git a/src/Base/FileInfo.h b/src/Base/FileInfo.h index 26c053339d..123b8df753 100644 --- a/src/Base/FileInfo.h +++ b/src/Base/FileInfo.h @@ -115,17 +115,17 @@ public: /** @name Directory management*/ //@{ /// Creates a directory. Returns true if successful; otherwise returns false. - bool createDirectory( void ) const; + bool createDirectory( ) const; /// Get a list of the directory content - std::vector getDirectoryContent(void) const; + std::vector getDirectoryContent() const; /// Delete an empty directory - bool deleteDirectory(void) const; + bool deleteDirectory() const; /// Delete a directory and all its content. - bool deleteDirectoryRecursive(void) const; + bool deleteDirectoryRecursive() const; //@} /// Delete the file - bool deleteFile(void) const; + bool deleteFile() const; /// Rename the file bool renameFile(const char* NewName); /// Rename the file @@ -134,9 +134,9 @@ public: /** @name Tools */ //@{ /// Get a unique File Name in the given or (if 0) in the temp path - static std::string getTempFileName(const char* FileName=0, const char* path=0); + static std::string getTempFileName(const char* FileName=nullptr, const char* path=nullptr); /// Get the path to the dir which is considered to temp files - static const std::string &getTempPath(void); + static const std::string &getTempPath(); //@} protected: diff --git a/src/Base/FileTemplate.cpp b/src/Base/FileTemplate.cpp index 1be9b658eb..5afcd86541 100644 --- a/src/Base/FileTemplate.cpp +++ b/src/Base/FileTemplate.cpp @@ -41,10 +41,10 @@ using namespace Base; * A more elaborate description of the constructor. */ ClassTemplate::ClassTemplate() - : enumPtr(0) + : enumPtr(nullptr) , enumVar(TVal1) , publicVar(0) - , handler(0) + , handler(nullptr) { } diff --git a/src/Base/FileTemplate.h b/src/Base/FileTemplate.h index c18e633f60..0b3473ce3d 100644 --- a/src/Base/FileTemplate.h +++ b/src/Base/FileTemplate.h @@ -68,7 +68,7 @@ namespace Base *
  • mouse events *
      *
    1. mouse move event - *
    2. mouse click event\n + *
    3. mouse click event * More info about the click event. *
    4. mouse double click event *
    @@ -116,11 +116,11 @@ public: /** @name a group of methods */ //@{ /// I am method one - virtual void one(void)=0; + virtual void one()=0; /// I am method two - virtual void two(void)=0; + virtual void two()=0; /// I am method three - virtual void three(void)=0; + virtual void three()=0; //@} diff --git a/src/Base/Handle.cpp b/src/Base/Handle.cpp index 054a74eb4f..01c534aad1 100644 --- a/src/Base/Handle.cpp +++ b/src/Base/Handle.cpp @@ -26,7 +26,7 @@ #ifndef _PreComp_ # include -# include +# include #endif #include @@ -64,7 +64,7 @@ void Handled::unref() const } } -int Handled::getRefCount(void) const +int Handled::getRefCount() const { return static_cast(*_lRefCount); } diff --git a/src/Base/Handle.h b/src/Base/Handle.h index 7ca41f4466..02bebf0eb6 100644 --- a/src/Base/Handle.h +++ b/src/Base/Handle.h @@ -27,9 +27,6 @@ // Std. configurations -#include -#include -#include #ifndef FC_GLOBAL_H #include #endif @@ -52,7 +49,7 @@ public: // construction & destruction /** Pointer and default constructor */ - Reference() : _toHandle(0) { + Reference() : _toHandle(nullptr) { } Reference(T* p) : _toHandle(p) { @@ -138,17 +135,17 @@ public: // checking on the state /// Test if it handles something - bool isValid(void) const { - return _toHandle != 0; + bool isValid() const { + return _toHandle != nullptr; } /// Test if it does not handle anything - bool isNull(void) const { - return _toHandle == 0; + bool isNull() const { + return _toHandle == nullptr; } /// Get number of references on the object, including this one - int getRefCount(void) const { + int getRefCount() const { if (_toHandle) return _toHandle->getRefCount(); return 0; @@ -170,7 +167,7 @@ public: void ref() const; void unref() const; - int getRefCount(void) const; + int getRefCount() const; const Handled& operator = (const Handled&); private: diff --git a/src/Base/InputSource.h b/src/Base/InputSource.h index 856c5fd849..79d1848328 100644 --- a/src/Base/InputSource.h +++ b/src/Base/InputSource.h @@ -60,7 +60,7 @@ public : #else virtual XMLFilePos curPos() const; virtual XMLSize_t readBytes( XMLByte* const toFill, const XMLSize_t maxToRead ); - virtual const XMLCh* getContentType() const {return 0;} + virtual const XMLCh* getContentType() const {return nullptr;} #endif private : diff --git a/src/Base/Interpreter.h b/src/Base/Interpreter.h index f5050f67c9..c36a3e6efa 100644 --- a/src/Base/Interpreter.h +++ b/src/Base/Interpreter.h @@ -144,9 +144,9 @@ inline Py::Object pyCallWithKeywords(PyObject *callable, PyObject *args, PyObjec class BaseExport SystemExitException : public Exception { public: - SystemExitException(void); + SystemExitException(); virtual ~SystemExitException() throw() {} - long getExitCode(void) const { return _exitCode;} + long getExitCode() const { return _exitCode;} protected: long _exitCode; @@ -234,7 +234,7 @@ public: PyObject* runMethodObject(PyObject *pobject, const char *method); /// runs a python method with arbitrary params void runMethod(PyObject *pobject, const char *method, - const char *resfmt=0, void *cresult=0, + const char *resfmt=nullptr, void *cresult=nullptr, const char *argfmt="()", ... ); //@} @@ -258,7 +258,7 @@ public: * first. Each cleanup function will be called at most once. Since Python's internal finalization will have * completed before the cleanup function, no Python APIs should be called by \a func. */ - int cleanup(void (*func)(void)); + int cleanup(void (*func)()); /** This calls the registered cleanup functions. @see cleanup() for more details. */ void finalize(); /// This shuts down the application. @@ -272,8 +272,8 @@ public: const char* init(int argc,char *argv[]); int runCommandLine(const char *prompt); void replaceStdOutput(); - static InterpreterSingleton &Instance(void); - static void Destruct(void); + static InterpreterSingleton &Instance(); + static void Destruct(); //@} /** @name external wrapper libs @@ -297,7 +297,7 @@ public: /// unsets a break point to a special line number in the current file void dbgUnsetBreakPoint(unsigned int uiLineNumber); /// One step further - void dbgStep(void); + void dbgStep(); //@} @@ -325,7 +325,7 @@ private: * This method is used to gain access to the one and only instance of * the InterpreterSingleton class. */ -inline InterpreterSingleton &Interpreter(void) +inline InterpreterSingleton &Interpreter() { return InterpreterSingleton::Instance(); } diff --git a/src/Base/Matrix.cpp b/src/Base/Matrix.cpp index 7f6c89a5a4..a2360db085 100644 --- a/src/Base/Matrix.cpp +++ b/src/Base/Matrix.cpp @@ -34,7 +34,7 @@ using namespace Base; -Matrix4D::Matrix4D (void) +Matrix4D::Matrix4D () { setToUnity(); } @@ -91,7 +91,7 @@ Matrix4D::Matrix4D (const Vector3d& rclBase, const Vector3d& rclDir, double fAng this->rotLine(rclBase,rclDir,fAngle); } -void Matrix4D::setToUnity (void) +void Matrix4D::setToUnity () { dMtrx4D[0][0] = 1.0; dMtrx4D[0][1] = 0.0; dMtrx4D[0][2] = 0.0; dMtrx4D[0][3] = 0.0; dMtrx4D[1][0] = 0.0; dMtrx4D[1][1] = 1.0; dMtrx4D[1][2] = 0.0; dMtrx4D[1][3] = 0.0; @@ -99,7 +99,7 @@ void Matrix4D::setToUnity (void) dMtrx4D[3][0] = 0.0; dMtrx4D[3][1] = 0.0; dMtrx4D[3][2] = 0.0; dMtrx4D[3][3] = 1.0; } -void Matrix4D::nullify(void) +void Matrix4D::nullify() { dMtrx4D[0][0] = 0.0; dMtrx4D[0][1] = 0.0; dMtrx4D[0][2] = 0.0; dMtrx4D[0][3] = 0.0; dMtrx4D[1][0] = 0.0; dMtrx4D[1][1] = 0.0; dMtrx4D[1][2] = 0.0; dMtrx4D[1][3] = 0.0; @@ -436,7 +436,7 @@ void Matrix4D::transform (const Vector3d& rclVct, const Matrix4D& rclMtrx) move(rclVct); } -void Matrix4D::inverse (void) +void Matrix4D::inverse () { Matrix4D clInvTrlMat, clInvRotMat; short iz, is; @@ -560,7 +560,7 @@ void Matrix_invert (Matrix a, Matrix inva) Matrix_gauss(temp,inva); } -void Matrix4D::inverseOrthogonal(void) +void Matrix4D::inverseOrthogonal() { Base::Vector3d c(dMtrx4D[0][3],dMtrx4D[1][3],dMtrx4D[2][3]); transpose(); @@ -570,7 +570,7 @@ void Matrix4D::inverseOrthogonal(void) dMtrx4D[2][3] = -c.z; dMtrx4D[3][2] = 0; } -void Matrix4D::inverseGauss (void) +void Matrix4D::inverseGauss () { double matrix [16]; double inversematrix [16] = { 1 ,0 ,0 ,0 , @@ -621,19 +621,19 @@ void Matrix4D::setGLMatrix (const double dMtrx[16]) dMtrx4D[iz][is] = dMtrx[ iz + 4*is ]; } -unsigned long Matrix4D::getMemSpace (void) +unsigned long Matrix4D::getMemSpace () { return sizeof(Matrix4D); } -void Matrix4D::Print (void) const +void Matrix4D::Print () const { short i; for (i = 0; i < 4; i++) printf("%9.3f %9.3f %9.3f %9.3f\n", dMtrx4D[i][0], dMtrx4D[i][1], dMtrx4D[i][2], dMtrx4D[i][3]); } -void Matrix4D::transpose (void) +void Matrix4D::transpose () { double dNew[4][4]; @@ -649,7 +649,7 @@ void Matrix4D::transpose (void) // write the 12 double of the matrix in a stream -std::string Matrix4D::toString(void) const +std::string Matrix4D::toString() const { std::stringstream str; for (int i = 0; i < 4; i++) @@ -675,7 +675,7 @@ void Matrix4D::fromString(const std::string &str) } // Analyse the a transformation Matrix and describe the transformation -std::string Matrix4D::analyse(void) const +std::string Matrix4D::analyse() const { const double eps=1.0e-06; bool hastranslation = (dMtrx4D[0][3] != 0.0 || diff --git a/src/Base/Matrix.h b/src/Base/Matrix.h index f87b626b05..392f24d414 100644 --- a/src/Base/Matrix.h +++ b/src/Base/Matrix.h @@ -49,7 +49,7 @@ public: /*! * Initialises to an identity matrix */ - Matrix4D(void); + Matrix4D(); /// Construction Matrix4D (float a11, float a12, float a13, float a14, @@ -99,7 +99,7 @@ public: /// Compute the determinant of the matrix double determinant() const; /// Analyse the transformation - std::string analyse(void) const; + std::string analyse() const; /// Outer product (Dyadic product) Matrix4D& Outer(const Vector3f& rV1, const Vector3f& rV2); Matrix4D& Outer(const Vector3d& rV1, const Vector3d& rV2); @@ -115,14 +115,14 @@ public: /// set the matrix in OpenGL style void setGLMatrix (const double dMtrx[16]); - unsigned long getMemSpace (void); + unsigned long getMemSpace (); /** @name Manipulation */ //@{ /// Makes unity matrix - void setToUnity(void); + void setToUnity(); /// Makes a null matrix - void nullify(void); + void nullify(); /// moves the coordinatesystem for the x,y,z value void move (float x, float y, float z) { move(Vector3f(x,y,z)); } @@ -162,17 +162,17 @@ public: void transform (const Vector3f& rclVct, const Matrix4D& rclMtrx); void transform (const Vector3d& rclVct, const Matrix4D& rclMtrx); /// Matrix is expected to have a 3x3 rotation submatrix. - void inverse (void); + void inverse (); /// Matrix is expected to have a 3x3 rotation submatrix. - void inverseOrthogonal(void); + void inverseOrthogonal(); /// Arbitrary, non-singular matrix - void inverseGauss (void); - void transpose (void); + void inverseGauss (); + void transpose (); //@} - void Print (void) const; + void Print () const; /// write the 16 double of the matrix into a string - std::string toString(void) const; + std::string toString() const; /// read the 16 double of the matrix from a string void fromString (const std::string &str); diff --git a/src/Base/Observer.h b/src/Base/Observer.h index 9e1c6f6935..2951d00367 100644 --- a/src/Base/Observer.h +++ b/src/Base/Observer.h @@ -27,7 +27,7 @@ // Std. configurations -#include +#include #include #include #include @@ -88,7 +88,7 @@ public: * and returns the name of the observer. Needed to use the Get * Method of the Subject. */ - virtual const char *Name(void){return 0L;} + virtual const char *Name(){return nullptr;} }; /** Subject class @@ -202,7 +202,7 @@ public: return *Iter; } - return 0L; + return nullptr; } /** Clears the list of all registered observers. diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index b115e4e02f..aecddb3bd6 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -25,7 +25,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include # include # include # include @@ -53,7 +53,7 @@ # include # endif # include -# include +# include #endif @@ -354,7 +354,7 @@ Base::Reference ParameterGrp::GetGroup(const char* Name) cTemp.assign(cName,0,pos); // removing the first part from the original cName.erase(0,pos+1); - //sbsequent call + //subsequent call return _GetGroup(cTemp.c_str())->GetGroup(cName.c_str()); } } @@ -405,7 +405,7 @@ std::vector > ParameterGrp::GetGroups(void) } /// test if this group is empty -bool ParameterGrp::IsEmpty(void) const +bool ParameterGrp::IsEmpty() const { if ( _pGroupNode->getFirstChild() ) return false; @@ -419,7 +419,7 @@ bool ParameterGrp::HasGroup(const char* Name) const if ( _GroupMap.find(Name) != _GroupMap.end() ) return true; - if ( FindElement(_pGroupNode,"FCParamGroup",Name) != 0 ) + if ( FindElement(_pGroupNode,"FCParamGroup",Name) != nullptr ) return true; return false; @@ -460,7 +460,7 @@ std::vector ParameterGrp::GetBools(const char * sFilter) const while ( pcTemp) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { if (strcmp(StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),"1")) vrValues.push_back(false); else @@ -482,7 +482,7 @@ std::vector > ParameterGrp::GetBoolMap(const char * while ( pcTemp) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { if (strcmp(StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),"1")) vrValues.emplace_back(Name, false); else @@ -528,7 +528,7 @@ std::vector ParameterGrp::GetInts(const char * sFilter) const while ( pcTemp ) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { vrValues.push_back(atol(StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()) ); } pcTemp = FindNextElement(pcTemp,"FCInt") ; @@ -547,7 +547,7 @@ std::vector > ParameterGrp::GetIntMap(const char * s while ( pcTemp ) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { vrValues.emplace_back(Name, ( atol (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()))); } @@ -564,7 +564,7 @@ unsigned long ParameterGrp::GetUnsigned(const char* Name, unsigned long lPreset) // if not return preset if (!pcElem) return lPreset; // if yes check the value and return - return strtoul (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(),0,10); + return strtoul (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10); } void ParameterGrp::SetUnsigned(const char* Name, unsigned long lValue) @@ -591,8 +591,8 @@ std::vector ParameterGrp::GetUnsigneds(const char * sFilter) cons while ( pcTemp ) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { - vrValues.push_back( strtoul (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),0,10) ); + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { + vrValues.push_back( strtoul (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10) ); } pcTemp = FindNextElement(pcTemp,"FCUInt") ; } @@ -612,7 +612,7 @@ std::vector > ParameterGrp::GetUnsignedMap( // check on filter condition if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { vrValues.emplace_back(Name, - ( strtoul (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),0,10) )); + ( strtoul (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10) )); } pcTemp = FindNextElement(pcTemp,"FCUInt"); } @@ -654,7 +654,7 @@ std::vector ParameterGrp::GetFloats(const char * sFilter) const while ( pcTemp ) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { vrValues.push_back( atof (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()) ); } pcTemp = FindNextElement(pcTemp,"FCFloat"); @@ -673,7 +673,7 @@ std::vector > ParameterGrp::GetFloatMap(const char while ( pcTemp ) { Name = StrX(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { vrValues.emplace_back(Name, ( atof (StrX(static_cast(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()))); } @@ -723,7 +723,7 @@ std::string ParameterGrp::GetASCII(const char* Name, const char * pPreset) const DOMElement *pcElem = FindElement(_pGroupNode,"FCText",Name); // if not return preset if (!pcElem) { - if (pPreset==0) + if (pPreset==nullptr) return std::string(""); else return std::string(pPreset); @@ -746,7 +746,7 @@ std::vector ParameterGrp::GetASCIIs(const char * sFilter) const while ( pcTemp ) { Name = StrXUTF8(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { // retrieve the text element DOMNode *pcElem2 = pcTemp->getFirstChild(); if (pcElem2) @@ -770,7 +770,7 @@ std::vector > ParameterGrp::GetASCIIMap(const while ( pcTemp) { Name = StrXUTF8(static_cast(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str(); // check on filter condition - if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) { + if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) { // retrieve the text element DOMNode *pcElem2 = pcTemp->getFirstChild(); if (pcElem2) @@ -992,7 +992,7 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindElement(XERCES_CPP_ Base::Console().Warning("FindElement: %s cannot have the element %s of type %s\n", StrX(Start->getNodeName()).c_str(), Name, Type); return nullptr; } - for (DOMNode *clChild = Start->getFirstChild(); clChild != 0; clChild = clChild->getNextSibling()) { + for (DOMNode *clChild = Start->getFirstChild(); clChild != nullptr; clChild = clChild->getNextSibling()) { if (clChild->getNodeType() == DOMNode::ELEMENT_NODE) { // the right node Type if (!strcmp(Type,StrX(clChild->getNodeName()).c_str())) { @@ -1008,7 +1008,7 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindElement(XERCES_CPP_ } } } - return NULL; + return nullptr; } XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindNextElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *Prev, const char* Type) const @@ -1017,7 +1017,7 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindNextElement(XERCES_ if (!clChild) return nullptr; - while ((clChild = clChild->getNextSibling())!=0) { + while ((clChild = clChild->getNextSibling()) != nullptr) { if (clChild->getNodeType() == DOMNode::ELEMENT_NODE) { // the right node Type if (!strcmp(Type,StrX(clChild->getNodeName()).c_str())) { @@ -1025,7 +1025,7 @@ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindNextElement(XERCES_ } } } - return NULL; + return nullptr; } XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindOrCreateElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char* Type, const char* Name) const @@ -1119,7 +1119,7 @@ static XercesDOMParser::ValSchemes gValScheme = XercesDOMParser::Val_Au /** Default construction */ ParameterManager::ParameterManager() - : ParameterGrp(), _pDocument(0), paramSerializer(0) + : ParameterGrp(), _pDocument(nullptr), paramSerializer(nullptr) { // initialize the XML system Init(); @@ -1170,8 +1170,8 @@ ParameterManager::ParameterManager() gSchemaFullChecking = false; gDoCreate = true; - gOutputEncoding = 0; - gMyEOLSequence = 0; + gOutputEncoding = nullptr; + gMyEOLSequence = nullptr; gSplitCdataSections = true; gDiscardDefaultContent = true; @@ -1188,7 +1188,7 @@ ParameterManager::~ParameterManager() delete paramSerializer; } -void ParameterManager::Init(void) +void ParameterManager::Init() { static bool Init = false; if (!Init) { @@ -1212,7 +1212,7 @@ void ParameterManager::Init(void) } } -void ParameterManager::Terminate(void) +void ParameterManager::Terminate() { XMLTools::terminate(); XMLPlatformUtils::Terminate(); @@ -1230,7 +1230,7 @@ void ParameterManager::SetSerializer(ParameterSerializer* ps) bool ParameterManager::HasSerializer() const { - return (paramSerializer != 0); + return (paramSerializer != nullptr); } int ParameterManager::LoadDocument() @@ -1518,15 +1518,15 @@ void ParameterManager::SaveDocument(XMLFormatTarget* pFormatTarget) const #endif } -void ParameterManager::CreateDocument(void) +void ParameterManager::CreateDocument() { // creating a document from screatch DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(XStr("Core").unicodeForm()); delete _pDocument; _pDocument = impl->createDocument( - 0, // root element namespace URI. + nullptr, // root element namespace URI. XStr("FCParameters").unicodeForm(), // root element name - 0); // document type object (DTD). + nullptr); // document type object (DTD). // creating the node for the root group DOMElement* rootElem = _pDocument->getDocumentElement(); diff --git a/src/Base/Parameter.h b/src/Base/Parameter.h index 7f6bd93855..5f16e81c9e 100644 --- a/src/Base/Parameter.h +++ b/src/Base/Parameter.h @@ -32,14 +32,6 @@ #ifndef BASE__PARAMETER_H #define BASE__PARAMETER_H -// (re-)defined in pyconfig.h -#if defined (_POSIX_C_SOURCE) -# undef _POSIX_C_SOURCE -#endif -#if defined (_XOPEN_SOURCE) -# undef _XOPEN_SOURCE -#endif - // Include files #include @@ -101,8 +93,6 @@ class ParameterManager; */ class BaseExport ParameterGrp : public Base::Handled,public Base::Subject { - - public: /** @name copy and insertation */ //@{ @@ -123,9 +113,9 @@ public: /// get a handle to a sub group or create one Base::Reference GetGroup(const char* Name); /// get a vector of all sub groups in this group - std::vector > GetGroups(void); + std::vector > GetGroups(); /// test if this group is empty - bool IsEmpty(void) const; + bool IsEmpty() const; /// test if a special sub group is in this group bool HasGroup(const char* Name) const; /// type of the handle @@ -135,7 +125,7 @@ public: /// rename a sub group from this group bool RenameGrp(const char* OldName, const char* NewName); /// clears everything in this group (all types) - void Clear(void); + void Clear(); //@} /** @name methods for bool handling */ @@ -145,9 +135,9 @@ public: /// set a bool value void SetBool(const char* Name, bool bValue); /// get a vector of all bool values in this group - std::vector GetBools(const char * sFilter = NULL) const; + std::vector GetBools(const char * sFilter = nullptr) const; /// get a map with all bool values and the keys of this group - std::vector > GetBoolMap(const char * sFilter = NULL) const; + std::vector > GetBoolMap(const char * sFilter = nullptr) const; /// remove a bool value from this group void RemoveBool(const char* Name); //@} @@ -159,9 +149,9 @@ public: /// set a int value void SetInt(const char* Name, long lValue); /// get a vector of all int values in this group - std::vector GetInts(const char * sFilter = NULL) const; + std::vector GetInts(const char * sFilter = nullptr) const; /// get a map with all int values and the keys of this group - std::vector > GetIntMap(const char * sFilter = NULL) const; + std::vector > GetIntMap(const char * sFilter = nullptr) const; /// remove a int value from this group void RemoveInt(const char* Name); //@} @@ -173,9 +163,9 @@ public: /// set a uint value void SetUnsigned(const char* Name, unsigned long lValue); /// get a vector of all uint values in this group - std::vector GetUnsigneds(const char * sFilter = NULL) const; + std::vector GetUnsigneds(const char * sFilter = nullptr) const; /// get a map with all uint values and the keys of this group - std::vector > GetUnsignedMap(const char * sFilter = NULL) const; + std::vector > GetUnsignedMap(const char * sFilter = nullptr) const; /// remove a uint value from this group void RemoveUnsigned(const char* Name); //@} @@ -188,9 +178,9 @@ public: /// read float values or give default void SetFloat(const char* Name, double dValue); /// get a vector of all float values in this group - std::vector GetFloats(const char * sFilter = NULL) const; + std::vector GetFloats(const char * sFilter = nullptr) const; /// get a map with all float values and the keys of this group - std::vector > GetFloatMap(const char * sFilter = NULL) const; + std::vector > GetFloatMap(const char * sFilter = nullptr) const; /// remove a float value from this group void RemoveFloat(const char* Name); //@} @@ -201,7 +191,7 @@ public: /// set a blob value void SetBlob(const char* Name, void *pValue, long lLength); /// read blob values or give default - void GetBlob(const char* Name, void * pBuf, long lMaxLength, void* pPreset=NULL) const; + void GetBlob(const char* Name, void * pBuf, long lMaxLength, void* pPreset=nullptr) const; /// remove a blob value from this group void RemoveBlob(const char* Name); //@} @@ -213,7 +203,7 @@ public: /// set a string value void SetASCII(const char* Name, const char *sValue); /// read a string values - std::string GetASCII(const char* Name, const char * pPreset=NULL) const; + std::string GetASCII(const char* Name, const char * pPreset=nullptr) const; /// remove a string value from this group void RemoveASCII(const char* Name); /** Return all string elements in this group as a vector of strings @@ -221,15 +211,15 @@ public: * @param sFilter only strings which name includes sFilter are put in the vector * @return std::vector of std::strings */ - std::vector GetASCIIs(const char * sFilter = NULL) const; + std::vector GetASCIIs(const char * sFilter = nullptr) const; /// Same as GetASCIIs() but with key,value map - std::vector > GetASCIIMap(const char * sFilter = NULL) const; + std::vector > GetASCIIMap(const char * sFilter = nullptr) const; //@} friend class ParameterManager; /// returns the name - const char* GetGroupName(void) const { + const char* GetGroupName() const { return _cName.c_str(); } @@ -239,7 +229,7 @@ public: protected: /// constructor is protected (handle concept) - ParameterGrp(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *GroupNode=0L,const char* sName=0L); + ParameterGrp(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *GroupNode=nullptr,const char* sName=nullptr); /// destructor is protected (handle concept) ~ParameterGrp(); /// helper function for GetGroup @@ -254,7 +244,7 @@ protected: * the pointer to that element, otherwise NULL * If the names not given it returns the first occurrence of Type. */ - XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *FindElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char* Type, const char* Name=0L) const; + XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *FindElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char* Type, const char* Name=nullptr) const; /** Find an element specified by Type and Name or create it if not found * Search in the parent element Start for the first occurrence of an @@ -304,15 +294,15 @@ class BaseExport ParameterManager : public ParameterGrp public: ParameterManager(); ~ParameterManager(); - static void Init(void); - static void Terminate(void); + static void Init(); + static void Terminate(); int LoadDocument(const char* sFileName); int LoadDocument(const XERCES_CPP_NAMESPACE_QUALIFIER InputSource&); bool LoadOrCreateDocument(const char* sFileName); void SaveDocument(const char* sFileName) const; void SaveDocument(XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget* pFormatTarget) const; - void CreateDocument(void); + void CreateDocument(); void CheckDocument() const; /** @name Parameter serialization */ diff --git a/src/Base/Persistence.cpp b/src/Base/Persistence.cpp index 7122cc394b..1f12a33686 100644 --- a/src/Base/Persistence.cpp +++ b/src/Base/Persistence.cpp @@ -27,6 +27,7 @@ #include "PyObjectBase.h" #ifndef _PreComp_ +#include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... @@ -45,7 +46,7 @@ TYPESYSTEM_SOURCE_ABSTRACT(Base::Persistence,Base::BaseClass) //************************************************************************** // separator for other implementation aspects -unsigned int Persistence::getMemSize (void) const +unsigned int Persistence::getMemSize () const { // you have to implement this method in all descending classes! assert(0); diff --git a/src/Base/Persistence.h b/src/Base/Persistence.h index aec2742115..c264a50a88 100644 --- a/src/Base/Persistence.h +++ b/src/Base/Persistence.h @@ -27,8 +27,6 @@ // Std. configurations -#include - #include "BaseClass.h" namespace Base @@ -48,7 +46,7 @@ public: * It is not meant to have the exact size, it is more or less an estimation * which runs fast! Is it two bytes or a GB? */ - virtual unsigned int getMemSize (void) const = 0; + virtual unsigned int getMemSize () const = 0; /** This method is used to save properties to an XML document. * A good example you'll find in PropertyStandard.cpp, e.g. the vector: * \code diff --git a/src/Base/PersistencePyImp.cpp b/src/Base/PersistencePyImp.cpp index 9cfd3b799b..d31450de9e 100644 --- a/src/Base/PersistencePyImp.cpp +++ b/src/Base/PersistencePyImp.cpp @@ -34,13 +34,13 @@ using namespace Base; // returns a string which represent the object e.g. when printed in python -std::string PersistencePy::representation(void) const +std::string PersistencePy::representation() const { return std::string(""); } -Py::String PersistencePy::getContent(void) const +Py::String PersistencePy::getContent() const { Base::StringWriter writer; // force all objects to write pure XML without files @@ -50,7 +50,7 @@ Py::String PersistencePy::getContent(void) const return Py::String (writer.getString()); } -Py::Int PersistencePy::getMemSize(void) const +Py::Int PersistencePy::getMemSize() const { return Py::Int((long)getPersistencePtr()->getMemSize()); } @@ -58,10 +58,10 @@ Py::Int PersistencePy::getMemSize(void) const PyObject* PersistencePy::dumpContent(PyObject *args, PyObject *kwds) { int compression = 3; - static char* kwds_def[] = {"Compression",NULL}; + static char* kwds_def[] = {"Compression",nullptr}; PyErr_Clear(); if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwds_def, &compression)) { - return NULL; + return nullptr; } //setup the stream. the in flag is needed to make "read" work @@ -71,22 +71,22 @@ PyObject* PersistencePy::dumpContent(PyObject *args, PyObject *kwds) } catch (...) { PyErr_SetString(PyExc_IOError, "Unable parse content into binary representation"); - return NULL; + return nullptr; } //build the byte array with correct size if(!stream.seekp(0, stream.end)) { PyErr_SetString(PyExc_IOError, "Unable to find end of stream"); - return NULL; + return nullptr; } std::stringstream::pos_type offset = stream.tellp(); if (!stream.seekg(0, stream.beg)) { PyErr_SetString(PyExc_IOError, "Unable to find begin of stream"); - return NULL; + return nullptr; } - PyObject* ba = PyByteArray_FromStringAndSize(NULL, offset); + PyObject* ba = PyByteArray_FromStringAndSize(nullptr, offset); //use the buffer protocol to access the underlying array and write into it Py_buffer buf = Py_buffer(); @@ -94,14 +94,14 @@ PyObject* PersistencePy::dumpContent(PyObject *args, PyObject *kwds) try { if(!stream.read((char*)buf.buf, offset)) { PyErr_SetString(PyExc_IOError, "Error copying data into byte array"); - return NULL; + return nullptr; } PyBuffer_Release(&buf); } catch(...) { PyBuffer_Release(&buf); PyErr_SetString(PyExc_IOError, "Error copying data into byte array"); - return NULL; + return nullptr; } return ba; @@ -111,21 +111,21 @@ PyObject* PersistencePy::restoreContent(PyObject *args) { PyObject* buffer; if( !PyArg_ParseTuple(args, "O", &buffer) ) - return NULL; + return nullptr; //check if it really is a buffer if( !PyObject_CheckBuffer(buffer) ) { PyErr_SetString(PyExc_TypeError, "Must be a buffer object"); - return NULL; + return nullptr; } Py_buffer buf; if(PyObject_GetBuffer(buffer, &buf, PyBUF_SIMPLE) < 0) - return NULL; + return nullptr; if(!PyBuffer_IsContiguous(&buf, 'C')) { PyErr_SetString(PyExc_TypeError, "Buffer must be contiguous"); - return NULL; + return nullptr; } //check if it really is a buffer @@ -136,7 +136,7 @@ PyObject* PersistencePy::restoreContent(PyObject *args) } catch (...) { PyErr_SetString(PyExc_IOError, "Unable to restore content"); - return NULL; + return nullptr; } Py_Return; @@ -144,7 +144,7 @@ PyObject* PersistencePy::restoreContent(PyObject *args) PyObject *PersistencePy::getCustomAttributes(const char*) const { - return 0; + return nullptr; } int PersistencePy::setCustomAttributes(const char*,PyObject*) diff --git a/src/Base/Placement.h b/src/Base/Placement.h index 39b6920252..6720acba81 100644 --- a/src/Base/Placement.h +++ b/src/Base/Placement.h @@ -39,7 +39,7 @@ class BaseExport Placement { public: /// default constructor - Placement(void); + Placement(); Placement(const Placement&); Placement(const Base::Matrix4D& matrix); Placement(const Vector3d& Pos, const Rotation &Rot); @@ -53,11 +53,11 @@ public: /// Destruction ~Placement () {} - Matrix4D toMatrix(void) const; + Matrix4D toMatrix() const; void fromMatrix(const Matrix4D& m); DualQuat toDualQuaternion() const; - const Vector3d& getPosition(void) const {return _pos;} - const Rotation& getRotation(void) const {return _rot;} + const Vector3d& getPosition() const {return _pos;} + const Rotation& getRotation() const {return _rot;} void setPosition(const Vector3d& Pos){_pos=Pos;} void setRotation(const Rotation& Rot) {_rot = Rot;} diff --git a/src/Base/PlacementPyImp.cpp b/src/Base/PlacementPyImp.cpp index da69c0835a..8b6aed5cac 100644 --- a/src/Base/PlacementPyImp.cpp +++ b/src/Base/PlacementPyImp.cpp @@ -38,7 +38,7 @@ using namespace Base; // returns a string which represents the object e.g. when printed in python -std::string PlacementPy::representation(void) const +std::string PlacementPy::representation() const { double A,B,C; PlacementPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); @@ -126,11 +126,11 @@ PyObject* PlacementPy::richCompare(PyObject *v, PyObject *w, int op) Base::Placement p1 = *static_cast(v)->getPlacementPtr(); Base::Placement p2 = *static_cast(w)->getPlacementPtr(); - PyObject *res=0; + PyObject *res=nullptr; if (op != Py_EQ && op != Py_NE) { PyErr_SetString(PyExc_TypeError, "no ordering relation is defined for Placement"); - return 0; + return nullptr; } else if (op == Py_EQ) { res = (p1 == p2) ? Py_True : Py_False; @@ -154,7 +154,7 @@ PyObject* PlacementPy::move(PyObject * args) { PyObject *vec; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vec)) - return NULL; + return nullptr; getPlacementPtr()->move(static_cast(vec)->value()); Py_Return; } @@ -191,7 +191,7 @@ PyObject* PlacementPy::multiply(PyObject * args) { PyObject *plm; if (!PyArg_ParseTuple(args, "O!", &(PlacementPy::Type), &plm)) - return NULL; + return nullptr; Placement mult = (*getPlacementPtr()) * (*static_cast(plm)->getPlacementPtr()); return new PlacementPy(new Placement(mult)); } @@ -200,7 +200,7 @@ PyObject* PlacementPy::multVec(PyObject * args) { PyObject *vec; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vec)) - return NULL; + return nullptr; Base::Vector3d pnt(static_cast(vec)->value()); getPlacementPtr()->multVec(pnt, pnt); return new VectorPy(new Vector3d(pnt)); @@ -209,14 +209,14 @@ PyObject* PlacementPy::multVec(PyObject * args) PyObject* PlacementPy::copy(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; return new PlacementPy(new Placement(*getPlacementPtr())); } PyObject* PlacementPy::toMatrix(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Base::Matrix4D mat = getPlacementPtr()->toMatrix(); return new MatrixPy(new Matrix4D(mat)); } @@ -224,7 +224,7 @@ PyObject* PlacementPy::toMatrix(PyObject * args) PyObject* PlacementPy::inverse(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Base::Placement p = getPlacementPtr()->inverse(); return new PlacementPy(new Placement(p)); } @@ -266,12 +266,12 @@ PyObject* PlacementPy::slerp(PyObject* args) PyObject* PlacementPy::isIdentity(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; bool none = getPlacementPtr()->isIdentity(); return Py_BuildValue("O", (none ? Py_True : Py_False)); } -Py::Object PlacementPy::getBase(void) const +Py::Object PlacementPy::getBase() const { return Py::Vector(getPlacementPtr()->getPosition()); } @@ -281,7 +281,7 @@ void PlacementPy::setBase(Py::Object arg) getPlacementPtr()->setPosition(Py::Vector(arg).toVector()); } -Py::Object PlacementPy::getRotation(void) const +Py::Object PlacementPy::getRotation() const { return Py::Rotation(getPlacementPtr()->getRotation()); } @@ -307,7 +307,7 @@ void PlacementPy::setRotation(Py::Object arg) throw Py::TypeError("either Rotation or tuple of four floats expected"); } -Py::Object PlacementPy::getMatrix(void) const +Py::Object PlacementPy::getMatrix() const { return Py::Matrix(getPlacementPtr()->toMatrix()); } @@ -331,7 +331,7 @@ PyObject *PlacementPy::getCustomAttributes(const char* attr) const Py_XDECREF(w); return res; } - return 0; + return nullptr; } int PlacementPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) @@ -367,7 +367,7 @@ PyObject* PlacementPy::number_multiply_handler(PyObject *self, PyObject *other) } PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_power_handler (PyObject* self, PyObject* other, PyObject* arg) @@ -385,7 +385,7 @@ PyObject * PlacementPy::number_power_handler (PyObject* self, PyObject* other, P || arg != Py_None) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } Placement a = static_cast(self)->value(); @@ -395,49 +395,49 @@ PyObject * PlacementPy::number_power_handler (PyObject* self, PyObject* other, P PyObject* PlacementPy::number_add_handler(PyObject * /*self*/, PyObject * /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject* PlacementPy::number_subtract_handler(PyObject * /*self*/, PyObject * /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_divide_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_remainder_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_divmod_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_negative_handler (PyObject* /*self*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_positive_handler (PyObject* /*self*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_absolute_handler (PyObject* /*self*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } int PlacementPy::number_nonzero_handler (PyObject* /*self*/) @@ -448,48 +448,48 @@ int PlacementPy::number_nonzero_handler (PyObject* /*self*/) PyObject * PlacementPy::number_invert_handler (PyObject* /*self*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_lshift_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_rshift_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_and_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_xor_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_or_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_int_handler (PyObject * /*self*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * PlacementPy::number_float_handler (PyObject * /*self*/) { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } diff --git a/src/Base/PyExport.cpp b/src/Base/PyExport.cpp index ee5c2633c0..ca2eb2d5d5 100644 --- a/src/Base/PyExport.cpp +++ b/src/Base/PyExport.cpp @@ -31,7 +31,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif #include "PyExport.h" diff --git a/src/Base/PyExport.h b/src/Base/PyExport.h index e6bd78e800..2a43bcbefd 100644 --- a/src/Base/PyExport.h +++ b/src/Base/PyExport.h @@ -79,7 +79,7 @@ class PyObjectBase; * @remark One big consequence of this specification is that the programmer must know whether the Python interpreter * gets the Python object or not. If the interpreter gets the object then it decrements the counter later on when * the internal variable is freed. In case the interpreter doesn't get this object then the programmer must do the - * decrement on their own. + * decrement on his own. * * @note To not to undermine this specification the programmer must make sure to get the Python object always via * GetPyObject(). @@ -205,7 +205,7 @@ public: } /// returns the type as PyObject - PyObject* getPyObject(void) const { + PyObject* getPyObject() const { // return (PyObject*) _pHandels; // FIXME: Shouldn't we return the pointer's object?. (Werner) return const_cast(_pHandels)->getPyObject(); @@ -214,12 +214,12 @@ public: // checking on the state /// Test if it handels something - bool IsValid(void) const { + bool IsValid() const { return _pHandels!=0; } /// Test if it not handels something - bool IsNull(void) const { + bool IsNull() const { return _pHandels==0; } diff --git a/src/Base/Quantity.cpp b/src/Base/Quantity.cpp index 918956f043..66b7f2f768 100644 --- a/src/Base/Quantity.cpp +++ b/src/Base/Quantity.cpp @@ -216,7 +216,7 @@ Quantity& Quantity::operator -=(const Quantity &p) return *this; } -Quantity Quantity::operator -(void) const +Quantity Quantity::operator -() const { return Quantity(-(this->_Value),this->_Unit); } @@ -240,24 +240,24 @@ QString Quantity::getUserString(UnitsSchema* schema, double &factor, QString &un } /// true if it has a number without a unit -bool Quantity::isDimensionless(void)const +bool Quantity::isDimensionless() const { return isValid() && _Unit.isEmpty(); } // true if it has a number and a valid unit -bool Quantity::isQuantity(void)const +bool Quantity::isQuantity() const { return isValid() && !_Unit.isEmpty(); } // true if it has a number with or without a unit -bool Quantity::isValid(void)const +bool Quantity::isValid() const { return !boost::math::isnan(_Value); } -void Quantity::setInvalid(void) +void Quantity::setInvalid() { _Value = std::numeric_limits::quiet_NaN(); } @@ -424,7 +424,7 @@ double num_change(char* yytext,char dez_delim,char grp_delim) double ret_val; char temp[40]; int i = 0; - for (char* c=yytext;*c!='\0';c++){ + for (char* c=yytext;*c!='\0';c++) { // skip group delimiter if (*c==grp_delim) continue; // check for a dez delimiter other then dot @@ -459,7 +459,7 @@ namespace QuantityParser { #define YYINITDEPTH 20 // show parser the lexer method #define yylex QuantityLexer -int QuantityLexer(void); +int QuantityLexer(); // Parser, defined in QuantityParser.y #include "QuantityParser.c" diff --git a/src/Base/Quantity.h b/src/Base/Quantity.h index cb8c3dbfdd..fc941c9249 100644 --- a/src/Base/Quantity.h +++ b/src/Base/Quantity.h @@ -86,7 +86,7 @@ struct BaseExport QuantityFormat { return 'g'; } } - static inline NumberFormat toFormat(char c, bool* ok = 0) { + static inline NumberFormat toFormat(char c, bool* ok = nullptr) { if (ok) *ok = true; switch (c) { @@ -111,7 +111,7 @@ class BaseExport Quantity { public: /// default constructor - Quantity(void); + Quantity(); Quantity(const Quantity&); explicit Quantity(double value, const Unit& unit=Unit()); explicit Quantity(double value, const QString& unit); @@ -126,7 +126,7 @@ public: Quantity& operator +=(const Quantity &p); Quantity operator -(const Quantity &p) const; Quantity& operator -=(const Quantity &p); - Quantity operator -(void) const; + Quantity operator -() const; Quantity operator /(const Quantity &p) const; Quantity operator /(double p) const; bool operator ==(const Quantity&) const; @@ -147,7 +147,7 @@ public: } /// transfer to user preferred unit/potence QString getUserString(double &factor, QString &unitString) const; - QString getUserString(void) const { // to satisfy GCC + QString getUserString() const { // to satisfy GCC double dummy1; QString dummy2; return getUserString(dummy1,dummy2); @@ -157,11 +157,11 @@ public: static Quantity parse(const QString &string); /// returns the unit of the quantity - const Unit & getUnit(void) const{return _Unit;} + const Unit & getUnit() const{return _Unit;} /// set the unit of the quantity void setUnit(const Unit &un){_Unit = un;} /// get the Value of the quantity - double getValue(void) const{return _Value;} + double getValue() const{return _Value;} /// set the value of the quantity void setValue(double val){_Value = val;} /** get the Value in a special unit given as quantity. @@ -171,13 +171,13 @@ public: /// true if it has a number without a unit - bool isDimensionless(void)const; + bool isDimensionless()const; /// true if it has a number and a valid unit - bool isQuantity(void)const; + bool isQuantity()const; /// true if it has a number with or without a unit - bool isValid(void)const; + bool isValid()const; /// sets the quantity invalid - void setInvalid(void); + void setInvalid(); /** Predefined Unit types. */ diff --git a/src/Base/QuantityPyImp.cpp b/src/Base/QuantityPyImp.cpp index 7da2c1b199..5b8cd31381 100644 --- a/src/Base/QuantityPyImp.cpp +++ b/src/Base/QuantityPyImp.cpp @@ -33,7 +33,7 @@ using namespace Base; // returns a string which represents the object e.g. when printed in python -std::string QuantityPy::representation(void) const +std::string QuantityPy::representation() const { std::stringstream ret; #if 0 @@ -238,12 +238,12 @@ PyObject* QuantityPy::getValueAs(PyObject *args) if (!quant.isValid()) { PyErr_SetString(PyExc_TypeError, "Either quantity, string, float or unit expected"); - return 0; + return nullptr; } if (getQuantityPtr()->getUnit() != quant.getUnit() && quant.isQuantity()) { PyErr_SetString(PyExc_ValueError, "Unit mismatch"); - return 0; + return nullptr; } quant = Quantity(getQuantityPtr()->getValueAs(quant)); @@ -265,7 +265,7 @@ PyObject * QuantityPy::number_float_handler (PyObject *self) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "Arg must be Quantity"); - return 0; + return nullptr; } QuantityPy* q = static_cast(self); @@ -276,7 +276,7 @@ PyObject * QuantityPy::number_int_handler (PyObject *self) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "Arg must be Quantity"); - return 0; + return nullptr; } QuantityPy* q = static_cast(self); @@ -287,7 +287,7 @@ PyObject * QuantityPy::number_negative_handler (PyObject *self) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "Arg must be Quantity"); - return 0; + return nullptr; } Base::Quantity *a = static_cast(self) ->getQuantityPtr(); @@ -299,7 +299,7 @@ PyObject * QuantityPy::number_positive_handler (PyObject *self) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "Arg must be Quantity"); - return 0; + return nullptr; } Base::Quantity *a = static_cast(self) ->getQuantityPtr(); @@ -310,7 +310,7 @@ PyObject * QuantityPy::number_absolute_handler (PyObject *self) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "Arg must be Quantity"); - return 0; + return nullptr; } Base::Quantity *a = static_cast(self) ->getQuantityPtr(); @@ -407,7 +407,7 @@ PyObject * QuantityPy::number_remainder_handler (PyObject *self, PyObject *other { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Quantity"); - return 0; + return nullptr; } double d1, d2; @@ -426,7 +426,7 @@ PyObject * QuantityPy::number_remainder_handler (PyObject *self, PyObject *other } else { PyErr_SetString(PyExc_TypeError, "Expected quantity or number"); - return 0; + return nullptr; } PyObject* p1 = PyFloat_FromDouble(d1); @@ -435,7 +435,7 @@ PyObject * QuantityPy::number_remainder_handler (PyObject *self, PyObject *other Py_DECREF(p1); Py_DECREF(p2); if (!r) - return 0; + return nullptr; double q = PyFloat_AsDouble(r); Py_DECREF(r); return new QuantityPy(new Quantity(q,a->getUnit())); @@ -445,14 +445,14 @@ PyObject * QuantityPy::number_divmod_handler (PyObject* /*self*/, PyObject* /*ot { //PyNumber_Divmod(); PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } PyObject * QuantityPy::number_power_handler (PyObject *self, PyObject *other, PyObject * /*modulo*/) { if (!PyObject_TypeCheck(self, &(QuantityPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Quantity"); - return 0; + return nullptr; } PY_TRY { @@ -475,7 +475,7 @@ PyObject * QuantityPy::number_power_handler (PyObject *self, PyObject *other, Py } else { PyErr_SetString(PyExc_TypeError, "Expected quantity or number"); - return 0; + return nullptr; } }PY_CATCH } @@ -487,7 +487,7 @@ int QuantityPy::number_nonzero_handler (PyObject *self) } Base::Quantity *a = static_cast(self) ->getQuantityPtr(); - return a->getValue() != 0; + return a->getValue() != 0.0; } PyObject* QuantityPy::richCompare(PyObject *v, PyObject *w, int op) @@ -497,7 +497,7 @@ PyObject* QuantityPy::richCompare(PyObject *v, PyObject *w, int op) const Quantity * u1 = static_cast(v)->getQuantityPtr(); const Quantity * u2 = static_cast(w)->getQuantityPtr(); - PyObject *res=0; + PyObject *res=nullptr; if (op == Py_NE) { res = (!(*u1 == *u2)) ? Py_True : Py_False; Py_INCREF(res); @@ -533,7 +533,7 @@ PyObject* QuantityPy::richCompare(PyObject *v, PyObject *w, int op) // Try to get floating numbers double u1 = PyFloat_AsDouble(v); double u2 = PyFloat_AsDouble(w); - PyObject *res=0; + PyObject *res=nullptr; if (op == Py_NE) { res = (u1 != u2) ? Py_True : Py_False; Py_INCREF(res); @@ -571,7 +571,7 @@ PyObject* QuantityPy::richCompare(PyObject *v, PyObject *w, int op) return Py_NotImplemented; } -Py::Float QuantityPy::getValue(void) const +Py::Float QuantityPy::getValue() const { return Py::Float(getQuantityPtr()->getValue()); } @@ -581,7 +581,7 @@ void QuantityPy::setValue(Py::Float arg) getQuantityPtr()->setValue(arg); } -Py::Object QuantityPy::getUnit(void) const +Py::Object QuantityPy::getUnit() const { return Py::asObject(new UnitPy(new Unit(getQuantityPtr()->getUnit()))); } @@ -596,12 +596,12 @@ void QuantityPy::setUnit(Py::Object arg) getQuantityPtr()->setUnit(*static_cast((*arg))->getUnitPtr()); } -Py::String QuantityPy::getUserString(void) const +Py::String QuantityPy::getUserString() const { return Py::String(getQuantityPtr()->getUserString().toUtf8(),"utf-8"); } -Py::Dict QuantityPy::getFormat(void) const +Py::Dict QuantityPy::getFormat() const { QuantityFormat fmt = getQuantityPtr()->getFormat(); @@ -685,36 +685,36 @@ int QuantityPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) PyObject * QuantityPy::number_invert_handler (PyObject* /*self*/) { PyErr_SetString(PyExc_TypeError, "bad operand type for unary ~"); - return 0; + return nullptr; } PyObject * QuantityPy::number_lshift_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_TypeError, "unsupported operand type(s) for <<"); - return 0; + return nullptr; } PyObject * QuantityPy::number_rshift_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_TypeError, "unsupported operand type(s) for >>"); - return 0; + return nullptr; } PyObject * QuantityPy::number_and_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_TypeError, "unsupported operand type(s) for &"); - return 0; + return nullptr; } PyObject * QuantityPy::number_xor_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_TypeError, "unsupported operand type(s) for ^"); - return 0; + return nullptr; } PyObject * QuantityPy::number_or_handler (PyObject* /*self*/, PyObject* /*other*/) { PyErr_SetString(PyExc_TypeError, "unsupported operand type(s) for |"); - return 0; + return nullptr; } diff --git a/src/Base/Reader.cpp b/src/Base/Reader.cpp index 92b094b509..a50f39b544 100644 --- a/src/Base/Reader.cpp +++ b/src/Base/Reader.cpp @@ -115,12 +115,12 @@ Base::XMLReader::~XMLReader() delete parser; } -const char* Base::XMLReader::localName(void) const +const char* Base::XMLReader::localName() const { return LocalName.c_str(); } -unsigned int Base::XMLReader::getAttributeCount(void) const +unsigned int Base::XMLReader::getAttributeCount() const { return (unsigned int)AttrMap.size(); } @@ -190,7 +190,7 @@ bool Base::XMLReader::hasAttribute (const char* AttrName) const return AttrMap.find(AttrName) != AttrMap.end(); } -bool Base::XMLReader::read(void) +bool Base::XMLReader::read() { ReadType = None; @@ -287,7 +287,7 @@ void Base::XMLReader::readEndElement(const char* ElementName, int level) || (level>=0 && level!=Level)))); } -void Base::XMLReader::readCharacters(void) +void Base::XMLReader::readCharacters() { } @@ -543,20 +543,20 @@ void Base::XMLReader::setPartialRestore(bool on) setStatus(PartialRestoreInObject, on); } -void Base::XMLReader::clearPartialRestoreDocumentObject(void) +void Base::XMLReader::clearPartialRestoreDocumentObject() { setStatus(PartialRestoreInDocumentObject, false); setStatus(PartialRestoreInProperty, false); setStatus(PartialRestoreInObject, false); } -void Base::XMLReader::clearPartialRestoreProperty(void) +void Base::XMLReader::clearPartialRestoreProperty() { setStatus(PartialRestoreInProperty, false); setStatus(PartialRestoreInObject, false); } -void Base::XMLReader::clearPartialRestoreObject(void) +void Base::XMLReader::clearPartialRestoreObject() { setStatus(PartialRestoreInObject, false); } diff --git a/src/Base/Reader.h b/src/Base/Reader.h index 80ac01e00b..b7a884317b 100644 --- a/src/Base/Reader.h +++ b/src/Base/Reader.h @@ -134,11 +134,11 @@ public: /** @name Parser handling */ //@{ /// get the local name of the current Element - const char* localName(void) const; + const char* localName() const; /// get the current element level int level() const; /// read until a start element is found (\) or start-end element (\) (with special name if given) - void readElement (const char* ElementName=0); + void readElement (const char* ElementName=nullptr); /** read until an end element is found * @@ -154,9 +154,9 @@ public: * child element may have the same name as its parent, otherwise, using \c * ElementName is enough. */ - void readEndElement(const char* ElementName=0, int level=-1); + void readEndElement(const char* ElementName=nullptr, int level=-1); /// read until characters are found - void readCharacters(void); + void readCharacters(); /// read binary file void readBinFile(const char*); //@} @@ -164,7 +164,7 @@ public: /** @name Attribute handling */ //@{ /// get the number of attributes of the current element - unsigned int getAttributeCount(void) const; + unsigned int getAttributeCount() const; /// check if the read element has a special attribute bool hasAttribute(const char* AttrName) const; /// return the named attribute as an interer (does type checking) @@ -200,9 +200,9 @@ public: /// sets simultaneously the global and local PartialRestore bits void setPartialRestore(bool on); - void clearPartialRestoreDocumentObject(void); - void clearPartialRestoreProperty(void); - void clearPartialRestoreObject(void); + void clearPartialRestoreDocumentObject(); + void clearPartialRestoreProperty(); + void clearPartialRestoreObject(); /// return the status bits bool testStatus(ReaderStatus pos) const; @@ -216,7 +216,7 @@ public: protected: /// read the next element - bool read(void); + bool read(); // ----------------------------------------------------------------------- // Handlers for the SAX ContentHandler interface diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp index 67a6e5d525..7c1aedc2e2 100644 --- a/src/Base/Rotation.cpp +++ b/src/Base/Rotation.cpp @@ -104,7 +104,7 @@ void Rotation::operator = (const Rotation& rot) this->_angle = rot._angle; } -const double * Rotation::getValue(void) const +const double * Rotation::getValue() const { return &this->quat[0]; } @@ -315,7 +315,7 @@ void Rotation::normalize() } } -Rotation & Rotation::invert(void) +Rotation & Rotation::invert() { this->quat[0] = -this->quat[0]; this->quat[1] = -this->quat[1]; @@ -328,7 +328,7 @@ Rotation & Rotation::invert(void) return *this; } -Rotation Rotation::inverse(void) const +Rotation Rotation::inverse() const { Rotation rot; rot.quat[0] = -this->quat[0]; @@ -366,14 +366,14 @@ Rotation Rotation::operator*(const Rotation & q) const bool Rotation::operator==(const Rotation & q) const { - if ((this->quat[0] == q.quat[0] && - this->quat[1] == q.quat[1] && - this->quat[2] == q.quat[2] && - this->quat[3] == q.quat[3]) || - (this->quat[0] == -q.quat[0] && - this->quat[1] == -q.quat[1] && - this->quat[2] == -q.quat[2] && - this->quat[3] == -q.quat[3])) + if ((this->quat[0] == q.quat[0] && + this->quat[1] == q.quat[1] && + this->quat[2] == q.quat[2] && + this->quat[3] == q.quat[3]) || + (this->quat[0] == -q.quat[0] && + this->quat[1] == -q.quat[1] && + this->quat[2] == -q.quat[2] && + this->quat[3] == -q.quat[3])) return true; return false; } @@ -481,7 +481,7 @@ Rotation Rotation::slerp(const Rotation & q0, const Rotation & q1, double t) return Rotation(x, y, z, w); } -Rotation Rotation::identity(void) +Rotation Rotation::identity() { return Rotation(0.0, 0.0, 0.0, 1.0); } diff --git a/src/Base/Rotation.h b/src/Base/Rotation.h index aaf0c23307..bf08bbd481 100644 --- a/src/Base/Rotation.h +++ b/src/Base/Rotation.h @@ -50,7 +50,7 @@ public: /** Methods to get or set rotations. */ //@{ - const double * getValue(void) const; + const double * getValue() const; void getValue(double & q0, double & q1, double & q2, double & q3) const; void setValue(const double q0, const double q1, const double q2, const double q3); /// If not a null quaternion then \a axis will be normalized @@ -119,8 +119,8 @@ public: /** Invert rotations. */ //@{ - Rotation & invert(void); - Rotation inverse(void) const; + Rotation & invert(); + Rotation inverse() const; //@} /** Operators. */ @@ -142,7 +142,7 @@ public: /** Specialty constructors */ static Rotation slerp(const Rotation & rot0, const Rotation & rot1, double t); - static Rotation identity(void); + static Rotation identity(); /** * @brief makeRotationByAxes(xdir, ydir, zdir, priorityOrder): creates a rotation diff --git a/src/Base/Sequencer.cpp b/src/Base/Sequencer.cpp index 57cd67904f..fec662f41d 100644 --- a/src/Base/Sequencer.cpp +++ b/src/Base/Sequencer.cpp @@ -70,7 +70,7 @@ namespace Base { * all instantiated SequencerBase objects. */ std::vector SequencerP::_instances; - SequencerLauncher* SequencerP::_topLauncher = 0; + SequencerLauncher* SequencerP::_topLauncher = nullptr; #if QT_VERSION >= QT_VERSION_CHECK(5,14,0) QRecursiveMutex SequencerP::mutex; #else @@ -188,7 +188,7 @@ bool SequencerBase::isLocked() const bool SequencerBase::isRunning() const { QMutexLocker locker(&SequencerP::mutex); - return (SequencerP::_topLauncher != 0); + return (SequencerP::_topLauncher != nullptr); } bool SequencerBase::wasCanceled() const @@ -282,7 +282,7 @@ SequencerLauncher::~SequencerLauncher() if (SequencerP::_topLauncher == this) SequencerBase::Instance().stop(); if (SequencerP::_topLauncher == this) { - SequencerP::_topLauncher = 0; + SequencerP::_topLauncher = nullptr; } } diff --git a/src/Base/Sequencer.h b/src/Base/Sequencer.h index 00978c2fa5..2ca2899444 100644 --- a/src/Base/Sequencer.h +++ b/src/Base/Sequencer.h @@ -385,7 +385,7 @@ inline SequencerBase& Sequencer () class BaseExport ProgressIndicatorPy : public Py::PythonExtension { public: - static void init_type(void); // announce properties and methods + static void init_type(); // announce properties and methods ProgressIndicatorPy(); ~ProgressIndicatorPy(); diff --git a/src/Base/StackWalker.cpp b/src/Base/StackWalker.cpp index 152886cd58..b6ebeadb6e 100644 --- a/src/Base/StackWalker.cpp +++ b/src/Base/StackWalker.cpp @@ -80,7 +80,7 @@ * **********************************************************************/ #include -#include +#include #include #include #include @@ -93,7 +93,7 @@ // If VC7 and later, then use the shipped 'dbghelp.h'-file #pragma pack(push,8) #if _MSC_VER >= 1300 -#include +#include #else // inline the important dbghelp.h-declarations... typedef enum { diff --git a/src/Base/Stream.h b/src/Base/Stream.h index c779cb25a7..b68edd4641 100644 --- a/src/Base/Stream.h +++ b/src/Base/Stream.h @@ -26,7 +26,7 @@ #ifdef __GNUC__ -# include +# include #endif #include diff --git a/src/Base/Swap.cpp b/src/Base/Swap.cpp index 40690af797..55fecd0725 100644 --- a/src/Base/Swap.cpp +++ b/src/Base/Swap.cpp @@ -25,7 +25,7 @@ #include "Swap.h" -unsigned short Base::SwapOrder (void) +unsigned short Base::SwapOrder () { unsigned short usDummy = 1; return *((char*) &usDummy) == 1 ? LOW_ENDIAN : HIGH_ENDIAN; diff --git a/src/Base/Swap.h b/src/Base/Swap.h index aff92bb1d7..b881623522 100644 --- a/src/Base/Swap.h +++ b/src/Base/Swap.h @@ -36,7 +36,7 @@ namespace Base { */ /** Returns machine type (low endian, high endian) */ -unsigned short SwapOrder (void); +unsigned short SwapOrder (); void SwapVar (char&); void SwapVar (unsigned char&); diff --git a/src/Base/TimeInfo.cpp b/src/Base/TimeInfo.cpp index d34dc6edbe..170f596a93 100644 --- a/src/Base/TimeInfo.cpp +++ b/src/Base/TimeInfo.cpp @@ -58,7 +58,7 @@ TimeInfo::~TimeInfo() //************************************************************************** // separator for other implementation aspects -void TimeInfo::setCurrent(void) +void TimeInfo::setCurrent() { #if defined (FC_OS_BSD) || defined(FC_OS_LINUX) || defined(__MINGW32__) struct timeval t; diff --git a/src/Base/TimeInfo.h b/src/Base/TimeInfo.h index 8c0d9ca1c3..153392113d 100644 --- a/src/Base/TimeInfo.h +++ b/src/Base/TimeInfo.h @@ -27,18 +27,21 @@ // Std. configurations -#include +#include #if defined(FC_OS_BSD) #include #else #include #endif -#include +#include #ifdef __GNUC__ -# include +# include #endif +#include +#include + #if defined(FC_OS_BSD) struct timeb { @@ -60,11 +63,11 @@ public: virtual ~TimeInfo(); /// sets the object to the actual system time - void setCurrent(void); + void setCurrent(); void setTime_t (uint64_t seconds); - uint64_t getSeconds(void) const; - unsigned short getMiliseconds(void) const; + uint64_t getSeconds() const; + unsigned short getMiliseconds() const; //void operator = (const TimeInfo &time); bool operator == (const TimeInfo &time) const; @@ -90,12 +93,12 @@ protected: }; - inline uint64_t TimeInfo::getSeconds(void) const + inline uint64_t TimeInfo::getSeconds() const { return timebuffer.time; } - inline unsigned short TimeInfo::getMiliseconds(void) const + inline unsigned short TimeInfo::getMiliseconds() const { return timebuffer.millitm; } diff --git a/src/Base/Tools2D.cpp b/src/Base/Tools2D.cpp index 57622508ee..e988b9c19d 100644 --- a/src/Base/Tools2D.cpp +++ b/src/Base/Tools2D.cpp @@ -168,7 +168,7 @@ bool BoundBox2d::Intersect(const Polygon2d &rclPoly) const /********************************************************/ /** LINE2D **********************************************/ -BoundBox2d Line2d::CalcBoundBox (void) const +BoundBox2d Line2d::CalcBoundBox () const { BoundBox2d clBB; clBB.MinX = std::min (clV1.x, clV2.x); @@ -258,7 +258,7 @@ bool Line2d::IntersectAndContain (const Line2d& rclLine, Vector2d &rclV) const /********************************************************/ /** POLYGON2d ********************************************/ -BoundBox2d Polygon2d::CalcBoundBox (void) const +BoundBox2d Polygon2d::CalcBoundBox () const { unsigned long i; BoundBox2d clBB; diff --git a/src/Base/Tools2D.h b/src/Base/Tools2D.h index 7656557a70..752ee1a566 100644 --- a/src/Base/Tools2D.h +++ b/src/Base/Tools2D.h @@ -52,7 +52,7 @@ class BaseExport Vector2d public: double x, y; - inline Vector2d(void); + inline Vector2d(); inline Vector2d(float x, float y); inline Vector2d(double x, double y); inline Vector2d(const Vector2d &v); @@ -74,15 +74,15 @@ public: // methods inline bool IsNull(double tolerance = 0.0) const; - inline double Length(void) const; - inline double Angle(void) const; - inline double Sqr(void) const; + inline double Length() const; + inline double Angle() const; + inline double Sqr() const; inline Vector2d& Set(double x, double y); - inline Vector2d& Negate(void); + inline Vector2d& Negate(); inline Vector2d& Scale(double factor); inline Vector2d& Rotate(double angle); - inline Vector2d& Normalize(void); + inline Vector2d& Normalize(); inline Vector2d Perpendicular(bool clockwise = false) const; static inline Vector2d FromPolar(double r, double fi); @@ -104,10 +104,10 @@ class BaseExport BoundBox2d public: double MinX, MinY, MaxX, MaxY; - inline BoundBox2d (void); + inline BoundBox2d (); inline BoundBox2d (const BoundBox2d &rclBB); inline BoundBox2d (double fX1, double fY1, double fX2, double fY2); - inline bool IsValid (void); + inline bool IsValid (); inline bool IsEqual(const BoundBox2d&, double tolerance) const; // operators @@ -115,13 +115,13 @@ public: inline bool operator== (const BoundBox2d& rclBB) const; // methods - inline double Width(void) const; - inline double Height(void) const; + inline double Width() const; + inline double Height() const; inline bool Contains(const Vector2d &v) const; inline bool Contains(const Vector2d &v, double tolerance) const; - inline Vector2d GetCenter(void) const; + inline Vector2d GetCenter() const; - inline void SetVoid(void); + inline void SetVoid(); inline void Add(const Vector2d &v); bool Intersect(const Line2d &rclLine) const; @@ -139,13 +139,13 @@ class BaseExport Line2d public: Vector2d clV1, clV2; - Line2d (void) {} + Line2d () {} inline Line2d (const Line2d &rclLine); inline Line2d (const Vector2d &rclV1, const Vector2d &rclV2); // methods - inline double Length (void) const; - BoundBox2d CalcBoundBox (void) const; + inline double Length () const; + BoundBox2d CalcBoundBox () const; // operators inline Line2d& operator= (const Line2d& rclLine); @@ -167,22 +167,22 @@ public: class BaseExport Polygon2d { public: - Polygon2d (void) {} + Polygon2d () {} inline Polygon2d (const Polygon2d &rclPoly); virtual ~Polygon2d () {} inline Polygon2d& operator = (const Polygon2d &rclP); // admin-interface - inline size_t GetCtVectors (void) const; + inline size_t GetCtVectors () const; inline bool Add (const Vector2d &rclVct); inline Vector2d& operator[] (size_t ulNdx) const; inline Vector2d& At (size_t ulNdx) const; inline bool Delete (size_t ulNdx); - inline void DeleteAll (void); + inline void DeleteAll (); // misc - BoundBox2d CalcBoundBox (void) const; + BoundBox2d CalcBoundBox () const; bool Contains (const Vector2d &rclV) const; void Intersect (const Polygon2d &rclPolygon, std::list &rclResultPolygonList) const; bool Intersect (const Polygon2d &rclPolygon) const; @@ -194,7 +194,7 @@ private: /** INLINES ********************************************/ -inline Vector2d::Vector2d(void) +inline Vector2d::Vector2d() : x(0.0), y(0.0) { } @@ -226,7 +226,7 @@ inline bool Vector2d::operator== (const Vector2d &v) const return (x == v.x) && (y == v.y); } -inline Vector2d Vector2d::operator+ (void) const +inline Vector2d Vector2d::operator+ () const { return Vector2d(x, y); } @@ -243,7 +243,7 @@ inline Vector2d& Vector2d::operator+= (const Vector2d &v) return *this; } -inline Vector2d Vector2d::operator- (void) const +inline Vector2d Vector2d::operator- () const { return Vector2d(-x, -y); } @@ -299,17 +299,17 @@ inline bool Vector2d::IsNull(double tolerance) const return x*x + y*y <= tolerance*tolerance; } -inline double Vector2d::Length(void) const +inline double Vector2d::Length() const { return sqrt(x*x + y*y); } -inline double Vector2d::Angle(void) const +inline double Vector2d::Angle() const { return atan2(y, x); } -inline double Vector2d::Sqr(void) const +inline double Vector2d::Sqr() const { return x*x + y*y; } @@ -321,7 +321,7 @@ inline Vector2d& Vector2d::Set(double x, double y) return *this; } -inline Vector2d& Vector2d::Negate(void) +inline Vector2d& Vector2d::Negate() { x = -x; y = -y; @@ -342,7 +342,7 @@ inline Vector2d& Vector2d::Rotate(double angle) return *this; } -inline Vector2d& Vector2d::Normalize(void) +inline Vector2d& Vector2d::Normalize() { double length = Length(); if (length > 0.0) @@ -390,12 +390,12 @@ inline Polygon2d& Polygon2d::operator = (const Polygon2d &rclP) return *this; } -inline void Polygon2d::DeleteAll (void) +inline void Polygon2d::DeleteAll () { _aclVct.clear(); } -inline size_t Polygon2d::GetCtVectors (void) const +inline size_t Polygon2d::GetCtVectors () const { return _aclVct.size (); } @@ -439,7 +439,7 @@ inline Line2d::Line2d (const Vector2d &rclV1, const Vector2d &rclV2) { } -inline double Line2d::Length (void) const +inline double Line2d::Length () const { return (clV2 - clV1).Length (); } @@ -461,7 +461,7 @@ inline bool Line2d::Contains (const Vector2d &rclV) const return CalcBoundBox ().Contains (rclV); } -inline BoundBox2d::BoundBox2d (void) +inline BoundBox2d::BoundBox2d () { MinX = MinY = DOUBLE_MAX; MaxX = MaxY = - DOUBLE_MAX; @@ -483,7 +483,7 @@ inline BoundBox2d::BoundBox2d (double fX1, double fY1, double fX2, double fY2) MaxY = std::max( fY1, fY2 ); } -inline bool BoundBox2d::IsValid (void) +inline bool BoundBox2d::IsValid () { return (MaxX >= MinX) && (MaxY >= MinY); } @@ -511,12 +511,12 @@ inline bool BoundBox2d::operator== (const BoundBox2d& rclBB) const (MaxY == rclBB.MaxY); } -inline double BoundBox2d::Width(void) const +inline double BoundBox2d::Width() const { return MaxX - MinX; } -inline double BoundBox2d::Height(void) const +inline double BoundBox2d::Height() const { return MaxY - MinY; } @@ -533,12 +533,12 @@ inline bool BoundBox2d::Contains(const Vector2d &v, double tolerance) const && v.y >= MinY - tolerance && v.y <= MaxY + tolerance; } -inline Vector2d BoundBox2d::GetCenter(void) const +inline Vector2d BoundBox2d::GetCenter() const { return Vector2d((MinX + MaxX)*0.5, (MinY + MaxY)*0.5); } -inline void BoundBox2d::SetVoid(void) +inline void BoundBox2d::SetVoid() { MinX = MinY = DOUBLE_MAX; MaxX = MaxY = -DOUBLE_MAX; diff --git a/src/Base/Type.cpp b/src/Base/Type.cpp index 1019f8a3c4..6922d49088 100644 --- a/src/Base/Type.cpp +++ b/src/Base/Type.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... @@ -42,7 +42,7 @@ struct Base::TypeData TypeData(const char *theName, const Type type = Type::badType(), const Type theParent = Type::badType(), - Type::instantiationMethod method = 0 + Type::instantiationMethod method = nullptr ):name(theName),parent(theParent),type(type),instMethod(method) { } std::string name; @@ -82,7 +82,7 @@ Type::~Type() { } -void *Type::createInstance(void) +void *Type::createInstance() { return (typedata[index]->instMethod)(); } @@ -97,7 +97,7 @@ void *Type::createInstanceByName(const char* TypeName, bool bLoadModule) // now the type should be in the type map Type t = fromName(TypeName); if (t == badType()) - return 0; + return nullptr; return t.createInstance(); } @@ -131,7 +131,7 @@ string Type::getModuleName(const char* ClassName) return string(); } -Type Type::badType(void) +Type Type::badType() { Type bad; bad.index = 0; @@ -153,7 +153,7 @@ const Type Type::createType(const Type parent, const char *name, instantiationMe } -void Type::init(void) +void Type::init() { assert(Type::typedata.size() == 0); @@ -164,7 +164,7 @@ void Type::init(void) } -void Type::destruct(void) +void Type::destruct() { for(std::vector::const_iterator it = typedata.begin();it!= typedata.end();++it) delete *it; @@ -192,12 +192,12 @@ Type Type::fromKey(unsigned int key) return Type::badType(); } -const char *Type::getName(void) const +const char *Type::getName() const { return typedata[index]->name.c_str(); } -const Type Type::getParent(void) const +const Type Type::getParent() const { return typedata[index]->parent; } @@ -230,7 +230,7 @@ int Type::getAllDerivedFrom(const Type type, std::vector & List) return cnt; } -int Type::getNumTypes(void) +int Type::getNumTypes() { return typedata.size(); } diff --git a/src/Base/Type.h b/src/Base/Type.h index 3aab2208e6..9c73669a12 100644 --- a/src/Base/Type.h +++ b/src/Base/Type.h @@ -82,34 +82,34 @@ class BaseExport Type public: /// Construction Type(const Type& type); - Type(void); + Type(); /// Destruction virtual ~Type(); /// creates a instance of this type - void *createInstance(void); + void *createInstance(); /// creates a instance of the named type static void *createInstanceByName(const char* TypeName, bool bLoadModule=false); static void importModule(const char* TypeName); - typedef void * (*instantiationMethod)(void); + typedef void * (*instantiationMethod)(); static Type fromName(const char *name); static Type fromKey(unsigned int key); - const char *getName(void) const; - const Type getParent(void) const; + const char *getName() const; + const Type getParent() const; bool isDerivedFrom(const Type type) const; static int getAllDerivedFrom(const Type type, std::vector& List); /// Returns the given named type if is derived from parent type, otherwise return bad type static Type getTypeIfDerivedFrom(const char* name , const Type parent, bool bLoadModule=false); - static int getNumTypes(void); + static int getNumTypes(); - static const Type createType(const Type parent, const char *name,instantiationMethod method = 0); + static const Type createType(const Type parent, const char *name,instantiationMethod method = nullptr); - unsigned int getKey(void) const; - bool isBad(void) const; + unsigned int getKey() const; + bool isBad() const; void operator = (const Type type); bool operator == (const Type type) const; @@ -120,9 +120,9 @@ public: bool operator >= (const Type type) const; bool operator > (const Type type) const; - static Type badType(void); - static void init(void); - static void destruct(void); + static Type badType(); + static void init(); + static void destruct(); protected: static std::string getModuleName(const char* ClassName); @@ -143,7 +143,7 @@ private: inline unsigned int -Type::getKey(void) const +Type::getKey() const { return this->index; } @@ -191,7 +191,7 @@ Type::operator > (const Type type) const } inline bool -Type::isBad(void) const +Type::isBad() const { return (this->index == 0); } diff --git a/src/Base/Unit.cpp b/src/Base/Unit.cpp index d13c464927..4fb1d9597b 100644 --- a/src/Base/Unit.cpp +++ b/src/Base/Unit.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include +# include #endif #include "Unit.h" @@ -144,7 +144,7 @@ Unit Unit::pow(signed char exp) const return result; } -bool Unit::isEmpty(void)const +bool Unit::isEmpty()const { return (this->Sig.Length == 0) && (this->Sig.Mass == 0) @@ -233,7 +233,7 @@ Unit& Unit::operator = (const Unit &New) return *this; } -QString Unit::getString(void) const +QString Unit::getString() const { std::stringstream ret; @@ -424,7 +424,7 @@ QString Unit::getString(void) const return QString::fromUtf8(ret.str().c_str()); } -QString Unit::getTypeString(void) const +QString Unit::getTypeString() const { if(*this == Unit::Length ) return QString::fromLatin1("Length"); if(*this == Unit::Area ) return QString::fromLatin1("Area"); diff --git a/src/Base/Unit.h b/src/Base/Unit.h index d1db414334..b99364e710 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -27,7 +27,7 @@ #ifdef _MSC_VER # include #else -# include +# include #endif #include #include @@ -65,7 +65,7 @@ class BaseExport Unit public: /// default constructor Unit(int8_t Length,int8_t Mass=0,int8_t Time=0,int8_t ElectricCurrent=0,int8_t ThermodynamicTemperature=0,int8_t AmountOfSubstance=0,int8_t LuminousIntensity=0,int8_t Angle=0); - Unit(void); + Unit(); Unit(const Unit&); explicit Unit(const QString& expr); /// Destruction @@ -84,12 +84,12 @@ public: Unit pow(signed char exp)const; //@} /// get the unit signature - const UnitSignature & getSignature(void)const {return Sig;} - bool isEmpty(void)const; + const UnitSignature & getSignature()const {return Sig;} + bool isEmpty()const; - QString getString(void) const; + QString getString() const; /// get the type as an string such as "Area", "Length" or "Pressure". - QString getTypeString(void) const; + QString getTypeString() const; /** Predefined Unit types. */ //@{ diff --git a/src/Base/UnitsSchema.h b/src/Base/UnitsSchema.h index 09a07d2626..e90e72fbe8 100644 --- a/src/Base/UnitsSchema.h +++ b/src/Base/UnitsSchema.h @@ -59,9 +59,9 @@ public: * Here it's theoretically possible that you can change the static factors * for certain units (e.g. mi = 1,8km instead of mi=1.6km). */ - virtual void setSchemaUnits(void){} + virtual void setSchemaUnits(){} /// If you use setSchemaUnits() you also have to impment this method to undo your changes! - virtual void resetSchemaUnits(void){} + virtual void resetSchemaUnits(){} /// This method translates the quantity in a string as the user may expect it. virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString)=0; diff --git a/src/Base/Uuid.cpp b/src/Base/Uuid.cpp index 8e4a525f29..69dd9ac643 100644 --- a/src/Base/Uuid.cpp +++ b/src/Base/Uuid.cpp @@ -64,7 +64,7 @@ Uuid::~Uuid() //************************************************************************** // Get the UUID //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -std::string Uuid::createUuid(void) +std::string Uuid::createUuid() { std::string Uuid; QString uuid = QUuid::createUuid().toString(); @@ -93,7 +93,7 @@ void Uuid::setValue(const std::string &sString) setValue(sString.c_str()); } -const std::string& Uuid::getValue(void) const +const std::string& Uuid::getValue() const { return _uuid; } diff --git a/src/Base/Uuid.h b/src/Base/Uuid.h index 1e68a533ce..856b41421b 100644 --- a/src/Base/Uuid.h +++ b/src/Base/Uuid.h @@ -47,8 +47,8 @@ public: void setValue(const char* sString); void setValue(const std::string &sString); - const std::string& getValue(void) const; - static std::string createUuid(void); + const std::string& getValue() const; + static std::string createUuid(); bool operator==(const Uuid &other) const {return _uuid == other._uuid;} bool operator<(const Uuid &other) const {return _uuid < other._uuid;} diff --git a/src/Base/Vector3D.cpp b/src/Base/Vector3D.cpp index 98abe07092..756b4ba8cd 100644 --- a/src/Base/Vector3D.cpp +++ b/src/Base/Vector3D.cpp @@ -99,7 +99,7 @@ Vector3<_Precision> Vector3<_Precision>::operator - (const Vector3<_Precision>& } template -Vector3<_Precision> Vector3<_Precision>::operator - (void) const +Vector3<_Precision> Vector3<_Precision>::operator - () const { return Vector3(-x, -y, -z); } @@ -259,7 +259,7 @@ _Precision Vector3<_Precision>::DistanceToPlane (const Vector3<_Precision> &rclB } template -_Precision Vector3<_Precision>::Length (void) const +_Precision Vector3<_Precision>::Length () const { return (_Precision)sqrt ((x * x) + (y * y) + (z * z)); } @@ -303,7 +303,7 @@ Vector3<_Precision> Vector3<_Precision>::Perpendicular(const Vector3<_Precision> } template -_Precision Vector3<_Precision>::Sqr (void) const +_Precision Vector3<_Precision>::Sqr () const { return (_Precision) ((x * x) + (y * y) + (z * z)); } @@ -405,7 +405,7 @@ void Vector3<_Precision>::RotateZ (_Precision f) } template -Vector3<_Precision> & Vector3<_Precision>::Normalize (void) +Vector3<_Precision> & Vector3<_Precision>::Normalize () { _Precision fLen = Length (); if (fLen != (_Precision)0.0 && fLen != (_Precision)1.0) { diff --git a/src/Base/Vector3D.h b/src/Base/Vector3D.h index feb3c58aae..020eab14b8 100644 --- a/src/Base/Vector3D.h +++ b/src/Base/Vector3D.h @@ -106,7 +106,7 @@ public: /// Vector subtraction Vector3 operator - (const Vector3<_Precision>& rcVct) const; /// Negative vector - Vector3 operator - (void) const; + Vector3 operator - () const; /// Vector summation Vector3 & operator += (const Vector3<_Precision>& rcVct); /// Vector subtraction @@ -156,11 +156,11 @@ public: /** @name Mathematics */ //@{ /// Length of the vector. - _Precision Length (void) const; + _Precision Length () const; /// Squared length of the vector. - _Precision Sqr (void) const; + _Precision Sqr () const; /// Set length to 1. - Vector3 & Normalize (void); + Vector3 & Normalize (); /// Checks whether this is the null vector bool IsNull() const; /// Get angle between both vectors. The returned value lies in the interval [0,pi]. diff --git a/src/Base/VectorPyImp.cpp b/src/Base/VectorPyImp.cpp index ea024cb3ac..c79d5920d4 100644 --- a/src/Base/VectorPyImp.cpp +++ b/src/Base/VectorPyImp.cpp @@ -39,7 +39,7 @@ using namespace Base; // returns a string which represent the object e.g. when printed in python -std::string VectorPy::representation(void) const +std::string VectorPy::representation() const { VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); Py::Float x(ptr->x); @@ -93,7 +93,7 @@ int VectorPy::PyInit(PyObject* args, PyObject* /*kwd*/) PyObject* VectorPy::__reduce__(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Py::Tuple tuple(2); @@ -114,11 +114,11 @@ PyObject* VectorPy::number_add_handler(PyObject *self, PyObject *other) { if (!PyObject_TypeCheck(self, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(other, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } Base::Vector3d a = static_cast(self)->value(); Base::Vector3d b = static_cast(other)->value(); @@ -129,11 +129,11 @@ PyObject* VectorPy::number_subtract_handler(PyObject *self, PyObject *other) { if (!PyObject_TypeCheck(self, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(other, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } Base::Vector3d a = static_cast(self)->value(); Base::Vector3d b = static_cast(other)->value(); @@ -156,7 +156,7 @@ PyObject* VectorPy::number_multiply_handler(PyObject *self, PyObject *other) } else { PyErr_SetString(PyExc_NotImplementedError, "Not implemented"); - return 0; + return nullptr; } } else if (PyObject_TypeCheck(other, &(VectorPy::Type))) { @@ -167,12 +167,12 @@ PyObject* VectorPy::number_multiply_handler(PyObject *self, PyObject *other) } else { PyErr_SetString(PyExc_TypeError, "A Vector can only be multiplied by Vector or number"); - return 0; + return nullptr; } } else { PyErr_SetString(PyExc_TypeError, "First or second arg must be Vector"); - return 0; + return nullptr; } } @@ -185,11 +185,11 @@ PyObject * VectorPy::sequence_item (PyObject *self, Py_ssize_t index) { if (!PyObject_TypeCheck(self, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "first arg must be Vector"); - return 0; + return nullptr; } if (index < 0 || index > 2) { PyErr_SetString(PyExc_IndexError, "index out of range"); - return 0; + return nullptr; } Base::Vector3d a = static_cast(self)->value(); @@ -225,7 +225,7 @@ PyObject * VectorPy::mapping_subscript(PyObject *self, PyObject *item) if (PyIndex_Check(item)) { Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) - return NULL; + return nullptr; if (i < 0) i += sequence_length(self); return sequence_item(self, i); @@ -237,7 +237,7 @@ PyObject * VectorPy::mapping_subscript(PyObject *self, PyObject *item) if (PySlice_GetIndicesEx(slice, sequence_length(self), &start, &stop, &step, &slicelength) < 0) { - return NULL; + return nullptr; } if (slicelength <= 0) { @@ -269,14 +269,14 @@ PyObject * VectorPy::mapping_subscript(PyObject *self, PyObject *item) PyErr_Format(PyExc_TypeError, "Vector indices must be integers or slices, not %.200s", Py_TYPE(item)->tp_name); - return NULL; + return nullptr; } PyObject* VectorPy::add(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) - return 0; + return nullptr; VectorPy* vec = static_cast(obj); @@ -291,7 +291,7 @@ PyObject* VectorPy::sub(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) - return 0; + return nullptr; VectorPy* vec = static_cast(obj); @@ -305,7 +305,7 @@ PyObject* VectorPy::sub(PyObject *args) PyObject* VectorPy::negative(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; VectorPy::PointerType this_ptr = reinterpret_cast(_pcTwinPointer); Base::Vector3d v = -(*this_ptr); @@ -319,11 +319,11 @@ PyObject* VectorPy::richCompare(PyObject *v, PyObject *w, int op) Vector3d v1 = static_cast(v)->value(); Vector3d v2 = static_cast(w)->value(); - PyObject *res=0; + PyObject *res=nullptr; if (op != Py_EQ && op != Py_NE) { PyErr_SetString(PyExc_TypeError, "no ordering relation is defined for Vector"); - return 0; + return nullptr; } else if (op == Py_EQ) { res = (v1 == v2) ? Py_True : Py_False; @@ -348,7 +348,7 @@ PyObject* VectorPy::isEqual(PyObject *args) PyObject *obj; double tolerance=0; if (!PyArg_ParseTuple(args, "O!d", &(VectorPy::Type), &obj, &tolerance)) - return 0; + return nullptr; VectorPy* vec = static_cast(obj); @@ -363,7 +363,7 @@ PyObject* VectorPy::scale(PyObject *args) { double factorX, factorY, factorZ; if (!PyArg_ParseTuple(args, "ddd", &factorX, &factorY, &factorZ)) - return 0; + return nullptr; VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); ptr->Scale(factorX, factorY, factorZ); @@ -374,7 +374,7 @@ PyObject* VectorPy::multiply(PyObject *args) { double factor; if (!PyArg_ParseTuple(args, "d", &factor)) - return 0; + return nullptr; VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); ptr->Scale(factor, factor, factor); @@ -385,7 +385,7 @@ PyObject* VectorPy::dot(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) - return 0; + return nullptr; VectorPy* vec = static_cast(obj); @@ -400,7 +400,7 @@ PyObject* VectorPy::cross(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) - return 0; + return nullptr; VectorPy* vec = static_cast(obj); @@ -415,14 +415,14 @@ PyObject* VectorPy::isOnLineSegment(PyObject *args) { PyObject *start, *end; if (!PyArg_ParseTuple(args, "OO",&start, &end)) - return 0; + return nullptr; if (!PyObject_TypeCheck(start, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(end, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } VectorPy* start_vec = static_cast(start); @@ -441,7 +441,7 @@ PyObject* VectorPy::getAngle(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) - return 0; + return nullptr; VectorPy* vec = static_cast(obj); @@ -455,11 +455,11 @@ PyObject* VectorPy::getAngle(PyObject *args) PyObject* VectorPy::normalize(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); if (ptr->Length() < Vector3d::epsilon()) { PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot normalize null vector"); - return 0; + return nullptr; } ptr->Normalize(); @@ -471,14 +471,14 @@ PyObject* VectorPy::projectToLine(PyObject *args) { PyObject *base, *line; if (!PyArg_ParseTuple(args, "OO",&base, &line)) - return 0; + return nullptr; if (!PyObject_TypeCheck(base, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(line, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } VectorPy* base_vec = static_cast(base); @@ -497,14 +497,14 @@ PyObject* VectorPy::projectToPlane(PyObject *args) { PyObject *base, *line; if (!PyArg_ParseTuple(args, "OO",&base, &line)) - return 0; + return nullptr; if (!PyObject_TypeCheck(base, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(line, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } VectorPy* base_vec = static_cast(base); @@ -523,7 +523,7 @@ PyObject* VectorPy::distanceToPoint(PyObject *args) { PyObject *pnt; if (!PyArg_ParseTuple(args, "O!",&(VectorPy::Type),&pnt)) - return 0; + return nullptr; VectorPy* base_vec = static_cast(pnt); VectorPy::PointerType this_ptr = reinterpret_cast(_pcTwinPointer); @@ -537,14 +537,14 @@ PyObject* VectorPy::distanceToLine(PyObject *args) { PyObject *base, *line; if (!PyArg_ParseTuple(args, "OO",&base, &line)) - return 0; + return nullptr; if (!PyObject_TypeCheck(base, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(line, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } VectorPy* base_vec = static_cast(base); @@ -562,14 +562,14 @@ PyObject* VectorPy::distanceToLineSegment(PyObject *args) { PyObject *base, *line; if (!PyArg_ParseTuple(args, "OO",&base, &line)) - return 0; + return nullptr; if (!PyObject_TypeCheck(base, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(line, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } VectorPy* base_vec = static_cast(base); @@ -587,14 +587,14 @@ PyObject* VectorPy::distanceToPlane(PyObject *args) { PyObject *base, *line; if (!PyArg_ParseTuple(args, "OO",&base, &line)) - return 0; + return nullptr; if (!PyObject_TypeCheck(base, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "First arg must be Vector"); - return 0; + return nullptr; } if (!PyObject_TypeCheck(line, &(VectorPy::Type))) { PyErr_SetString(PyExc_TypeError, "Second arg must be Vector"); - return 0; + return nullptr; } VectorPy* base_vec = static_cast(base); @@ -608,7 +608,7 @@ PyObject* VectorPy::distanceToPlane(PyObject *args) return Py::new_reference_to(dist); } -Py::Float VectorPy::getLength(void) const +Py::Float VectorPy::getLength() const { VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); return Py::Float(ptr->Length()); @@ -628,7 +628,7 @@ void VectorPy::setLength(Py::Float arg) ptr->z *= val; } -Py::Float VectorPy::getx(void) const +Py::Float VectorPy::getx() const { VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); return Py::Float(ptr->x); @@ -640,7 +640,7 @@ void VectorPy::setx(Py::Float arg) ptr->x = (double)arg; } -Py::Float VectorPy::gety(void) const +Py::Float VectorPy::gety() const { VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); return Py::Float(ptr->y); @@ -652,7 +652,7 @@ void VectorPy::sety(Py::Float arg) ptr->y = (double)arg; } -Py::Float VectorPy::getz(void) const +Py::Float VectorPy::getz() const { VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); return Py::Float(ptr->z); @@ -666,7 +666,7 @@ void VectorPy::setz(Py::Float arg) PyObject *VectorPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int VectorPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) @@ -688,7 +688,7 @@ PyObject * VectorPy::number_divide_handler (PyObject* self, PyObject* other) if (PyObject_TypeCheck(other, &(VectorPy::Type))) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } Base::Vector3d vec = static_cast(self) ->value(); @@ -696,7 +696,7 @@ PyObject * VectorPy::number_divide_handler (PyObject* self, PyObject* other) if (div == 0) { PyErr_Format(PyExc_ZeroDivisionError, "'%s' division by zero", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } vec /= div; @@ -705,7 +705,7 @@ PyObject * VectorPy::number_divide_handler (PyObject* self, PyObject* other) PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_remainder_handler (PyObject* self, PyObject* other) @@ -720,21 +720,21 @@ PyObject * VectorPy::number_remainder_handler (PyObject* self, PyObject* other) PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for %%: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_divmod_handler (PyObject* self, PyObject* other) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for divmod(): '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_power_handler (PyObject* self, PyObject* other, PyObject* /*arg*/) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for ** or pow(): '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_negative_handler (PyObject* self) @@ -746,7 +746,7 @@ PyObject * VectorPy::number_negative_handler (PyObject* self) PyErr_Format(PyExc_TypeError, "bad operand type for unary -: '%s'", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_positive_handler (PyObject* self) @@ -758,7 +758,7 @@ PyObject * VectorPy::number_positive_handler (PyObject* self) PyErr_Format(PyExc_TypeError, "bad operand type for unary +: '%s'", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_absolute_handler (PyObject* self) @@ -773,7 +773,7 @@ PyObject * VectorPy::number_absolute_handler (PyObject* self) PyErr_Format(PyExc_TypeError, "bad operand type for abs(): '%s'", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } int VectorPy::number_nonzero_handler (PyObject* /*self*/) @@ -785,54 +785,54 @@ PyObject * VectorPy::number_invert_handler (PyObject* self) { PyErr_Format(PyExc_TypeError, "bad operand type for unary ~: '%s'", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_lshift_handler (PyObject* self, PyObject* other) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for <<: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_rshift_handler (PyObject* self, PyObject* other) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for >>: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_and_handler (PyObject* self, PyObject* other) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for &: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_xor_handler (PyObject* self, PyObject* other) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for ^: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_or_handler (PyObject* self, PyObject* other) { PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for |: '%s' and '%s'", Py_TYPE(self)->tp_name, Py_TYPE(other)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_int_handler (PyObject* self) { PyErr_Format(PyExc_TypeError, "int() argument must be a string or a number, not '%s'", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } PyObject * VectorPy::number_float_handler (PyObject* self) { PyErr_Format(PyExc_TypeError, "float() argument must be a string or a number, not '%s'", Py_TYPE(self)->tp_name); - return 0; + return nullptr; } diff --git a/src/Base/ViewProj.cpp b/src/Base/ViewProj.cpp index a5f485713a..a40039177f 100644 --- a/src/Base/ViewProj.cpp +++ b/src/Base/ViewProj.cpp @@ -34,7 +34,7 @@ ViewProjMethod::ViewProjMethod() /*! Calculate the composed projection matrix which is a product of * projection matrix multiplied with input transformation matrix. */ -Matrix4D ViewProjMethod::getComposedProjectionMatrix (void) const +Matrix4D ViewProjMethod::getComposedProjectionMatrix () const { Matrix4D mat = getProjectionMatrix(); @@ -103,7 +103,7 @@ ViewProjMatrix::~ViewProjMatrix() { } -Matrix4D ViewProjMatrix::getProjectionMatrix (void) const +Matrix4D ViewProjMatrix::getProjectionMatrix () const { // Return the same matrix as passed to the constructor Matrix4D mat(_clMtx); @@ -205,7 +205,7 @@ ViewOrthoProjMatrix::~ViewOrthoProjMatrix() { } -Matrix4D ViewOrthoProjMatrix::getProjectionMatrix (void) const +Matrix4D ViewOrthoProjMatrix::getProjectionMatrix () const { return _clMtx; } diff --git a/src/Base/ViewProj.h b/src/Base/ViewProj.h index 15faaf6374..1344009b0f 100644 --- a/src/Base/ViewProj.h +++ b/src/Base/ViewProj.h @@ -47,9 +47,9 @@ public: /** Convert a 2D point on the projection plane in 3D space */ virtual Vector3d inverse (const Vector3d &rclPt) const = 0; /** Calculate the projection (+ mapping) matrix */ - virtual Matrix4D getProjectionMatrix (void) const = 0; + virtual Matrix4D getProjectionMatrix () const = 0; /** Calculate the composed projection matrix */ - Matrix4D getComposedProjectionMatrix (void) const; + Matrix4D getComposedProjectionMatrix () const; /** Apply an additional transformation to the input points */ void setTransform(const Base::Matrix4D&); const Base::Matrix4D& getTransform() const { @@ -81,7 +81,7 @@ public: Vector3f inverse (const Vector3f &rclPt) const; Vector3d inverse (const Vector3d &rclPt) const; - Matrix4D getProjectionMatrix (void) const; + Matrix4D getProjectionMatrix () const; protected: bool isOrthographic; @@ -105,7 +105,7 @@ public: Vector3f inverse (const Vector3f &rclPt) const; Vector3d inverse (const Vector3d &rclPt) const; - Matrix4D getProjectionMatrix (void) const; + Matrix4D getProjectionMatrix () const; protected: Matrix4D _clMtx, _clMtxInv; diff --git a/src/Base/Writer.cpp b/src/Base/Writer.cpp index 753e4b5b31..be51abd4b5 100644 --- a/src/Base/Writer.cpp +++ b/src/Base/Writer.cpp @@ -49,7 +49,7 @@ using namespace zipios; // Writer: Constructors and Destructor // --------------------------------------------------------------------------- -Writer::Writer(void) +Writer::Writer() : indent(0),forceXML(false),fileVersion(1) { indBuf[0] = '\0'; @@ -94,7 +94,7 @@ void Writer::setForceXML(bool on) forceXML = on; } -bool Writer::isForceXML(void) +bool Writer::isForceXML() { return forceXML; } @@ -215,7 +215,7 @@ const std::vector& Writer::getFilenames() const return FileNames; } -void Writer::incInd(void) +void Writer::incInd() { if (indent < 1020) { indBuf[indent ] = ' '; @@ -227,7 +227,7 @@ void Writer::incInd(void) } } -void Writer::decInd(void) +void Writer::decInd() { if (indent >= 4) { indent -= 4; @@ -264,7 +264,7 @@ ZipWriter::ZipWriter(std::ostream& os) ZipStream.setf(ios::fixed,ios::floatfield); } -void ZipWriter::writeFiles(void) +void ZipWriter::writeFiles() { // use a while loop because it is possible that while // processing the files new ones can be added @@ -303,7 +303,7 @@ bool FileWriter::shouldWrite(const std::string& , const Base::Persistence *) con return true; } -void FileWriter::writeFiles(void) +void FileWriter::writeFiles() { // use a while loop because it is possible that while // processing the files new ones can be added diff --git a/src/Base/Writer.h b/src/Base/Writer.h index bbf29619cd..26ccea2d0b 100644 --- a/src/Base/Writer.h +++ b/src/Base/Writer.h @@ -58,13 +58,13 @@ class BaseExport Writer { public: - Writer(void); + Writer(); virtual ~Writer(); /// switch the writer in XML only mode (no files allowed) void setForceXML(bool on); /// check on state - bool isForceXML(void); + bool isForceXML(); void setFileVersion(int); int getFileVersion() const; @@ -78,7 +78,7 @@ public: /// add a write request of a persistent object std::string addFile(const char* Name, const Base::Persistence *Object); /// process the requested file storing - virtual void writeFiles(void)=0; + virtual void writeFiles()=0; /// get all registered file names const std::vector& getFilenames() const; /// Set mode @@ -106,14 +106,14 @@ public: /** @name pretty formatting for XML */ //@{ /// get the current indentation - const char* ind(void) const {return indBuf;} + const char* ind() const {return indBuf;} /// increase indentation by one tab - void incInd(void); + void incInd(); /// decrease indentation by one tab - void decInd(void); + void decInd(); //@} - virtual std::ostream &Stream(void)=0; + virtual std::ostream &Stream()=0; /// name for underlying file saves std::string ObjectName; @@ -150,9 +150,9 @@ public: ZipWriter(std::ostream&); virtual ~ZipWriter(); - virtual void writeFiles(void); + virtual void writeFiles(); - virtual std::ostream &Stream(void){return ZipStream;} + virtual std::ostream &Stream(){return ZipStream;} void setComment(const char* str){ZipStream.setComment(str);} void setLevel(int level){ZipStream.setLevel( level );} @@ -172,9 +172,9 @@ class BaseExport StringWriter : public Writer { public: - virtual std::ostream &Stream(void){return StrStream;} - std::string getString(void) const {return StrStream.str();} - virtual void writeFiles(void){} + virtual std::ostream &Stream(){return StrStream;} + std::string getString() const {return StrStream.str();} + virtual void writeFiles(){} private: std::stringstream StrStream; @@ -192,9 +192,9 @@ public: virtual ~FileWriter(); void putNextEntry(const char* file); - virtual void writeFiles(void); + virtual void writeFiles(); - virtual std::ostream &Stream(void){return FileStream;} + virtual std::ostream &Stream(){return FileStream;} void close() {FileStream.close();} /*! This method can be re-implemented in sub-classes to avoid diff --git a/src/Base/XMLTools.cpp b/src/Base/XMLTools.cpp index 1b65ad26e8..382c186d52 100644 --- a/src/Base/XMLTools.cpp +++ b/src/Base/XMLTools.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... diff --git a/src/Base/gzstream.cpp b/src/Base/gzstream.cpp index 8912ec0647..ba63d45648 100644 --- a/src/Base/gzstream.cpp +++ b/src/Base/gzstream.cpp @@ -28,7 +28,7 @@ #include "PreCompiled.h" #include "gzstream.h" -#include +#include #include #include // for memcpy @@ -49,12 +49,12 @@ const int gzstreambuf::bufferSize = BUFFERSIZE; gzstreambuf* gzstreambuf::open( const char* name, int open_mode, int comp) { if ( is_open()) - return (gzstreambuf*)0; + return (gzstreambuf*)nullptr; mode = open_mode; // no append nor read/write mode if ((mode & std::ios::ate) || (mode & std::ios::app) || ((mode & std::ios::in) && (mode & std::ios::out))) - return (gzstreambuf*)0; + return (gzstreambuf*)nullptr; char fmode[10]; char* fmodeptr = fmode; if ( mode & std::ios::in) @@ -67,8 +67,8 @@ gzstreambuf* gzstreambuf::open( const char* name, int open_mode, int comp) *fmodeptr++ = 'b'; *fmodeptr = '\0'; file = gzopen( name, fmode); - if (file == 0) - return (gzstreambuf*)0; + if (file == nullptr) + return (gzstreambuf*)nullptr; opened = 1; return this; } @@ -80,7 +80,7 @@ gzstreambuf * gzstreambuf::close() { if ( gzclose( file) == Z_OK) return this; } - return (gzstreambuf*)0; + return (gzstreambuf*)nullptr; } int gzstreambuf::underflow() { // used for input buffer only diff --git a/src/Base/gzstream.h b/src/Base/gzstream.h index 02472200a7..0816bc5873 100644 --- a/src/Base/gzstream.h +++ b/src/Base/gzstream.h @@ -65,7 +65,7 @@ private: int flush_buffer(); public: - gzstreambuf() : file(0), opened(0), mode(0) { + gzstreambuf() : file(nullptr), opened(0), mode(0) { setp( buffer, buffer + (bufferSize-1)); setg( buffer + 4, // beginning of putback area buffer + 4, // read position diff --git a/src/Base/swigpyrun.inl b/src/Base/swigpyrun.inl index 5cb3ad10c5..dcfea7e896 100644 --- a/src/Base/swigpyrun.inl +++ b/src/Base/swigpyrun.inl @@ -23,11 +23,11 @@ int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own) { - swig_module_info *module = SWIG_GetModule(NULL); + swig_module_info *module = SWIG_GetModule(nullptr); if (!module) return 1; - swig_type_info * swig_type = 0; + swig_type_info * swig_type = nullptr; swig_type = SWIG_TypeQuery(TypeName); if (!swig_type) { std::stringstream str; @@ -36,7 +36,7 @@ int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int } *ptr = SWIG_NewPointerObj(obj,swig_type,own); - if (*ptr == 0) + if (*ptr == nullptr) throw Base::RuntimeError("Cannot convert into requested type"); // success @@ -45,11 +45,11 @@ int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags) { - swig_module_info *module = SWIG_GetModule(NULL); + swig_module_info *module = SWIG_GetModule(nullptr); if (!module) return 1; - swig_type_info * swig_type = 0; + swig_type_info * swig_type = nullptr; swig_type = SWIG_TypeQuery(TypeName); if (!swig_type) throw Base::RuntimeError("Cannot find type information for requested type"); @@ -64,11 +64,11 @@ int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int void cleanupSWIG_T(const char* TypeName) { - swig_module_info *swig_module = SWIG_GetModule(NULL); + swig_module_info *swig_module = SWIG_GetModule(nullptr); if (!swig_module) return; - swig_type_info * swig_type = 0; + swig_type_info * swig_type = nullptr; swig_type = SWIG_TypeQuery(TypeName); if (!swig_type) return; @@ -76,13 +76,13 @@ void cleanupSWIG_T(const char* TypeName) PyObject *module, *dict; PyObject *modules = PyImport_GetModuleDict(); module = PyDict_GetItemString(modules, "__builtin__"); - if (module != NULL && PyModule_Check(module)) { + if (module != nullptr && PyModule_Check(module)) { dict = PyModule_GetDict(module); PyDict_SetItemString(dict, "_", Py_None); } module = PyDict_GetItemString(modules, "__main__"); - if (module != NULL && PyModule_Check(module)) { + if (module != nullptr && PyModule_Check(module)) { PyObject* dict = PyModule_GetDict(module); if (!dict) return; @@ -91,8 +91,8 @@ void cleanupSWIG_T(const char* TypeName) pos = 0; while (PyDict_Next(dict, &pos, &key, &value)) { if (value != Py_None && PyUnicode_Check(key)) { - void* ptr = 0; - if (SWIG_ConvertPtr(value, &ptr, 0, 0) == 0) + void* ptr = nullptr; + if (SWIG_ConvertPtr(value, &ptr, nullptr, 0) == 0) PyDict_SetItem(dict, key, Py_None); } }