Base: modernize C++11

* remove redundant void-arg
* use nullptr
* replace deprecated headers
This commit is contained in:
wmayer
2022-01-25 20:21:30 +01:00
parent 6c29c65013
commit cad0d01883
72 changed files with 628 additions and 633 deletions

View File

@@ -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;}

View File

@@ -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<AxisPy::PointerType>(_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<VectorPy*>(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<PlacementPy*>(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*/)

View File

@@ -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 <FCGlobal.h>
#include <string>
namespace Base
{
namespace Base
{
std::string BaseExport base64_encode(unsigned char const* , unsigned int len);
std::string BaseExport base64_decode(std::string const& s);

View File

@@ -24,7 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <assert.h>
# include <cassert>
#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;

View File

@@ -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<typename T> T * freecad_dynamic_cast(Base::BaseClass * t)
if (t && t->isDerivedFrom(T::getClassTypeId()))
return static_cast<T*>(t);
else
return 0;
return nullptr;
}
/**
@@ -150,7 +153,7 @@ template<typename T> const T * freecad_dynamic_cast(const Base::BaseClass * t)
if (t && t->isDerivedFrom(T::getClassTypeId()))
return static_cast<const T*>(t);
else
return 0;
return nullptr;
}

View File

@@ -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("<binding object>");
}
@@ -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<Base::Type> 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*/)

View File

@@ -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 <class _Precision>
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 <class _Precision>
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 <class _Precision>
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 <class _Precision>
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 <class _Precision>
inline _Precision BoundBox3<_Precision>::LengthX (void) const
inline _Precision BoundBox3<_Precision>::LengthX () const
{
return MaxX - MinX;
}
template <class _Precision>
inline _Precision BoundBox3<_Precision>::LengthY (void) const
inline _Precision BoundBox3<_Precision>::LengthY () const
{
return MaxY - MinY;
}
template <class _Precision>
inline _Precision BoundBox3<_Precision>::LengthZ (void) const
inline _Precision BoundBox3<_Precision>::LengthZ () const
{
return MaxZ - MinZ;
}

View File

@@ -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<Base::BoundBoxPy*>(object)->getBoundBoxPtr()->IsValid()) {
PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument");
return 0;
return nullptr;
}
retVal = getBoundBoxPtr()->Intersect(*(static_cast<Base::BoundBoxPy*>(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<Base::BoundBoxPy*>(object)->getBoundBoxPtr()->IsValid()) {
PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument");
return 0;
return nullptr;
}
Base::BoundBox3d bbox = getBoundBoxPtr()->Intersected(*static_cast<Base::BoundBoxPy*>(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<Base::BoundBoxPy*>(object)->getBoundBoxPtr()->IsValid()) {
PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument");
return 0;
return nullptr;
}
Base::BoundBox3d bbox = getBoundBoxPtr()->United(*static_cast<Base::BoundBoxPy*>(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<Base::VectorPy*>(object)->getVectorPtr()),
*(static_cast<Base::VectorPy*>(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<Base::BoundBoxPy*>(object)->getBoundBoxPtr()->IsValid()) {
PyErr_SetString (PyExc_FloatingPointError, "Invalid bounding box argument");
return 0;
return nullptr;
}
retVal = getBoundBoxPtr()->IsInBox(*(static_cast<Base::BoundBoxPy*>(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*/)

View File

@@ -24,11 +24,11 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <assert.h>
# include <cassert>
# include <string>
#endif
#include <stdlib.h>
#include <cstdlib>
/// 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

View File

@@ -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);
//@}

View File

@@ -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("<CoordinateSystem object>");
}
@@ -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<CoordinateSystemPy*>(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<VectorPy*>(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<PlacementPy*>(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*/)

View File

@@ -58,7 +58,7 @@ class BaseExport Debugger : public QObject
Q_OBJECT
public:
Debugger(QObject* parent=0);
Debugger(QObject* parent=nullptr);
~Debugger();
void attach();

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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<std::string> 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

View File

@@ -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<const std::string, AbstractProducer*> _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;
}

View File

@@ -39,7 +39,7 @@
# elif defined (FC_OS_WIN32)
# include <direct.h>
# include <io.h>
# include <windows.h>
# include <Windows.h>
# 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<Base::FileInfo> List = getDirectoryContent();
@@ -559,7 +559,7 @@ bool FileInfo::deleteDirectoryRecursive(void) const
return deleteDirectory();
}
std::vector<Base::FileInfo> FileInfo::getDirectoryContent(void) const
std::vector<Base::FileInfo> FileInfo::getDirectoryContent() const
{
std::vector<Base::FileInfo> List;
#if defined (FC_OS_WIN32)
@@ -581,14 +581,14 @@ std::vector<Base::FileInfo> 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 != "..")

View File

@@ -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<Base::FileInfo> getDirectoryContent(void) const;
std::vector<Base::FileInfo> 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:

View File

@@ -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)
{
}

View File

@@ -68,7 +68,7 @@ namespace Base
* <li> mouse events
* <ol>
* <li>mouse move event
* <li>mouse click event\n
* <li>mouse click event
* More info about the click event.
* <li>mouse double click event
* </ol>
@@ -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;
//@}

View File

@@ -26,7 +26,7 @@
#ifndef _PreComp_
# include <iostream>
# include <assert.h>
# include <cassert>
#endif
#include <QAtomicInt>
@@ -64,7 +64,7 @@ void Handled::unref() const
}
}
int Handled::getRefCount(void) const
int Handled::getRefCount() const
{
return static_cast<int>(*_lRefCount);
}

View File

@@ -27,9 +27,6 @@
// Std. configurations
#include <string>
#include <map>
#include <typeinfo>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#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:

View File

@@ -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 :

View File

@@ -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();
}

View File

@@ -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 ||

View File

@@ -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);

View File

@@ -27,7 +27,7 @@
// Std. configurations
#include <assert.h>
#include <cassert>
#include <set>
#include <cstring>
#include <cstdio>
@@ -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.

View File

@@ -25,7 +25,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <assert.h>
# include <cassert>
# include <memory>
# include <xercesc/util/PlatformUtils.hpp>
# include <xercesc/util/XercesVersion.hpp>
@@ -53,7 +53,7 @@
# include <io.h>
# endif
# include <sstream>
# include <stdio.h>
# include <cstdio>
#endif
@@ -354,7 +354,7 @@ Base::Reference<ParameterGrp> 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<Base::Reference<ParameterGrp> > 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<bool> ParameterGrp::GetBools(const char * sFilter) const
while ( pcTemp) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),"1"))
vrValues.push_back(false);
else
@@ -482,7 +482,7 @@ std::vector<std::pair<std::string,bool> > ParameterGrp::GetBoolMap(const char *
while ( pcTemp) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),"1"))
vrValues.emplace_back(Name, false);
else
@@ -528,7 +528,7 @@ std::vector<long> ParameterGrp::GetInts(const char * sFilter) const
while ( pcTemp ) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()) );
}
pcTemp = FindNextElement(pcTemp,"FCInt") ;
@@ -547,7 +547,7 @@ std::vector<std::pair<std::string,long> > ParameterGrp::GetIntMap(const char * s
while ( pcTemp ) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(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<unsigned long> ParameterGrp::GetUnsigneds(const char * sFilter) cons
while ( pcTemp ) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(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<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10) );
}
pcTemp = FindNextElement(pcTemp,"FCUInt") ;
}
@@ -612,7 +612,7 @@ std::vector<std::pair<std::string,unsigned long> > ParameterGrp::GetUnsignedMap(
// check on filter condition
if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) {
vrValues.emplace_back(Name,
( strtoul (StrX(static_cast<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),0,10) ));
( strtoul (StrX(static_cast<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10) ));
}
pcTemp = FindNextElement(pcTemp,"FCUInt");
}
@@ -654,7 +654,7 @@ std::vector<double> ParameterGrp::GetFloats(const char * sFilter) const
while ( pcTemp ) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str()) );
}
pcTemp = FindNextElement(pcTemp,"FCFloat");
@@ -673,7 +673,7 @@ std::vector<std::pair<std::string,double> > ParameterGrp::GetFloatMap(const char
while ( pcTemp ) {
Name = StrX(static_cast<DOMElement*>(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<DOMElement*>(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<std::string> ParameterGrp::GetASCIIs(const char * sFilter) const
while ( pcTemp ) {
Name = StrXUTF8(static_cast<DOMElement*>(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<std::pair<std::string,std::string> > ParameterGrp::GetASCIIMap(const
while ( pcTemp) {
Name = StrXUTF8(static_cast<DOMElement*>(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();

View File

@@ -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 <Python.h>
@@ -101,8 +93,6 @@ class ParameterManager;
*/
class BaseExport ParameterGrp : public Base::Handled,public Base::Subject <const char*>
{
public:
/** @name copy and insertation */
//@{
@@ -123,9 +113,9 @@ public:
/// get a handle to a sub group or create one
Base::Reference<ParameterGrp> GetGroup(const char* Name);
/// get a vector of all sub groups in this group
std::vector<Base::Reference<ParameterGrp> > GetGroups(void);
std::vector<Base::Reference<ParameterGrp> > 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<bool> GetBools(const char * sFilter = NULL) const;
std::vector<bool> GetBools(const char * sFilter = nullptr) const;
/// get a map with all bool values and the keys of this group
std::vector<std::pair<std::string,bool> > GetBoolMap(const char * sFilter = NULL) const;
std::vector<std::pair<std::string,bool> > 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<long> GetInts(const char * sFilter = NULL) const;
std::vector<long> GetInts(const char * sFilter = nullptr) const;
/// get a map with all int values and the keys of this group
std::vector<std::pair<std::string,long> > GetIntMap(const char * sFilter = NULL) const;
std::vector<std::pair<std::string,long> > 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<unsigned long> GetUnsigneds(const char * sFilter = NULL) const;
std::vector<unsigned long> GetUnsigneds(const char * sFilter = nullptr) const;
/// get a map with all uint values and the keys of this group
std::vector<std::pair<std::string,unsigned long> > GetUnsignedMap(const char * sFilter = NULL) const;
std::vector<std::pair<std::string,unsigned long> > 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<double> GetFloats(const char * sFilter = NULL) const;
std::vector<double> GetFloats(const char * sFilter = nullptr) const;
/// get a map with all float values and the keys of this group
std::vector<std::pair<std::string,double> > GetFloatMap(const char * sFilter = NULL) const;
std::vector<std::pair<std::string,double> > 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<std::string> GetASCIIs(const char * sFilter = NULL) const;
std::vector<std::string> GetASCIIs(const char * sFilter = nullptr) const;
/// Same as GetASCIIs() but with key,value map
std::vector<std::pair<std::string,std::string> > GetASCIIMap(const char * sFilter = NULL) const;
std::vector<std::pair<std::string,std::string> > 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 */

View File

@@ -27,6 +27,7 @@
#include "PyObjectBase.h"
#ifndef _PreComp_
#include <cassert>
#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);

View File

@@ -27,8 +27,6 @@
// Std. configurations
#include <assert.h>
#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

View File

@@ -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("<persistence object>");
}
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*)

View File

@@ -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;}

View File

@@ -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<PlacementPy::PointerType>(_pcTwinPointer);
@@ -126,11 +126,11 @@ PyObject* PlacementPy::richCompare(PyObject *v, PyObject *w, int op)
Base::Placement p1 = *static_cast<PlacementPy*>(v)->getPlacementPtr();
Base::Placement p2 = *static_cast<PlacementPy*>(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<VectorPy*>(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<PlacementPy*>(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<VectorPy*>(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<PlacementPy*>(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;
}

View File

@@ -31,7 +31,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <stdlib.h>
# include <cstdlib>
#endif
#include "PyExport.h"

View File

@@ -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<HandledType*>(_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;
}

View File

@@ -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<double>::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"

View File

@@ -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. */

View File

@@ -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<QuantityPy*>(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<QuantityPy*>(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<QuantityPy*>(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<QuantityPy*>(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<QuantityPy*>(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<QuantityPy*>(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<QuantityPy*>(v)->getQuantityPtr();
const Quantity * u2 = static_cast<QuantityPy*>(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<Base::UnitPy*>((*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;
}

View File

@@ -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);
}

View File

@@ -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 (\<name\>) or start-end element (\<name/\>) (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

View File

@@ -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);
}

View File

@@ -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

View File

@@ -70,7 +70,7 @@ namespace Base {
* all instantiated SequencerBase objects.
*/
std::vector<SequencerBase*> 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;
}
}

View File

@@ -385,7 +385,7 @@ inline SequencerBase& Sequencer ()
class BaseExport ProgressIndicatorPy : public Py::PythonExtension<ProgressIndicatorPy>
{
public:
static void init_type(void); // announce properties and methods
static void init_type(); // announce properties and methods
ProgressIndicatorPy();
~ProgressIndicatorPy();

View File

@@ -80,7 +80,7 @@
*
**********************************************************************/
#include <PreCompiled.h>
#include <windows.h>
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
@@ -93,7 +93,7 @@
// If VC7 and later, then use the shipped 'dbghelp.h'-file
#pragma pack(push,8)
#if _MSC_VER >= 1300
#include <dbghelp.h>
#include <DbgHelp.h>
#else
// inline the important dbghelp.h-declarations...
typedef enum {

View File

@@ -26,7 +26,7 @@
#ifdef __GNUC__
# include <stdint.h>
# include <cstdint>
#endif
#include <fstream>

View File

@@ -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;

View File

@@ -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&);

View File

@@ -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;

View File

@@ -27,18 +27,21 @@
// Std. configurations
#include <stdio.h>
#include <cstdio>
#if defined(FC_OS_BSD)
#include <sys/time.h>
#else
#include <sys/timeb.h>
#endif
#include <time.h>
#include <ctime>
#ifdef __GNUC__
# include <stdint.h>
# include <cstdint>
#endif
#include <string>
#include <FCGlobal.h>
#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;
}

View File

@@ -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<double> (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;

View File

@@ -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<Polygon2d> &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<double>( 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;

View File

@@ -23,7 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <assert.h>
# include <cassert>
#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<TypeData*>::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<Type> & List)
return cnt;
}
int Type::getNumTypes(void)
int Type::getNumTypes()
{
return typedata.size();
}

View File

@@ -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<Type>& 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);
}

View File

@@ -23,7 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <sstream>
# include <stdlib.h>
# include <cstdlib>
#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");

View File

@@ -27,7 +27,7 @@
#ifdef _MSC_VER
# include <boost/cstdint.hpp>
#else
# include <stdint.h>
# include <cstdint>
#endif
#include <string>
#include <QString>
@@ -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. */
//@{

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;}

View File

@@ -99,7 +99,7 @@ Vector3<_Precision> Vector3<_Precision>::operator - (const Vector3<_Precision>&
}
template <class _Precision>
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 <class _Precision>
_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 <class _Precision>
_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 <class _Precision>
Vector3<_Precision> & Vector3<_Precision>::Normalize (void)
Vector3<_Precision> & Vector3<_Precision>::Normalize ()
{
_Precision fLen = Length ();
if (fLen != (_Precision)0.0 && fLen != (_Precision)1.0) {

View File

@@ -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].

View File

@@ -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<VectorPy::PointerType>(_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<VectorPy*>(self)->value();
Base::Vector3d b = static_cast<VectorPy*>(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<VectorPy*>(self)->value();
Base::Vector3d b = static_cast<VectorPy*>(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<VectorPy*>(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<VectorPy*>(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<VectorPy*>(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<VectorPy::PointerType>(_pcTwinPointer);
Base::Vector3d v = -(*this_ptr);
@@ -319,11 +319,11 @@ PyObject* VectorPy::richCompare(PyObject *v, PyObject *w, int op)
Vector3d v1 = static_cast<VectorPy*>(v)->value();
Vector3d v2 = static_cast<VectorPy*>(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<VectorPy*>(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<VectorPy::PointerType>(_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<VectorPy::PointerType>(_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<VectorPy*>(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<VectorPy*>(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<VectorPy*>(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<VectorPy*>(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<VectorPy::PointerType>(_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<VectorPy*>(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<VectorPy*>(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<VectorPy*>(pnt);
VectorPy::PointerType this_ptr = reinterpret_cast<VectorPy::PointerType>(_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<VectorPy*>(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<VectorPy*>(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<VectorPy*>(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<VectorPy::PointerType>(_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<VectorPy::PointerType>(_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<VectorPy::PointerType>(_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<VectorPy::PointerType>(_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<VectorPy*>(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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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<std::string>& 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

View File

@@ -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<std::string>& 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

View File

@@ -24,7 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <assert.h>
# include <cassert>
#endif
/// Here the FreeCAD includes sorted by Base,App,Gui......

View File

@@ -28,7 +28,7 @@
#include "PreCompiled.h"
#include "gzstream.h"
#include <assert.h>
#include <cassert>
#include <string>
#include <cstring> // 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

View File

@@ -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

View File

@@ -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);
}
}