Base: Fix header uniformity, whitespace, and doxygen

[skip ci]
This commit is contained in:
luz paz
2020-11-22 12:00:16 -05:00
committed by wwmayer
parent 0a6b7dad41
commit d5f6c096b8
77 changed files with 511 additions and 433 deletions

View File

@@ -34,8 +34,8 @@
using namespace Base;
Type BaseClass::classTypeId = Base::Type::badType();
//**************************************************************************
// Construction/Destruction
@@ -63,26 +63,26 @@ BaseClass::~BaseClass()
void BaseClass::init(void)
{
assert(BaseClass::classTypeId == Type::badType() && "don't init() twice!");
/* Make sure superclass gets initialized before subclass. */
/* Make sure superclass gets initialized before subclass. */
/*assert(strcmp(#_parentclass_), "inherited"));*/
/*Type parentType(Type::fromName(#_parentclass_));*/
/*Type parentType(Type::fromName(#_parentclass_));*/
/*assert(parentType != Type::badType() && "you forgot init() on parentclass!");*/
/* Set up entry in the type system. */
BaseClass::classTypeId =
Type::createType(Type::badType(),
"Base::BaseClass",
BaseClass::create);
/* Set up entry in the type system. */
BaseClass::classTypeId =
Type::createType(Type::badType(),
"Base::BaseClass",
BaseClass::create);
}
Type BaseClass::getClassTypeId(void)
Type BaseClass::getClassTypeId(void)
{
return BaseClass::classTypeId;
return BaseClass::classTypeId;
}
Type BaseClass::getTypeId(void) const
Type BaseClass::getTypeId(void) const
{
return BaseClass::classTypeId;
return BaseClass::classTypeId;
}
@@ -92,7 +92,7 @@ void BaseClass::initSubclass(Base::Type &toInit,const char* ClassName, const cha
// don't init twice!
assert(toInit == Base::Type::badType());
// get the parent class
Base::Type parentType(Base::Type::fromName(ParentName));
Base::Type parentType(Base::Type::fromName(ParentName));
// forgot init parent!
assert(parentType != Base::Type::badType() );
@@ -101,12 +101,12 @@ void BaseClass::initSubclass(Base::Type &toInit,const char* ClassName, const cha
}
/**
* This method returns the Python wrapper for a C++ object. It's in the responsibility of
* This method returns the Python wrapper for a C++ object. It's in the responsibility of
* the programmer to do the correct reference counting. Basically there are two ways how
* to implement that: Either always return a new Python object then reference counting is
* not a matter or return always the same Python object then the reference counter must be
* incremented by one. However, it's absolutely forbidden to return always the same Python
* object without incrementing the reference counter.
* object without incrementing the reference counter.
*
* The default implementation returns 'None'.
*/

View File

@@ -41,7 +41,7 @@ std::string BaseClassPy::representation(void) const
PyObject* BaseClassPy::isDerivedFrom(PyObject *args)
{
char *name;
if (!PyArg_ParseTuple(args, "s", &name)) // convert args: Python->C
if (!PyArg_ParseTuple(args, "s", &name)) // convert args: Python->C
return NULL; // NULL triggers exception
Base::Type type = Base::Type::fromName(name);
@@ -51,9 +51,9 @@ PyObject* BaseClassPy::isDerivedFrom(PyObject *args)
PyObject* BaseClassPy::getAllDerivedFrom(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
std::vector<Base::Type> ary;
Base::Type::getAllDerivedFrom(getBaseClassPtr()->getTypeId(), ary);
Py::List res;
@@ -87,7 +87,7 @@ PyObject *BaseClassPy::getCustomAttributes(const char* /*attr*/) const
int BaseClassPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}

View File

@@ -67,13 +67,13 @@ public:
/** Builds box from an array of points. */
inline BoundBox3 (const Vector3<_Precision> *pclVect, unsigned long ulCt);
/** Defines a bounding box around the center \a rcCnt with the
/** Defines a bounding box around the center \a rcCnt with the
* distances \a fDistance in each coordinate.
*/
BoundBox3 (const Vector3<_Precision> &rcCnt, _Precision fDistance);
~BoundBox3 ();
/// Assignment operator
/// Assignment operator
inline BoundBox3<_Precision>& operator = (const BoundBox3<_Precision> &rcBound);
/** Methods for intersection, cuttíng and union of bounding boxes */
@@ -127,8 +127,8 @@ public:
* Returns the corner point \a usPoint.
* 0: front,bottom,left 1: front,bottom,right
* 2: front,top,right 3: front,top,left
* 4: back,bottom,left 5: back,bottom,right
* 6: back,top,right 7: back,top,left
* 4: back,bottom,left 5: back,bottom,right
* 6: back,top,right 7: back,top,left
*/
inline Vector3<_Precision> CalcPoint (unsigned short usPoint) const;
/** Returns the plane of the given side. */
@@ -137,7 +137,7 @@ public:
* 0. edge P0-P1 1. edge P1-P2 2. edge P2-P3
* 3. edge P3-P0 4. edge P4-P5 5. edge P5-P6
* 6. edge P6-P7 7. edge P7-P4 8. edge P0-P4
* 9. edge P1-P5 10. edge P2-P6 11. edge P3-P7
* 9. edge P1-P5 10. edge P2-P6 11. edge P3-P7
*/
bool CalcEdge (unsigned short usEdge, Vector3<_Precision>& rcP0, Vector3<_Precision>& rcP1) const;
/** Intersection point of an inner search ray with the bounding box, built of
@@ -145,7 +145,7 @@ public:
* bounding box.
*/
bool IntersectionPoint (const Vector3<_Precision> &rcVct, const Vector3<_Precision> &rcVctDir, Vector3<_Precision>& cVctRes, _Precision epsilon) const;
/** Checks for intersection with line incl. search tolerance. */
/** Checks for intersection with line incl. search tolerance. */
bool IsCutLine ( const Vector3<_Precision>& rcBase, const Vector3<_Precision>& rcDir, _Precision fTolerance = 0.0f) const;
/** Checks if this plane specified by (point,normal) cuts this box.
* @note It's up to the client programmer to make sure that this bounding box is valid.
@@ -154,7 +154,7 @@ public:
/** Computes the intersection points of line and bounding box. */
bool IntersectWithLine (const Vector3<_Precision>& rcBase, const Vector3<_Precision>& rcDir, Vector3<_Precision>& rcP0, Vector3<_Precision>& rcP1) const;
/** Computes the intersection point of line and a plane of the bounding box. */
bool IntersectPlaneWithLine (unsigned short usSide, const Vector3<_Precision>& rcBase, const Vector3<_Precision>& rcDir,
bool IntersectPlaneWithLine (unsigned short usSide, const Vector3<_Precision>& rcBase, const Vector3<_Precision>& rcDir,
Vector3<_Precision>& rcP0) const;
/** Returns the side of the bounding box the ray exits. */
typename BoundBox3<_Precision>::SIDE GetSideFromRay (const Vector3<_Precision> &rclPt, const Vector3<_Precision> &rclDir) const;
@@ -162,7 +162,7 @@ public:
typename BoundBox3<_Precision>::SIDE GetSideFromRay (const Vector3<_Precision> &rclPt, const Vector3<_Precision> &rclDir, Vector3<_Precision>& rcInt) const;
/**
* Searches for the closest point of the bounding box.
* Searches for the closest point of the bounding box.
*/
Vector3<_Precision> ClosestPoint (const Vector3<_Precision> &rclPt) const;
/** Projects the box onto a plane and returns a 2D box. */
@@ -181,9 +181,9 @@ public:
void SetVoid (void);
/** Enlarges the box with factor \a fLen. */
inline void Enlarge (_Precision fLen);
inline void Enlarge (_Precision fLen);
/** Shrinks the box with factor \a fLen. */
inline void Shrink (_Precision fLen);
inline void Shrink (_Precision fLen);
/** Calculates expansion in x-direction. */
inline _Precision LengthX (void) const;
@@ -254,11 +254,11 @@ inline BoundBox3<_Precision>::BoundBox3 (const Vector3<_Precision> *pclVect, uns
template <class _Precision>
inline BoundBox3<_Precision>::BoundBox3 (const Vector3<_Precision> &rcVector, _Precision fDistance)
{
MinX = rcVector.x - fDistance;
MinX = rcVector.x - fDistance;
MaxX = rcVector.x + fDistance;
MinY = rcVector.y - fDistance;
MinY = rcVector.y - fDistance;
MaxY = rcVector.y + fDistance;
MinZ = rcVector.z - fDistance;
MinZ = rcVector.z - fDistance;
MaxZ = rcVector.z + fDistance;
}
@@ -608,7 +608,7 @@ inline bool BoundBox3<_Precision>::IntersectionPoint (const Vector3<_Precision>
// test sides
for (i = 0; (i < 6) && (!rc); i++) {
rc = IntersectPlaneWithLine(i, rcVct, rcVctDir, cVctRes);
if (!cCmpBound.IsInBox(cVctRes))
if (!cCmpBound.IsInBox(cVctRes))
rc = false;
if (rc == true) {
// does intersection point lie in desired direction
@@ -738,7 +738,7 @@ inline bool BoundBox3<_Precision>::IntersectWithLine (const Vector3<_Precision>
}
}
return false;
return false;
}
template <class _Precision>
@@ -836,7 +836,7 @@ inline Vector3<_Precision> BoundBox3<_Precision>::ClosestPoint (const Vector3<_P
_Precision fDist = (clTemp - rclPt).Length();
if (fDist < fMinDist) {
fMinDist = fDist;
clRet = clTemp;
clRet = clTemp;
}
}

View File

@@ -52,7 +52,7 @@ std::string BoundBoxPy::representation(void) const
PyObject *BoundBoxPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of BoundBoxPy and the Twin object
// create a new instance of BoundBoxPy and the Twin object
return new BoundBoxPy(new BoundBox3d);
}
@@ -585,7 +585,7 @@ PyObject *BoundBoxPy::getCustomAttributes(const char* /*attr*/) const
int BoundBoxPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}

View File

@@ -69,8 +69,8 @@ Builder3D::~Builder3D()
/**
* Starts the definition of point set with the given point size and color.
* If possible don't make too many startPoints() and endPoints() calls.
* Try to put all points in one set.
* If possible don't make too many startPoints() and endPoints() calls.
* Try to put all points in one set.
* @see endPoints()
* @param pointSize the point size in pixel that are displayed.
* @param color_r red part of the point color (0.0 - 1.0).
@@ -146,7 +146,7 @@ void Builder3D::addSinglePoint(const Base::Vector3f &vec, short pointSize, float
/**
* Add a Text with a given position to the 3D set. The origin is the
* Add a Text with a given position to the 3D set. The origin is the
* lower leftmost corner.
* @param pos_x,pos_y,pos_z origin of the text
* @param text the text to display.
@@ -159,8 +159,8 @@ void Builder3D::addText(float pos_x, float pos_y , float pos_z,const char * text
// addSinglePoint() not between startXXX() and endXXX() allowed
assert( bStartEndOpen == false );
result << "Separator { "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
result << "Separator { "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "Transform { translation " << pos_x << " "<< pos_y << " "<< pos_z << "} "
<< "Text2 { string \" " << text << "\" " << "} "
<< "} ";
@@ -193,12 +193,12 @@ void Builder3D::addSingleLine(Vector3f pt1, Vector3f pt2, short lineSize, float
//strcat(lp, buf);
result << "Separator { "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "DrawStyle { lineWidth " << lineSize << " linePattern " << lp << " } "
<< "Coordinate3 { "
<< "point [ "
<< pt1.x << " " << pt1.y << " " << pt1.z << ","
<< pt2.x << " " << pt2.y << " " << pt2.z
<< pt2.x << " " << pt2.y << " " << pt2.z
<< "] "
<< "} "
<< "LineSet { } "
@@ -224,12 +224,12 @@ void Builder3D::addSingleArrow(Vector3f pt1, Vector3f pt2, short lineSize, float
float a = Vector3f(0.0f, 1.0f, 0.0f).GetAngle(dir);
result << "Separator { "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "DrawStyle { lineWidth " << lineSize << "} "
<< "Coordinate3 { "
<< "point [ "
<< pt1.x << " " << pt1.y << " " << pt1.z << ","
<< pt2s.x << " " << pt2s.y << " " << pt2s.z
<< pt2s.x << " " << pt2s.y << " " << pt2s.z
<< "] "
<< "} "
<< "LineSet { } "
@@ -254,7 +254,7 @@ void Builder3D::addSingleTriangle(Vector3f pt0, Vector3f pt1, Vector3f pt2, bool
}
result << "Separator { "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} "
<< "DrawStyle { lineWidth " << lineSize << "} "
<< "Coordinate3 { "
<< "point [ "
@@ -293,15 +293,15 @@ void Builder3D::addTransformation(const Base::Vector3f& translation, const Base:
/**
* Save the resulting inventor 3D representation to the Console().Log() facility.
* In DEBUG mode the Gui (if running) will trigger on that and show the representation in
* the active Viewer/Document. It shows only one representation on time. If you need to
* In DEBUG mode the Gui (if running) will trigger on that and show the representation in
* the active Viewer/Document. It shows only one representation on time. If you need to
* show more then one representation use saveToFile() instead.
* @see saveToFile()
*/
void Builder3D::saveToLog(void)
{
result << "} ";
// Note: The string can become very long, so that ConsoleSingelton::Log() will internally
// Note: The string can become very long, so that ConsoleSingelton::Log() will internally
// truncate the string which causes Inventor to fail to interpret the truncated string.
// So, we send the string directly to the observer that handles the Inventor stuff.
//Console().Log("Vdbg: %s \n",result.str().c_str());
@@ -323,7 +323,7 @@ void Builder3D::saveToFile(const char* FileName)
{
result << "} ";
std::ofstream file(FileName);
if(!file)
if(!file)
throw FileException("Builder3D::saveToFile(): Can not open file...");
file << "#Inventor V2.1 ascii " << std::endl;
@@ -456,8 +456,8 @@ void InventorBuilder::addPolygonOffset(float factor, float units, const char* st
/**
* Starts the definition of point set.
* If possible don't make too many beginPoints() and endPoints() calls.
* Try to put all points in one set.
* If possible don't make too many beginPoints() and endPoints() calls.
* Try to put all points in one set.
* @see startPoints()
* @see endPoints()
*/
@@ -528,7 +528,7 @@ void InventorBuilder::addLineSet()
/**
* Add a Text with a given position to the 3D set. The origin is the
* Add a Text with a given position to the 3D set. The origin is the
* lower leftmost corner.
* @param pos_x,pos_y,pos_z origin of the text
* @param text the text to display.
@@ -651,9 +651,9 @@ void InventorBuilder::addLineSet(const std::vector<Vector3f>& points, short line
result << "2";
for (size_t i=1; i<ct; i++)
{
result << ",";
result << ",";
if (i%16==0)
result << std::endl << " ";
result << std::endl << " ";
result << "2";
}
}*/
@@ -763,7 +763,7 @@ void InventorBuilder::addSingleTriangle(const Vector3f& pt0, const Vector3f& pt1
}
void InventorBuilder::addSinglePlane(const Vector3f& base, const Vector3f& eX, const Vector3f& eY,
float length, float width, bool filled, short lineSize,
float length, float width, bool filled, short lineSize,
float color_r,float color_g,float color_b)
{
Vector3f pt0 = base;
@@ -806,7 +806,7 @@ void InventorBuilder::addNurbsSurface(const std::vector<Base::Vector3f>& control
result << " Separator { " << std::endl
<< " Coordinate3 { " << std::endl
<< " point [ ";
for (std::vector<Base::Vector3f>::const_iterator it =
for (std::vector<Base::Vector3f>::const_iterator it =
controlPoints.begin(); it != controlPoints.end(); ++it) {
if (it != controlPoints.begin())
result << "," << std::endl << " ";
@@ -914,10 +914,10 @@ void InventorBuilder::addTransformation(const Matrix4D& transform)
void InventorBuilder::addTransformation(const Vector3f& translation, const Vector3f& rotationaxis, float fAngle)
{
result << Base::blanks(indent) << "Transform {" << std::endl;
result << Base::blanks(indent) << " translation "
result << Base::blanks(indent) << " translation "
<< translation.x << " " << translation.y << " " << translation.z << std::endl;
result << Base::blanks(indent) << " rotation "
<< rotationaxis.x << " " << rotationaxis.y << " " << rotationaxis.z
result << Base::blanks(indent) << " rotation "
<< rotationaxis.x << " " << rotationaxis.y << " " << rotationaxis.z
<< " " << fAngle << std::endl;
result << Base::blanks(indent) << "}" << std::endl;
}

View File

@@ -39,10 +39,10 @@ class Matrix4D;
* when you program or debug an algorithm. Builder3D was made for this specific purpose.
* This class allows you to easily build up a 3D representation of some mathematical and
* algorithm internals. You can save this representation to a file and view it in an
* Inventor viewer, or send it to the log. In the case of using the log and a debug
* Inventor viewer, or send it to the log. In the case of using the log and a debug
* FreeCAD the representation will be loaded into the active viewer.
* \par
* The workflow goes as follows: Create the a Builder3D object and call the methods
* The workflow goes as follows: Create the a Builder3D object and call the methods
* to insert the graphical elements. After that call either saveToLog() or saveToFile().
* \par
* Usage:
@@ -74,7 +74,7 @@ public:
void addPoint(float x, float y, float z);
/// add a vector to a point set
void addPoint(const Vector3f &vec);
/// ends the points set operation
/// ends the points set operation
void endPoints(void);
/// 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);
@@ -306,7 +306,7 @@ public:
/** @name Bounding Box handling */
//@{
void addBoundingBox(const Vector3f& pt1, const Vector3f& pt2, short lineWidth=2,
void addBoundingBox(const Vector3f& pt1, const Vector3f& pt2, short lineWidth=2,
float color_r=1.0,float color_g=1.0,float color_b=1.0);
//@}

View File

@@ -728,7 +728,7 @@ PyObject *ConsoleSingleton::sPySetStatus(PyObject * /*self*/, PyObject *args)
Py_INCREF(Py_None);
return Py_None;
}
}
else {
Py_Error(Base::BaseExceptionFreeCADError,"Unknown Console Type");
}

View File

@@ -137,7 +137,7 @@
*
* // print file and line number, default 0, if set to 2 then print python
* // source from current call frame.
* FC_LOG_INSTANCE.print_src = 1;
* FC_LOG_INSTANCE.print_src = 1;
*
* FC_LOG_INSTANCE.print_tag = false; // do not print tag, default true
* FC_LOG_INSTANCE.add_eol = false; // do not add eol
@@ -486,7 +486,7 @@ namespace Base {
:bErr(true),bMsg(true),bLog(true),bWrn(true){};
virtual ~ILogger() = 0;
/** Used to send a Log message at the given level.
/** Used to send a Log message at the given level.
*/
virtual void SendLog(const std::string& msg, LogStyle level) = 0;
@@ -527,13 +527,13 @@ namespace Base {
/// Prints a log Message
virtual void Log ( const char * pMsg, ... );
// observer processing
// observer processing
void NotifyMessage(const char *sMsg);
void NotifyWarning(const char *sMsg);
void NotifyError (const char *sMsg);
void NotifyLog (const char *sMsg);
/// Delivers a time/date string
/// Delivers a time/date string
const char* Time(void);
/// Attaches an Observer to FCConsole
void AttachObserver(ILogger *pcObserver);

View File

@@ -40,7 +40,7 @@ std::string CoordinateSystemPy::representation(void) const
PyObject *CoordinateSystemPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of CoordinateSystemPy and the Twin object
// create a new instance of CoordinateSystemPy and the Twin object
return new CoordinateSystemPy(new CoordinateSystem);
}
@@ -181,5 +181,5 @@ PyObject *CoordinateSystemPy::getCustomAttributes(const char* /*attr*/) const
int CoordinateSystemPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}

View File

@@ -10,12 +10,12 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *

View File

@@ -111,11 +111,11 @@ public:
inline std::string getFunction() const;
inline bool getTranslatable() const;
inline bool getReported() const { return _isReported; }
/// setter methods for including debug information
/// intended to use via macro for autofilling of debugging information
inline void setDebugInformation(const std::string & file, const int line, const std::string & function);
inline void setTranslatable(bool translatable);
inline void setReported(bool reported) { _isReported = reported; }
@@ -261,7 +261,7 @@ protected:
FileInfo file;
// necessary for what() legacy behaviour as it returns a buffer that
// can not be of a temporary object to be destroyed at end of what()
std::string _sErrMsgAndFileName;
std::string _sErrMsgAndFileName;
};
/**
@@ -664,10 +664,10 @@ public:
/* The RestoreError can be used to try to do a best recovery effort when an error during restoring
* occurs. The best recovery effort may be to ignore the element altogether or to insert a placeholder
* depending on where the actual element being restored is used.
*
* For example, if it is part of an array (e.g. PropertyList) and the order in the array is relevant, it
*
* For example, if it is part of an array (e.g. PropertyList) and the order in the array is relevant, it
* is better to have a placeholder than to fail to restore the whole array.
*/
*/
class BaseExport RestoreError : public Exception
{
public:

View File

@@ -46,7 +46,7 @@ void ExceptionFactory::Destruct (void)
void ExceptionFactory::raiseException (PyObject * pydict) const
{
std::string classname;
Py::Dict edict(pydict);
if (edict.hasKey("sclassname")) {
classname = static_cast<std::string>(Py::String(edict.getItem("sclassname")));

View File

@@ -53,12 +53,12 @@ class BaseExport ExceptionFactory : public Factory
public:
static ExceptionFactory& Instance(void);
static void Destruct (void);
void raiseException(PyObject * pydict) const;
private:
static ExceptionFactory* _pcSingleton;
ExceptionFactory(){}
~ExceptionFactory(){}
};
@@ -73,9 +73,9 @@ public:
{
ExceptionFactory::Instance().AddProducer(typeid(CLASS).name(), this);
}
virtual ~ExceptionProducer (){}
void raiseException(PyObject * pydict) const
{
CLASS c;

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -10,12 +10,12 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -10,12 +10,12 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
@@ -46,9 +46,9 @@ public:
};
/** Base class of all factories
* This class has the purpose to produce at runtime instances
* This class has the purpose to produce at runtime instances
* of classes not known at compile time. It holds a map of so called
* producers which are able to produce an instance of a special class.
* Producer can be registered at runtime through e.g. application modules
@@ -69,7 +69,7 @@ protected:
std::map<const std::string, AbstractProducer*> _mpcProducers;
/// construction
Factory (void){}
/// destruction
/// destruction
virtual ~Factory ();
};
@@ -100,7 +100,7 @@ inline ScriptFactorySingleton& ScriptFactory(void)
// --------------------------------------------------------------------
/** Script Factory
* This class produce Scripts.
* This class produce Scripts.
* @see Factory
*/
class BaseExport ScriptProducer: public AbstractProducer
@@ -116,7 +116,7 @@ public:
/// Produce an instance
virtual void* Produce (void) const
{
{
return (void*)mScript;
}

View File

@@ -150,14 +150,14 @@ std::string FileInfo::getTempFileName(const char* FileName, const char* Path)
wchar_t buf[MAX_PATH + 2];
// Path where the file is located
std::wstring path;
std::wstring path;
if (Path)
path = ConvertToWideString(std::string(Path));
else
path = ConvertToWideString(getTempPath());
// File name in the path
std::wstring file;
// File name in the path
std::wstring file;
if (FileName)
file = ConvertToWideString(std::string(FileName));
else
@@ -178,7 +178,7 @@ std::string FileInfo::getTempFileName(const char* FileName, const char* Path)
else
buf = getTempPath();
// File name in the path
// File name in the path
if (FileName) {
buf += "/";
buf += FileName;
@@ -251,10 +251,10 @@ std::string FileInfo::fileNamePure () const
{
std::string temp = fileName();
std::string::size_type pos = temp.find_last_of('.');
if (pos != std::string::npos)
return temp.substr(0,pos);
else
else
return temp;
}

View File

@@ -10,12 +10,12 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
@@ -104,7 +104,7 @@ public:
bool isFile () const;
/// Checks if it is a directory (not a file)
bool isDir () const;
/// The size of the file
/// The size of the file
unsigned int size () const;
/// Returns the time when the file was last modified.
TimeInfo lastModified() const;
@@ -118,7 +118,7 @@ public:
bool createDirectory( void ) const;
/// Get a list of the directory content
std::vector<Base::FileInfo> getDirectoryContent(void) const;
/// Delete an empty directory
/// Delete an empty directory
bool deleteDirectory(void) const;
/// Delete a directory and all its content.
bool deleteDirectoryRecursive(void) const;

View File

@@ -41,13 +41,13 @@ namespace Base
* Base::Console().Log("Stage: %d",i);
* \endcode
* \par
* nother blablablablablablablablablabl:
* another blablablablablablablablablabl:
* Text before the list
* - list item 1
* - sub item 1
* - sub sub item 1
* - sub sub item 2
* .
* .
* The dot above ends the sub sub item list.
* More text for the first sub item
* .
@@ -70,7 +70,7 @@ namespace Base
* <li>mouse double click event
* </ol>
* <li> keyboard events
* <ol>
* <ol>
* <li>key down event
* <li>key up event
* </ol>
@@ -89,16 +89,16 @@ public:
int testMe(int a,const char *s);
/**
/**
* An enum.
* More detailed enum description.
*/
enum TEnum {
TVal1, /**< enum value TVal1. */
TVal2, /**< enum value TVal2. */
TVal3 /**< enum value TVal3. */
}
enum TEnum {
TVal1, /**< enum value TVal1. */
TVal2, /**< enum value TVal2. */
TVal3 /**< enum value TVal3. */
}
*enumPtr, /**< enum pointer. Details. */
enumVar; /**< enum variable. Details. */
@@ -121,12 +121,12 @@ public:
//@}
/**
/**
* a public variable.
* Details.
*/
int publicVar;
/**
* a function variable.
* Details.

View File

@@ -47,4 +47,4 @@ private:
};
}
#endif // BASE_FUTUREWATCHER_H
#endif // BASE_FUTUREWATCHER_H

View File

@@ -54,7 +54,7 @@ using namespace std;
// ---------------------------------------------------------------------------
// StdInputStream: Constructors and Destructor
// ---------------------------------------------------------------------------
StdInputStream::StdInputStream( std::istream& Stream, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const manager )
StdInputStream::StdInputStream( std::istream& Stream, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const manager )
: stream(Stream), fMemoryManager(manager)
{
state.flags |= QTextCodec::IgnoreHeader;
@@ -82,7 +82,7 @@ unsigned int StdInputStream::readBytes( XMLByte* const toFill, const unsigned i
// Read up to the maximum bytes requested. We return the number
// actually read.
//
stream.read((char *)toFill,maxToRead);
XMLSize_t len = stream.gcount();
@@ -116,7 +116,7 @@ XMLSize_t StdInputStream::readBytes( XMLByte* const toFill, const XMLSize_t max
// Read up to the maximum bytes requested. We return the number
// actually read.
//
stream.read((char *)toFill,maxToRead);
XMLSize_t len = stream.gcount();

View File

@@ -65,7 +65,7 @@ private :
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
StdInputStream(const StdInputStream&);
StdInputStream& operator=(const StdInputStream&);
StdInputStream& operator=(const StdInputStream&);
// -----------------------------------------------------------------------
// Private data members

View File

@@ -121,7 +121,7 @@ void PyException::raiseException() {
std::string exceptionname;
if (_exceptionType == Base::BaseExceptionFreeCADAbort)
edict.setItem("sclassname",
edict.setItem("sclassname",
Py::String(typeid(Base::AbortException).name()));
if (_isReported)
edict.setItem("breported", Py::True());
@@ -159,7 +159,7 @@ void PyException::setPyException() const
SystemExitException::SystemExitException()
{
// Set exception message and code based upon the pthon sys.exit() code and/or message
// Set exception message and code based upon the python sys.exit() code and/or message
// based upon the following sys.exit() call semantics.
//
// Invocation | _exitCode | _sErrMsg

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -10,12 +10,12 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
@@ -102,7 +102,7 @@ public:
~PyException() throw();
void raiseException();
/// this method determines if the original exception
/// can be reconstructed or not, if yes throws the reconstructed version
/// if not, throws a generic PyException.
@@ -178,7 +178,7 @@ private:
/**
* If a thread holds the global interpreter lock (GIL) but runs a long operation
* in C where it doesn't need to hold the GIL it can release it temporarily. Or
* if the thread has to run code in the main thread where Python code may be
* if the thread has to run code in the main thread where Python code may be
* executed it must release the GIL to avoid a deadlock. In either case the thread
* must hold the GIL when instantiating an object of PyGILStateRelease.
* As PyGILStateLocker it's best to create an instance of PyGILStateRelease on the
@@ -204,7 +204,7 @@ private:
/** The Interpreter class
* This class manage the python interpreter and hold a lot
* This class manage the python interpreter and hold a lot
* helper functions for handling python stuff
*/
class BaseExport InterpreterSingleton
@@ -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=0, void *cresult=0,
const char *argfmt="()", ... );
//@}
@@ -252,11 +252,11 @@ public:
/** @name Cleanup
*/
//@{
/** Register a cleanup function to be called by finalize(). The cleanup function will be called with no
* arguments and should return no value. At most 32 cleanup functions can be registered. When the registration
* is successful 0 is returned; on failure -1 is returned. The cleanup function registered last is called
* 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.
/** Register a cleanup function to be called by finalize(). The cleanup function will be called with no
* arguments and should return no value. At most 32 cleanup functions can be registered. When the registration
* is successful 0 is returned; on failure -1 is returned. The cleanup function registered last is called
* 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));
/** This calls the registered cleanup functions. @see cleanup() for more details. */
@@ -322,14 +322,14 @@ private:
/** Access to the InterpreterSingleton object
* This method is used to gain access to the one and only instance of
* This method is used to gain access to the one and only instance of
* the InterpreterSingleton class.
*/
*/
inline InterpreterSingleton &Interpreter(void)
{
return InterpreterSingleton::Instance();
}
} //namespace Base
} //namespace Base
#endif // BASE_INTERPRETER_H

View File

@@ -39,7 +39,7 @@ Matrix4D::Matrix4D (void)
setToUnity();
}
Matrix4D::Matrix4D (float a11, float a12, float a13, float a14,
Matrix4D::Matrix4D (float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34,
float a41, float a42, float a43, float a44 )
@@ -62,7 +62,7 @@ Matrix4D::Matrix4D (float a11, float a12, float a13, float a14,
dMtrx4D[3][3] = static_cast<double>(a44);
}
Matrix4D::Matrix4D (double a11, double a12, double a13, double a14,
Matrix4D::Matrix4D (double a11, double a12, double a13, double a14,
double a21, double a22, double a23, double a24,
double a31, double a32, double a33, double a34,
double a41, double a42, double a43, double a44 )
@@ -269,7 +269,7 @@ void Matrix4D::rotLine(const Vector3f& rclBase, const Vector3f& rclDir, float fA
/**
* If this matrix describes a rotation around an arbitrary axis with a translation (in axis direction)
* then the base point of the axis, its direction, the rotation angle and the translation part get calculated.
* In this case the return value is set to true, if this matrix doesn't describe a rotation false is returned.
* In this case the return value is set to true, if this matrix doesn't describe a rotation false is returned.
*
* The translation vector can be calculated with \a fTranslation * \a rclDir, whereas the length of \a rclDir
* is normalized to 1.
@@ -451,7 +451,7 @@ void Matrix4D::inverse (void)
for (iz = 0 ;iz < 3; iz++)
for (is = 0 ;is < 3; is++)
clInvRotMat.dMtrx4D[iz][is] = dMtrx4D[is][iz];
/**** inv(M) = inv(Mtrl * Mrot) = inv(Mrot) * inv(Mtrl) ****/
(*this) = clInvRotMat * clInvTrlMat;
}
@@ -572,11 +572,11 @@ void Matrix4D::inverseOrthogonal(void)
void Matrix4D::inverseGauss (void)
{
double matrix [16];
double matrix [16];
double inversematrix [16] = { 1 ,0 ,0 ,0 ,
0 ,1 ,0 ,0 ,
0 ,0 ,1 ,0 ,
0 ,0 ,0 ,1 };
0 ,0 ,0 ,1 };
getGLMatrix(matrix);
// Matrix_invert(matrix, inversematrix);
@@ -657,7 +657,7 @@ std::string Matrix4D::toString(void) const
for (int j = 0; j < 4; j++)
str << dMtrx4D[i][j] << " ";
}
return str.str();
}
@@ -671,7 +671,7 @@ void Matrix4D::fromString(const std::string &str)
{
for (int j = 0; j < 4; j++)
input >> dMtrx4D[i][j];
}
}
}
// Analyse the a transformation Matrix and describe the transformation
@@ -693,7 +693,7 @@ std::string Matrix4D::analyse(void) const
{
text = "Projection";
}
else //translation and affine
else //translation and affine
{
if (dMtrx4D[0][1] == 0.0 && dMtrx4D[0][2] == 0.0 &&
dMtrx4D[1][0] == 0.0 && dMtrx4D[1][2] == 0.0 &&

View File

@@ -49,12 +49,12 @@ public:
Matrix4D(void);
/// Construction
Matrix4D (float a11, float a12, float a13, float a14,
Matrix4D (float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34,
float a41, float a42, float a43, float a44 );
/// Construction
Matrix4D (double a11, double a12, double a13, double a14,
Matrix4D (double a11, double a12, double a13, double a14,
double a21, double a22, double a23, double a24,
double a31, double a32, double a33, double a34,
double a41, double a42, double a43, double a44 );
@@ -80,7 +80,7 @@ public:
inline Matrix4D& operator = (const Matrix4D& rclMtrx);
/// Matrix multiplication
inline Matrix4D operator * (const Matrix4D& rclMtrx) const;
/// Multiplication matrix with vector
/// Multiplication matrix with vector
inline Vector3f operator * (const Vector3f& rclVct) const;
inline Vector3d operator * (const Vector3d& rclVct) const;
inline void multVec(const Vector3d & src, Vector3d & dst) const;
@@ -172,7 +172,7 @@ public:
std::string toString(void) const;
/// read the 16 double of the matrix from a string
void fromString (const std::string &str);
private:
double dMtrx4D[4][4];
};
@@ -240,12 +240,12 @@ inline Matrix4D& Matrix4D::operator *= (const Matrix4D& rclMtrx)
for (is = 0; is < 4; is++) {
clMat.dMtrx4D[iz][is] = 0;
for (ie = 0; ie < 4; ie++)
clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] *
clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] *
rclMtrx.dMtrx4D[ie][is];
}
(*this) = clMat;
return *this;
}
@@ -258,7 +258,7 @@ inline Matrix4D Matrix4D::operator * (const Matrix4D& rclMtrx) const
for (is = 0; is < 4; is++) {
clMat.dMtrx4D[iz][is] = 0;
for (ie = 0; ie < 4; ie++)
clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] *
clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] *
rclMtrx.dMtrx4D[ie][is];
}
@@ -274,7 +274,7 @@ inline Matrix4D& Matrix4D::operator= (const Matrix4D& rclMtrx)
dMtrx4D[iz][is] = rclMtrx.dMtrx4D[iz][is];
}
}
return *this;
}
@@ -370,6 +370,6 @@ inline const double* Matrix4D::operator[] (unsigned short usNdx) const
} // namespace Base
#endif // BASE_MATRIX_H
#endif // BASE_MATRIX_H

View File

@@ -54,7 +54,7 @@ std::string MatrixPy::representation(void) const
PyObject *MatrixPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of MatrixPy and the Twin object
// create a new instance of MatrixPy and the Twin object
return new MatrixPy(new Matrix4D);
}
@@ -239,13 +239,13 @@ PyObject* MatrixPy::move(PyObject * args)
vec.y = y;
vec.z = z;
}
else if (PyArg_ParseTuple(args, "O!:three floats or a vector is needed",
else if (PyArg_ParseTuple(args, "O!:three floats or a vector is needed",
&PyTuple_Type, &pcVecObj)) {
vec = getVectorFromTuple<double>(pcVecObj);
// clears the error from the first PyArg_ParseTuple()6
PyErr_Clear();
}
else if (PyArg_ParseTuple(args, "O!:three floats or a vector is needed",
else if (PyArg_ParseTuple(args, "O!:three floats or a vector is needed",
&(Base::VectorPy::Type), &pcVecObj)) {
Base::VectorPy *pcObject = static_cast<Base::VectorPy*>(pcVecObj);
Base::Vector3d* val = pcObject->getVectorPtr();
@@ -275,7 +275,7 @@ PyObject* MatrixPy::scale(PyObject * args)
vec.y = y;
vec.z = z;
}
else if (PyArg_ParseTuple(args, "O!:three floats or a vector is needed",
else if (PyArg_ParseTuple(args, "O!:three floats or a vector is needed",
&PyTuple_Type, &pcVecObj)) {
vec = getVectorFromTuple<double>(pcVecObj);
// clears the error from the first PyArg_ParseTuple()6
@@ -829,7 +829,7 @@ PyObject *MatrixPy::getCustomAttributes(const char* /*attr*/) const
int MatrixPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}
PyObject * MatrixPy::number_divide_handler (PyObject* /*self*/, PyObject* /*other*/)

View File

@@ -10,16 +10,15 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
* Juergen Riegel 2006 *
***************************************************************************/
/** \defgroup MemDebug Memory debugging
@@ -60,12 +59,12 @@ using namespace Base;
/** Memory debugging class
* This class is an interface to the Windows CRT debugging
* facility. If the define MemDebugOn in the src/FCConfig.h is
* set the class gets instantiated globally and tracks all memory allocations on the heap.
* facility. If the define MemDebugOn in the src/FCConfig.h is
* set the class gets instantiated globally and tracks all memory allocations on the heap.
* The result gets written in the MemLog.txt in the active directory.
* \par
* NOTE: you must not instantiate this class!
*
* NOTE: you must not instantiate this class!
*
*
* \author Juergen Riegel
*/
@@ -88,7 +87,7 @@ protected:
//@}
};
// the one and only MemDebug instance.
// the one and only MemDebug instance.
#ifdef MemDebugOn
MemDebug cSingelton;
#endif
@@ -116,12 +115,12 @@ MemDebug::MemDebug()
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR );
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR );
// Set the debug heap to report memory leaks when the process terminates,
// and to keep freed blocks in the linked list.
SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF | _CRTDBG_DELAY_FREE_MEM_DF );
// Open a log file for the hook functions to use
// Open a log file for the hook functions to use
if ( logFile != NULL )
throw "Base::MemDebug::MemDebug():38: Don't call the constructor by your self!";
#if (_MSC_VER >= 1400)
@@ -212,8 +211,8 @@ int __cdecl MemDebug::sAllocHook(
if( nBlockUse !=4 )
return(7);
fprintf( logFile,
fprintf( logFile,
"%s (#%7d) %12Iu byte (%s) in %s line %d",
operation[nAllocType],lRequest, nSize, blockType[nBlockUse],szFileName, nLine);
if ( pvData != NULL )

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -10,12 +10,12 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
@@ -44,7 +44,7 @@ template <class MessageType> class Subject;
/** Observer class
* Implementation of the well known Observer Design Pattern.
* The observed object, which inherit FCSubject, will call all
* its observers in case of changes. A observer class has to
* its observers in case of changes. A observer class has to
* Attach itself to the observed object.
* @see FCSubject
*/
@@ -85,7 +85,7 @@ public:
/**
* This method can be reimplemented from the concrete Observer
* and returns the name of the observer. Needed to use the Get
* and returns the name of the observer. Needed to use the Get
* Method of the Subject.
*/
virtual const char *Name(void){return 0L;}
@@ -94,7 +94,7 @@ public:
/** Subject class
* Implementation of the well known Observer Design Pattern.
* The observed object, which inherit FCSubject, will call all
* its observers in case of changes. A observer class has to
* its observers in case of changes. A observer class has to
* Attach itself to the observed object.
* @see FCObserver
*/
@@ -105,8 +105,8 @@ public:
typedef Observer<_MessageType> ObserverType;
typedef _MessageType MessageType;
typedef Subject<_MessageType> SubjectType;
typedef Subject<_MessageType> SubjectType;
/**
* A constructor.
* No special function so far.
@@ -127,7 +127,7 @@ public:
}
/** Attach an Observer
* Attach an Observer to the list of Observers which get
* Attach an Observer to the list of Observers which get
* called when Notify is called.
* @param ToObserv A pointer to a concrete Observer
* @see Notify
@@ -146,7 +146,7 @@ public:
}
/** Detach an Observer
* Detach an Observer from the list of Observers which get
* Detach an Observer from the list of Observers which get
* called when Notify is called.
* @param ToObserv A pointer to a concrete Observer
* @see Notify
@@ -166,7 +166,7 @@ public:
/** Notify all Observers
* Send a message to all Observers attached to this subject.
* The Message depends on the implementation of a concrete
* The Message depends on the implementation of a concrete
* Oberserver and Subject.
* @see Notify
*/
@@ -205,7 +205,7 @@ public:
return 0L;
}
/** Clears the list of all registered observers.
/** Clears the list of all registered observers.
* @note Using this function in your code may be an indication of design problems.
*/
void ClearObserver()

View File

@@ -21,7 +21,7 @@
* *
***************************************************************************/
/**
/**
* \file Parameter.h
* \brief The classes defined here are used to interface with the XML-based
* FreeCAD config files: user.cfg and system.cfg files. It can parse, get,

View File

@@ -341,7 +341,7 @@ Py::Object ParameterGrpPy::setInt(const Py::Tuple& args)
throw Py::Exception();
_cParamGrp->SetInt(pstr,Int);
return Py::None();
return Py::None();
}
Py::Object ParameterGrpPy::getInt(const Py::Tuple& args)
@@ -420,7 +420,7 @@ Py::Object ParameterGrpPy::setFloat(const Py::Tuple& args)
throw Py::Exception();
_cParamGrp->SetFloat(pstr,Float);
return Py::None();
return Py::None();
}
Py::Object ParameterGrpPy::getFloat(const Py::Tuple& args)
@@ -456,7 +456,7 @@ Py::Object ParameterGrpPy::setString(const Py::Tuple& args)
throw Py::Exception();
_cParamGrp->SetASCII(pstr,str);
return Py::None();
return Py::None();
}
Py::Object ParameterGrpPy::getString(const Py::Tuple& args)

View File

@@ -101,7 +101,7 @@ std::string Persistence::encodeAttribute(const std::string& str)
void Persistence::dumpToStream(std::ostream& stream, int compression)
{
//we need to close the zipstream to get a good result, the only way to do this is to delete the ZipWriter.
//we need to close the zipstream to get a good result, the only way to do this is to delete the ZipWriter.
//Hence the scope...
{
//create the writer

View File

@@ -149,6 +149,6 @@ PyObject *PersistencePy::getCustomAttributes(const char*) const
int PersistencePy::setCustomAttributes(const char*,PyObject*)
{
return 0;
return 0;
}

View File

@@ -89,6 +89,6 @@ protected:
} // namespace Base
#endif // BASE_PLACEMENT_H
#endif // BASE_PLACEMENT_H

View File

@@ -54,7 +54,7 @@ std::string PlacementPy::representation(void) const
PyObject *PlacementPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of PlacementPy and the Twin object
// create a new instance of PlacementPy and the Twin object
return new PlacementPy(new Placement);
}
@@ -340,7 +340,7 @@ PyObject *PlacementPy::getCustomAttributes(const char* attr) const
int PlacementPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}
PyObject* PlacementPy::number_multiply_handler(PyObject *self, PyObject *other)

View File

@@ -55,7 +55,7 @@
#include <Rpc.h>
#endif
// STL
// STL
#include <string>
#include <list>
#include <map>

View File

@@ -1,12 +1,5 @@
/** \file PyExport.cpp
* \brief implementation of the python export facility
* \author $Author: wmayer $
* \version $Revision: 2.2 $
* \date $Date: 2006/01/24 14:26:42 $
*/
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -17,17 +10,23 @@
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
***************************************************************************/
/** \file PyExport.cpp
* \brief implementation of the python export facility
* \author $Author: wmayer $
* \version $Revision: 2.2 $
* \date $Date: 2006/01/24 14:26:42 $
*/
#include "PreCompiled.h"
@@ -38,4 +37,4 @@
#include "PyExport.h"
#include "PyObjectBase.h"
using namespace Base;
using namespace Base;

View File

@@ -53,7 +53,7 @@ PyObjectBase::PyObjectBase(void* p,PyTypeObject *T)
}
/// destructor
PyObjectBase::~PyObjectBase()
PyObjectBase::~PyObjectBase()
{
PyGILStateLocker lock;
#ifdef FC_LOGPYOBJECTS
@@ -66,8 +66,8 @@ PyObjectBase::~PyObjectBase()
* PyObjectBase Type -- Every class, even the abstract one should have a Type
------------------------------*/
/** \brief
* To prevent subclasses of PyTypeObject to be subclassed in Python we should remove
/** \brief
* To prevent subclasses of PyTypeObject to be subclassed in Python we should remove
* the Py_TPFLAGS_BASETYPE flag. For example, the classes App::VectorPy and App::MatrixPy
* have removed this flag and its Python proxies App.Vector and App.Matrix cannot be subclassed.
* In case we want to allow to derive from subclasses of PyTypeObject in Python
@@ -272,8 +272,8 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
PyObject *PyObjectBase::_getattr(const char *attr)
{
if (streq(attr, "__class__")) {
// Note: We must return the type object here,
// so that our own types feel as really Python objects
// Note: We must return the type object here,
// so that our own types feel as really Python objects
Py_INCREF(Py_TYPE(this));
return (PyObject *)(Py_TYPE(this));
}

View File

@@ -60,8 +60,8 @@
/** Python static class macro for definition
* sets up a static function entry in a class inheriting
* from PyObjectBase. Its a pure convenience macro. You can also do
* sets up a static function entry in a class inheriting
* from PyObjectBase. It's a pure convenience macro. You can also do
* it by hand if you want. It looks like that:
* \code
* static PyObject* X (PyObject *self,PyObject *args,PyObject *kwd);
@@ -80,7 +80,7 @@
* \code
* PyObject* CLASS::SFUNC (PyObject *self,PyObject *args,PyObject *kwd)
* \endcode
* see PYFUNCDEF_S for details
* see PYFUNCDEF_S for details
* @param CLASS is the class in which the macro take place.
* @param SFUNC is the object method get implemented
* @see PYFUNCDEF_S
@@ -89,7 +89,7 @@
#define PYFUNCIMP_S(CLASS,SFUNC) PyObject* CLASS::SFUNC (PyObject *self,PyObject *args,PyObject *kwd)
/** Macro for initialization function of Python modules.
/** Macro for initialization function of Python modules.
*/
#if PY_MAJOR_VERSION >= 3
# define PyMOD_INIT_FUNC(name) PyMODINIT_FUNC PyInit_##name(void)
@@ -128,7 +128,7 @@ inline int streq(const char *A, const char *B) // define "streq"
inline void Assert(int expr, char *msg) // C++ assert
{
if (!expr)
if (!expr)
{
fprintf(stderr, "%s\n", msg);
exit(-1);
@@ -174,7 +174,7 @@ namespace Base
/** The PyObjectBase class, exports the class as a python type
* PyObjectBase is the base class for all C++ classes which
* need to get exported into the python namespace. This class is
* need to get exported into the python namespace. This class is
* very important because nearly all important classes in FreeCAD
* are visible in python for macro recording and automation purpose.
* The class App::Document is a good expample for an exported class.
@@ -191,9 +191,9 @@ namespace Base
* @see Py_Return
* @see Py_Error
* @see Py_Try
* @see Py_Assert
* @see Py_Assert
*/
class BaseExport PyObjectBase : public PyObject
class BaseExport PyObjectBase : public PyObject
{
/** Py_Header struct from python.h.
* Every PyObjectBase object is also a python object. So you can use
@@ -217,7 +217,7 @@ protected:
_pcTwinPointer = ptr;
}
public:
public:
/** Constructor
* Sets the Type of the object (for inheritance) and decrease the
* the reference count of the PyObject.
@@ -228,7 +228,7 @@ public:
{ delete ((PyObjectBase *) P); }
/// incref method wrapper (see python extending manual)
PyObjectBase* IncRef(void) {Py_INCREF(this);return this;}
/// decref method wrapper (see python extending manual)
/// decref method wrapper (see python extending manual)
PyObjectBase* DecRef(void) {Py_DECREF(this);return this;}
/** GetAttribute implementation
@@ -237,7 +237,7 @@ public:
* this method.
* You have to call the method of the base class.
* Note: if you reimplement _gettattr() in a inheriting class you
* need to call the method of the base class! Otherwise even the
* need to call the method of the base class! Otherwise even the
* methods of the object will disappear!
*/
virtual PyObject *_getattr(const char *attr);
@@ -251,7 +251,7 @@ public:
* You have to call the method of the base class.
*/
virtual int _setattr(const char *attro, PyObject *value); // _setattr method
/// static wrapper for pythons _setattro(). // This should be the entry in Type.
/// static wrapper for pythons _setattro(). // This should be the entry in Type.
static int __setattro(PyObject *PyObj, PyObject *attro, PyObject *value);
/** _repr method
@@ -292,7 +292,7 @@ public:
return ((PyObjectBase*) self)->PyInit(args, kwd);
}
void setInvalid() {
void setInvalid() {
// first bit is not set, i.e. invalid
StatusBits.reset(Valid);
clearAttributes();
@@ -353,7 +353,7 @@ private:
/** Python dynamic class macro for definition
* sets up a static/dynamic function entry in a class inheriting
* sets up a static/dynamic function entry in a class inheriting
* from PyObjectBase. Its a pure convenience macro. You can also do
* it by hand if you want. It looks like that:
* \code
@@ -362,7 +362,7 @@ private:
* {return ((FCPyParametrGrp*)self)->PyGetGrp(args);};
* \endcode
* first the method is defined which have the functionality then the
* static wrapper is used to provide a callback for python. The call
* static wrapper is used to provide a callback for python. The call
* is simply mapped to the method.
* @param CLASS is the class in which the macro take place.
* @param DFUNC is the object method get defined and called
@@ -397,7 +397,7 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
* PyMethodDef DocTypeStdPy::Methods[] = {
* {"AddFeature", (PyCFunction) sAddFeature, Py_NEWARGS},
* {"RemoveFeature", (PyCFunction) sRemoveFeature, Py_NEWARGS},
* {NULL, NULL}
* {NULL, NULL}
* };
* \endcode
* instead of:
@@ -405,10 +405,10 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
* PyMethodDef DocTypeStdPy::Methods[] = {
* PYMETHODEDEF(AddFeature)
* PYMETHODEDEF(RemoveFeature)
* {NULL, NULL}
* {NULL, NULL}
* };
* \endcode
* see PYFUNCDEF_D for details
* see PYFUNCDEF_D for details
* @param FUNC is the object method get defined
* @see PYFUNCDEF_D
* @see PyObjectBase
@@ -429,9 +429,9 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort;
* PYFUNCIMP_D(DocTypeStdPy,AddFeature)
* {
* char *pstr;
* if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
* return NULL; // NULL triggers exception
*
* if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
* return NULL; // NULL triggers exception
*
* try {
* Feature *pcFtr = _pcDocTypeStd->AddFeature(pstr);
* }catch(...) \
@@ -445,20 +445,20 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort;
* PYFUNCIMP_D(DocTypeStdPy,AddFeature)
* {
* char *pstr;
* if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
* return NULL; // NULL triggers exception
*
* if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
* return NULL; // NULL triggers exception
*
* PY_TRY {
* Feature *pcFtr = _pcDocTypeStd->AddFeature(pstr);
* }PY_CATCH;
* }
* \endcode
* this catch maps all of the FreeCAD standard exception to a clear output for the
* this catch maps all of the FreeCAD standard exception to a clear output for the
* Python exception.
* @see PYMETHODEDEF
* @see PyObjectBase
*/
#define PY_TRY try
#define PY_TRY try
#define __PY_CATCH(R) \
catch(Base::AbortException &e) \
@@ -487,8 +487,8 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort;
_Py_Error(R,Base::BaseExceptionFreeCADError,e); \
} \
#ifndef DONT_CATCH_CXX_EXCEPTIONS
/// see docu of PY_TRY
#ifndef DONT_CATCH_CXX_EXCEPTIONS
/// see docu of PY_TRY
# define _PY_CATCH(R) \
__PY_CATCH(R) \
catch(...) \
@@ -497,13 +497,13 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort;
}
#else
/// see docu of PY_TRY
/// see docu of PY_TRY
# define _PY_CATCH(R) __PY_CATCH(R)
#endif // DONT_CATCH_CXX_EXCEPTIONS
#define PY_CATCH _PY_CATCH(return(NULL))
/** Python helper class
/** Python helper class
* This class encapsulate the Decoding of UTF8 to a python object.
* Including exception handling.
*/

View File

@@ -386,7 +386,7 @@ Quantity Quantity::Gon (360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); // g
// === Parser & Scanner stuff ===============================================
// include the Scanner and the Parser for the Quantitys
// include the Scanner and the Parser for the 'Quantity's
Quantity QuantResult;
@@ -396,20 +396,20 @@ 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
if (*c==dez_delim && dez_delim !='.')
temp[i++] = '.';
else
temp[i++] = *c;
temp[i++] = *c;
// check buffer overflow
if (i>39) return 0.0;
}
temp[i] = '\0';
ret_val = atof( temp );
ret_val = atof( temp );
return ret_val;
}

View File

@@ -55,7 +55,7 @@ struct BaseExport QuantityFormat {
int precision;
int denominator;
// Default denominator of minimum fractional inch. Only used in certain
// Default denominator of minimum fractional inch. Only used in certain
// schemas.
static int defaultDenominator; // i.e 8 for 1/8"

View File

@@ -1,3 +1,25 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#line 1 "QuantityLexer.c"
#line 3 "QuantityLexer.c"
@@ -34,7 +56,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
@@ -51,7 +73,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
@@ -162,10 +184,10 @@ extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
#define YY_LINENO_REWIND_TO(ptr)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@@ -659,7 +681,7 @@ char *yytext;
*/
#include <unistd.h>
#endif
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
@@ -708,7 +730,7 @@ extern int yywrap ( void );
#endif
#ifndef YY_NO_UNPUT
#endif
#ifndef yytext_ptr
@@ -835,7 +857,7 @@ YY_DECL
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
if ( !(yy_init) )
{
(yy_init) = 1;
@@ -1058,7 +1080,7 @@ yylval = Quantity::Gram; return UNIT; // gram
case 28:
YY_RULE_SETUP
#line 74 "QuantityParser.l"
yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
YY_BREAK
case 29:
YY_RULE_SETUP
@@ -1078,7 +1100,7 @@ yylval = Quantity::Minute; return UNIT; // minute
case 32:
YY_RULE_SETUP
#line 79 "QuantityParser.l"
yylval = Quantity::Hour; return UNIT; // hour
yylval = Quantity::Hour; return UNIT; // hour
YY_BREAK
case 33:
YY_RULE_SETUP
@@ -1198,7 +1220,7 @@ yylval = Quantity::Pound; return UNIT; // pound
case 56:
YY_RULE_SETUP
#line 110 "QuantityParser.l"
yylval = Quantity::Pound; return UNIT; // pound
yylval = Quantity::Pound; return UNIT; // pound
YY_BREAK
case 57:
YY_RULE_SETUP
@@ -1513,12 +1535,12 @@ yylval = Quantity::MegaElectronVolt; return UNIT;
case 119:
YY_RULE_SETUP
#line 190 "QuantityParser.l"
yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
YY_BREAK
case 120:
YY_RULE_SETUP
#line 191 "QuantityParser.l"
yylval = Quantity::KiloCalorie; return UNIT;
yylval = Quantity::KiloCalorie; return UNIT;
YY_BREAK
case 121:
YY_RULE_SETUP
@@ -1553,12 +1575,12 @@ yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
case 127:
YY_RULE_SETUP
#line 199 "QuantityParser.l"
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
YY_BREAK
case 128:
YY_RULE_SETUP
#line 200 "QuantityParser.l"
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
YY_BREAK
case 129:
YY_RULE_SETUP
@@ -1970,7 +1992,7 @@ static int yy_get_next_buffer (void)
{
yy_state_type yy_current_state;
char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
@@ -2034,7 +2056,7 @@ static int yy_get_next_buffer (void)
{
int c;
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
@@ -2101,12 +2123,12 @@ static int yy_get_next_buffer (void)
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
*
*
* @note This function does not reset the start condition to @c INITIAL .
*/
void yyrestart (FILE * input_file )
{
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
@@ -2119,11 +2141,11 @@ static int yy_get_next_buffer (void)
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
*
*
*/
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
{
/* TODO. We should be able to replace this entire function body
* with
* yypop_buffer_state();
@@ -2163,13 +2185,13 @@ static void yy_load_buffer_state (void)
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
*
*
* @return the allocated buffer state.
*/
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -2192,11 +2214,11 @@ static void yy_load_buffer_state (void)
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
*
*
*/
void yy_delete_buffer (YY_BUFFER_STATE b )
{
if ( ! b )
return;
@@ -2217,7 +2239,7 @@ static void yy_load_buffer_state (void)
{
int oerrno = errno;
yy_flush_buffer( b );
b->yy_input_file = file;
@@ -2233,13 +2255,13 @@ static void yy_load_buffer_state (void)
}
b->yy_is_interactive = 0;
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
*
*
*/
void yy_flush_buffer (YY_BUFFER_STATE b )
{
@@ -2268,7 +2290,7 @@ static void yy_load_buffer_state (void)
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
*
*
*/
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
{
@@ -2298,7 +2320,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
*
*
*/
void yypop_buffer_state (void)
{
@@ -2322,7 +2344,7 @@ void yypop_buffer_state (void)
static void yyensure_buffer_stack (void)
{
yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
@@ -2365,13 +2387,13 @@ static void yyensure_buffer_stack (void)
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
*
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -2400,14 +2422,14 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
*
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* yy_scan_bytes() instead.
*/
YY_BUFFER_STATE yy_scan_string (const char * yystr )
{
return yy_scan_bytes( yystr, (int) strlen(yystr) );
}
@@ -2415,7 +2437,7 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr )
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
@@ -2424,7 +2446,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = (yy_size_t) (_yybytes_len + 2);
buf = (char *) yyalloc( n );
@@ -2478,16 +2500,16 @@ static void yynoreturn yy_fatal_error (const char* msg )
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
*
*
*/
int yyget_lineno (void)
{
return yylineno;
}
/** Get the input stream.
*
*
*/
FILE *yyget_in (void)
{
@@ -2495,7 +2517,7 @@ FILE *yyget_in (void)
}
/** Get the output stream.
*
*
*/
FILE *yyget_out (void)
{
@@ -2503,7 +2525,7 @@ FILE *yyget_out (void)
}
/** Get the length of the current token.
*
*
*/
int yyget_leng (void)
{
@@ -2511,7 +2533,7 @@ int yyget_leng (void)
}
/** Get the current token.
*
*
*/
char *yyget_text (void)
@@ -2521,18 +2543,18 @@ char *yyget_text (void)
/** Set the current line number.
* @param _line_number line number
*
*
*/
void yyset_lineno (int _line_number )
{
yylineno = _line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param _in_str A readable stream.
*
*
* @see yy_switch_to_buffer
*/
void yyset_in (FILE * _in_str )
@@ -2586,7 +2608,7 @@ static int yy_init_globals (void)
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy (void)
{
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
yy_delete_buffer( YY_CURRENT_BUFFER );
@@ -2612,7 +2634,7 @@ int yylex_destroy (void)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, const char * s2, int n )
{
int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
@@ -2637,7 +2659,7 @@ void *yyalloc (yy_size_t size )
void *yyrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter

View File

@@ -1,6 +1,25 @@
%{
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
/* Lexer for the FreeCAD Units language */
/* (c) 2013 Juergen Riegel LGPL */
/* use this file to generate the file 'QuantityLexer.c' using the program flex
* the command for this operation is:
@@ -20,11 +39,11 @@
/* the manual says "somewhat more optimized" */
%option batch
%option never-interactive
%option never-interactive
/* no support for include files is planned */
%option noyywrap nounput
%option noyywrap nounput
DIGIT [0-9]
ID [a-z][a-z0-9]*
@@ -71,12 +90,12 @@ CGRP '\,'[0-9][0-9][0-9]
"\xC2\xB5g" yylval = Quantity::MicroGram; return UNIT; // micro gram
"mg" yylval = Quantity::MilliGram; return UNIT; // milli gram
"g" yylval = Quantity::Gram; return UNIT; // gram
"kg" yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
"kg" yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
"t" yylval = Quantity::Ton; return UNIT; // Metric Tonne
"s" yylval = Quantity::Second; return UNIT; // second (internal standard time)
"min" yylval = Quantity::Minute; return UNIT; // minute
"h" yylval = Quantity::Hour; return UNIT; // hour
"h" yylval = Quantity::Hour; return UNIT; // hour
"A" yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current)
"mA" yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere
@@ -107,7 +126,7 @@ CGRP '\,'[0-9][0-9][0-9]
"cft" yylval = Quantity::CubicFoot; return UNIT; // cubic foot
"lb" yylval = Quantity::Pound; return UNIT; // pound
"lbm" yylval = Quantity::Pound; return UNIT; // pound
"lbm" yylval = Quantity::Pound; return UNIT; // pound
"oz" yylval = Quantity::Ounce; return UNIT; // ounce
"st" yylval = Quantity::Stone; return UNIT; // Stone
"cwt" yylval = Quantity::Hundredweights; return UNIT; // hundredweights
@@ -187,8 +206,8 @@ CGRP '\,'[0-9][0-9][0-9]
"eV" yylval = Quantity::ElectronVolt; return UNIT; // 1 eV = 1.602176634e-19 J
"keV" yylval = Quantity::KiloElectronVolt; return UNIT;
"MeV" yylval = Quantity::MegaElectronVolt; return UNIT;
"cal" yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
"kcal" yylval = Quantity::KiloCalorie; return UNIT;
"cal" yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
"kcal" yylval = Quantity::KiloCalorie; return UNIT;
"\xC2\xB0" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
"deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
@@ -196,8 +215,8 @@ CGRP '\,'[0-9][0-9][0-9]
"gon" yylval = Quantity::Gon; return UNIT; // gon
"M" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
"\xE2\x80\xB2" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
"AS" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"\xE2\x80\xB3" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"AS" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"\xE2\x80\xB3" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
"1" yylval = Quantity(1.0); return ONE;
{DIGIT}+"."?{DIGIT}*{EXPO}? { yylval = Quantity(num_change(yytext,'.',','));return NUM; }
@@ -208,7 +227,7 @@ CGRP '\,'[0-9][0-9][0-9]
"pi" {yylval = Quantity(M_PI) ; return NUM;} // constant pi
"e" {yylval = Quantity(M_E) ; return NUM;} // constant e
"acos" return ACOS;
"asin" return ASIN;
"atan" return ATAN;

View File

@@ -1,6 +1,24 @@
/* Parser for the FreeCAD Units language */
/* (c) 2013 Juergen Riegel LGPL */
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
//* Parser for the FreeCAD Units language */
/* Represents the many different ways we can access our data */
%{

View File

@@ -39,7 +39,7 @@ std::string QuantityPy::representation(void) const
#if 0
//ret.precision(getQuantityPtr()->getFormat().precision);
//ret.setf(std::ios::fixed, std::ios::floatfield);
ret << getQuantityPtr()->getValue() << " ";
ret << getQuantityPtr()->getValue() << " ";
ret << getQuantityPtr()->getUnit().getString().toUtf8().constData();
#else
double val= getQuantityPtr()->getValue();
@@ -76,7 +76,7 @@ PyObject* QuantityPy::toStr(PyObject* args)
PyObject *QuantityPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of QuantityPy and the Twin object
// create a new instance of QuantityPy and the Twin object
return new QuantityPy(new Quantity);
}
@@ -331,7 +331,7 @@ static Quantity &pyToQuantity(Quantity &q, PyObject *pyobj) {
else if (PyLong_Check(pyobj))
q = Quantity(PyLong_AsLong(pyobj));
else {
PyErr_Format(PyExc_TypeError,"Cannot convert %s to Quantity",Py_TYPE(pyobj)->tp_name);
PyErr_Format(PyExc_TypeError,"Cannot convert %s to Quantity",Py_TYPE(pyobj)->tp_name);
throw Py::Exception();
}
return q;
@@ -471,7 +471,7 @@ PyObject * QuantityPy::number_power_handler (PyObject *self, PyObject *other, Py
Base::Quantity *a = static_cast<QuantityPy*>(self) ->getQuantityPtr();
Base::Quantity *b = static_cast<QuantityPy*>(other)->getQuantityPtr();
Base::Quantity q(a->pow(*b)); // to prevent memory leak in case of exception
return new QuantityPy(new Quantity(q));
}
else if (PyFloat_Check(other)) {
@@ -695,7 +695,7 @@ PyObject *QuantityPy::getCustomAttributes(const char* attr) const
int QuantityPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}
PyObject * QuantityPy::number_invert_handler (PyObject* /*self*/)

View File

@@ -264,8 +264,8 @@ int Base::XMLReader::level() const {
void Base::XMLReader::readEndElement(const char* ElementName, int level)
{
// if we are already at the end of the current element
if (ReadType == EndElement
&& ElementName
if (ReadType == EndElement
&& ElementName
&& LocalName == ElementName
&& (level<0 || level==Level))
{
@@ -281,8 +281,8 @@ void Base::XMLReader::readEndElement(const char* ElementName, int level)
ok = read(); if (!ok) break;
if (ReadType == EndDocument)
break;
} while (ReadType != EndElement
|| (ElementName
} while (ReadType != EndElement
|| (ElementName
&& (LocalName != ElementName
|| (level>=0 && level!=Level))));
}

View File

@@ -124,7 +124,7 @@ void Rotation::evaluateVector()
if ((this->quat[3] > -1.0) && (this->quat[3] < 1.0)) {
double rfAngle = acos(this->quat[3]) * 2.0;
double scale = sin(rfAngle / 2.0);
// Get a normalized vector
// Get a normalized vector
double l = this->_axis.Length();
if (l < Base::Vector3d::epsilon()) l = 1;
this->_axis.x = this->quat[0] * l / scale;
@@ -274,7 +274,7 @@ void Rotation::setValue(const Vector3d & rotateFrom, const Vector3d & rotateTo)
Vector3d u(rotateFrom); u.Normalize();
Vector3d v(rotateTo); v.Normalize();
// The vector from x to is the rotation axis because it's the normal of the plane defined by (0,u,v)
// The vector from x to is the rotation axis because it's the normal of the plane defined by (0,u,v)
const double dot = u * v;
Vector3d w = u % v;
const double wlen = w.Length();

View File

@@ -55,7 +55,7 @@ std::string RotationPy::representation(void) const
PyObject *RotationPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of RotationPy and the Twin object
// create a new instance of RotationPy and the Twin object
return new RotationPy(new Rotation);
}

View File

@@ -67,10 +67,10 @@ class SequencerLauncher;
* at a time. But note, that only the first instance has an effect. Any further
* sequencer instance doesn't influence the total number of iteration steps. This
* is simply because it's impossible to get the exact number of iteration steps
* for nested instances and thus we have either too few steps estimated then the
* for nested instances and thus we have either too few steps estimated then the
* sequencer may indicate 100% but the algorithm still running or we have too many
* steps estimated so that the an algorithm may stop long before the sequencer
* reaches 100%.
* reaches 100%.
*
* \code
* try {

View File

@@ -48,13 +48,13 @@ class BaseExport Stream
{
public:
enum ByteOrder { BigEndian, LittleEndian };
ByteOrder byteOrder() const;
void setByteOrder(ByteOrder);
protected:
Stream();
virtual ~Stream();
virtual ~Stream();
bool _swap;
};
@@ -171,9 +171,9 @@ protected:
virtual std::streamsize showmanyc();
virtual pos_type seekoff(std::streambuf::off_type off,
std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::openmode which =
std::ios::in | std::ios::out);
virtual pos_type seekpos(std::streambuf::pos_type pos,
virtual pos_type seekpos(std::streambuf::pos_type pos,
std::ios_base::openmode which =
std::ios::in | std::ios::out);
@@ -292,9 +292,9 @@ protected:
virtual std::streamsize showmanyc();
virtual pos_type seekoff(std::streambuf::off_type off,
std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::openmode which =
std::ios::in | std::ios::out);
virtual pos_type seekpos(std::streambuf::pos_type pos,
virtual pos_type seekpos(std::streambuf::pos_type pos,
std::ios_base::openmode which =
std::ios::in | std::ios::out);
@@ -340,7 +340,7 @@ public:
class ifstream : public std::ifstream
{
public:
ifstream(const FileInfo& fi, ios_base::openmode mode =
ifstream(const FileInfo& fi, ios_base::openmode mode =
std::ios::in)
#ifdef _MSC_VER
: std::ifstream(fi.toStdWString().c_str(), mode)

View File

@@ -24,8 +24,8 @@
#ifndef BASE_SWAP_H
#define BASE_SWAP_H
#define LOW_ENDIAN (unsigned short) 0x4949
#define HIGH_ENDIAN (unsigned short) 0x4D4D
#define LOW_ENDIAN (unsigned short) 0x4949
#define HIGH_ENDIAN (unsigned short) 0x4D4D
namespace Base {
@@ -35,7 +35,7 @@ namespace Base {
* dependent on the architecture.
*/
/** Returns machine type (low endian, high endian ) */
/** Returns machine type (low endian, high endian) */
unsigned short SwapOrder (void);
void SwapVar (char&);
@@ -61,4 +61,4 @@ void SwapEndian(T& v)
} // namespace Base
#endif // BASE_SWAP_H
#endif // BASE_SWAP_H

View File

@@ -63,10 +63,10 @@ public:
void setCurrent(void);
void setTime_t (uint64_t seconds);
uint64_t getSeconds(void) const;
unsigned short getMiliseconds(void) const;
uint64_t getSeconds(void) const;
unsigned short getMiliseconds(void) const;
//void operator = (const TimeInfo &time);
//void operator = (const TimeInfo &time);
bool operator == (const TimeInfo &time) const;
bool operator != (const TimeInfo &time) const;
@@ -98,7 +98,7 @@ protected:
inline unsigned short TimeInfo::getMiliseconds(void) const
{
return timebuffer.millitm;
}
}
inline bool
TimeInfo::operator != (const TimeInfo &time) const
@@ -107,7 +107,7 @@ TimeInfo::operator != (const TimeInfo &time) const
}
//inline void
//TimeInfo::operator = (const TimeInfo &time)
//TimeInfo::operator = (const TimeInfo &time)
//{
//timebuffer = time.timebuffer;
//}

View File

@@ -248,7 +248,7 @@ template<typename T>
class BitsetLocker
{
public:
BitsetLocker(T& flags, std::size_t flag, bool value = true)
BitsetLocker(T& flags, std::size_t flag, bool value = true)
: flags(flags), flag(flag)
{ oldValue = flags.test(flag); flags.set(flag,value); }
~BitsetLocker()

View File

@@ -36,9 +36,9 @@ using namespace Base;
double Vector2d::GetAngle (const Vector2d &rclVect) const
{
double fDivid, fNum;
fDivid = Length() * rclVect.Length();
if ((fDivid < -1e-10) || (fDivid > 1e-10))
{
fNum = (*this * rclVect) / fDivid;
@@ -60,7 +60,7 @@ void Vector2d::ProjectToLine (const Vector2d &rclPt, const Vector2d &rclLine)
double t1 = (rclPt * rclLine) / l;
Vector2d clNormal = rclLine;
clNormal.Normalize();
clNormal.Scale(t1);
clNormal.Scale(t1);
*this = clNormal;
}
@@ -72,33 +72,33 @@ bool BoundBox2d::Intersect(const Line2d &rclLine) const
Line2d clThisLine;
Vector2d clVct;
// first line
// first line
clThisLine.clV1.x = MinX;
clThisLine.clV1.y = MinY;
clThisLine.clV2.x = MaxX;
clThisLine.clV2.y = MinY;
if (clThisLine.IntersectAndContain (rclLine, clVct))
if (clThisLine.IntersectAndContain (rclLine, clVct))
return true;
// second line
clThisLine.clV1 = clThisLine.clV2;
clThisLine.clV2.x = MaxX;
clThisLine.clV2.y = MaxY;
if (clThisLine.IntersectAndContain (rclLine, clVct))
if (clThisLine.IntersectAndContain (rclLine, clVct))
return true;
// third line
clThisLine.clV1 = clThisLine.clV2;
clThisLine.clV2.x = MinX;
clThisLine.clV2.y = MaxY;
if (clThisLine.IntersectAndContain (rclLine, clVct))
if (clThisLine.IntersectAndContain (rclLine, clVct))
return true;
// fourth line
clThisLine.clV1 = clThisLine.clV2;
clThisLine.clV2.x = MinX;
clThisLine.clV2.y = MinY;
if (clThisLine.IntersectAndContain (rclLine, clVct))
if (clThisLine.IntersectAndContain (rclLine, clVct))
return true;
return false;
@@ -131,7 +131,7 @@ bool BoundBox2d::Intersect(const Polygon2d &rclPoly) const
{
unsigned long i;
Line2d clLine;
// points contained in boundbox
for (i = 0; i < rclPoly.GetCtVectors(); i++)
if (Contains (rclPoly[i]))
@@ -143,7 +143,7 @@ bool BoundBox2d::Intersect(const Polygon2d &rclPoly) const
rclPoly.Contains (Vector2d (MaxX, MaxY)) ||
rclPoly.Contains (Vector2d (MinX, MaxY)))
return true; /***** RETURN INTERSECTION *********/
// test intersections of bound-lines
if (rclPoly.GetCtVectors() < 3) return false;
for (i = 0; i < rclPoly.GetCtVectors(); i++)
@@ -181,7 +181,7 @@ BoundBox2d Line2d::CalcBoundBox (void) const
bool Line2d::Intersect (const Line2d& rclLine, Vector2d &rclV) const
{
double m1, m2, b1, b2;
// calc coefficients
if (fabs (clV2.x - clV1.x) > 1e-10)
m1 = (clV2.y - clV1.y) / (clV2.x - clV1.x);
@@ -193,7 +193,7 @@ bool Line2d::Intersect (const Line2d& rclLine, Vector2d &rclV) const
m2 = FLOAT_MAX;
if (m1 == m2) /****** RETURN ERR (parallel lines) *************/
return false;
b1 = clV1.y - m1 * clV1.x;
b2 = rclLine.clV1.y - m2 * rclLine.clV1.x;
@@ -214,7 +214,7 @@ bool Line2d::Intersect (const Line2d& rclLine, Vector2d &rclV) const
rclV.x = (b2 - b1) / (m1 - m2);
rclV.y = m1 * rclV.x + b1;
}
return true; /*** RETURN true (intersection) **********/
}
@@ -269,7 +269,7 @@ BoundBox2d Polygon2d::CalcBoundBox (void) const
clBB.MaxX = std::max<double> (clBB.MaxX, _aclVct[i].x);
clBB.MaxY = std::max<double> (clBB.MaxY, _aclVct[i].y);
}
return clBB;
return clBB;
}
static short _CalcTorsion (double *pfLine, double fX, double fY)
@@ -309,7 +309,7 @@ static short _CalcTorsion (double *pfLine, double fX, double fY)
bool Polygon2d::Contains (const Vector2d &rclV) const
{
// Ermittelt mit dem Verfahren der Windungszahl, ob ein Punkt innerhalb
// Ermittelt mit dem Verfahren der Windungszahl, ob ein Punkt innerhalb
// eines Polygonzugs enthalten ist.
// Summe aller Windungszahlen gibt an, ob ja oder nein.
double pfTmp[4];
@@ -379,7 +379,7 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list<Polygon2d> &rc
{
clTrimPt2 = At((i + 1) % ulTrimCt);
Line2d clToTrimLine(At(i), clTrimPt2);
Vector2d clV;
if (clLine.IntersectAndContain(clToTrimLine, clV) == true)
{
@@ -407,7 +407,7 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list<Polygon2d> &rc
clResultPolygon.Add(clPtIS);
bInner = true;
}
}
}
if (bInner == true) // add line end point if inside
clResultPolygon.Add(clPt1);
@@ -417,7 +417,7 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list<Polygon2d> &rc
if (bInner == true)
clResultPolygon.Add(clPt1);
}
}
}
// add last segment
if (clResultPolygon.GetCtVectors() > 0)
@@ -450,7 +450,7 @@ bool Polygon2d::Intersect (const Polygon2d &other) const {
if (line.IntersectAndContain(line2, v))
return true;
}
}
}
return false;
}

View File

@@ -100,7 +100,7 @@ class BaseExport BoundBox2d
{
public:
double MinX, MinY, MaxX, MaxY;
inline BoundBox2d (void);
inline BoundBox2d (const BoundBox2d &rclBB);
inline BoundBox2d (double fX1, double fY1, double fX2, double fY2);
@@ -110,7 +110,7 @@ public:
// operators
inline BoundBox2d& operator= (const BoundBox2d& rclBB);
inline bool operator== (const BoundBox2d& rclBB) const;
// methods
inline double Width(void) const;
inline double Height(void) const;
@@ -176,7 +176,7 @@ public:
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 (void);
// misc
BoundBox2d CalcBoundBox (void) const;

View File

@@ -19,7 +19,7 @@
* Fifth Floor, Boston, MA 02110-1301, USA *
* *
***************************************************************************/
#ifndef BASE_TRANSLATE_H
#define BASE_TRANSLATE_H
@@ -42,6 +42,6 @@ private:
Py::Object trNoop(const Py::Tuple& args);
};
} // namespace Base
} // namespace Base
#endif // BASE_TRANSLATE_H

View File

@@ -37,7 +37,7 @@ using namespace Base;
using namespace std;
struct Base::TypeData
struct Base::TypeData
{
TypeData(const char *theName,
const Type type = Type::badType(),
@@ -176,7 +176,7 @@ void Type::destruct(void)
Type Type::fromName(const char *name)
{
std::map<std::string,unsigned int>::const_iterator pos;
pos = typemap.find(name);
if (pos != typemap.end())
return typedata[pos->second]->type;
@@ -204,7 +204,7 @@ const Type Type::getParent(void) const
bool Type::isDerivedFrom(const Type type) const
{
Type temp(*this);
do {
if (temp == type)

View File

@@ -106,7 +106,7 @@ public:
unsigned int getKey(void) const;
bool isBad(void) const;
void operator = (const Type type);
void operator = (const Type type);
bool operator == (const Type type) const;
bool operator != (const Type type) const;
@@ -150,7 +150,7 @@ Type::operator != (const Type type) const
}
inline void
Type::operator = (const Type type)
Type::operator = (const Type type)
{
this->index = type.getKey();
}

View File

@@ -228,5 +228,5 @@ PyObject *TypePy::getCustomAttributes(const char* /*attr*/) const
int TypePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}

View File

@@ -146,7 +146,7 @@ Unit Unit::pow(signed char exp) const
bool Unit::isEmpty(void)const
{
return (this->Sig.Length == 0)
return (this->Sig.Length == 0)
&& (this->Sig.Mass == 0)
&& (this->Sig.Time == 0)
&& (this->Sig.ElectricCurrent == 0)
@@ -158,7 +158,7 @@ bool Unit::isEmpty(void)const
bool Unit::operator ==(const Unit& that) const
{
return (this->Sig.Length == that.Sig.Length)
return (this->Sig.Length == that.Sig.Length)
&& (this->Sig.Mass == that.Sig.Mass)
&& (this->Sig.Time == that.Sig.Time)
&& (this->Sig.ElectricCurrent == that.Sig.ElectricCurrent)

View File

@@ -83,11 +83,11 @@ public:
Unit pow(signed char exp)const;
//@}
/// get the unit signature
const UnitSignature & getSignature(void)const {return Sig;}
const UnitSignature & getSignature(void)const {return Sig;}
bool isEmpty(void)const;
QString getString(void) const;
/// get the type as an string such as "Area", "Length" or "Pressure".
/// get the type as an string such as "Area", "Length" or "Pressure".
QString getTypeString(void) const;
/** Predefined Unit types. */
@@ -100,7 +100,7 @@ public:
/// Angle
static Unit Angle;
static Unit AngleOfFriction;
static Unit Density;
static Unit Area;

View File

@@ -1,3 +1,24 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
@@ -15,7 +36,7 @@ std::string UnitPy::representation(void) const
{
const UnitSignature & Sig = getUnitPtr()->getSignature();
std::stringstream ret;
ret << "Unit: ";
ret << "Unit: ";
ret << getUnitPtr()->getString().toUtf8().constData() << " (";
ret << Sig.Length << ",";
ret << Sig.Mass << ",";
@@ -24,7 +45,7 @@ std::string UnitPy::representation(void) const
ret << Sig.ThermodynamicTemperature << ",";
ret << Sig.AmountOfSubstance << ",";
ret << Sig.LuminousIntensity << ",";
ret << Sig.Angle << ")";
ret << Sig.Angle << ")";
std::string type = getUnitPtr()->getTypeString().toUtf8().constData();
if (! type.empty())
ret << " [" << type << "]";
@@ -34,7 +55,7 @@ std::string UnitPy::representation(void) const
PyObject *UnitPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of UnitPy and the Twin object
// create a new instance of UnitPy and the Twin object
return new UnitPy(new Unit);
}
@@ -152,7 +173,7 @@ PyObject* UnitPy::number_multiply_handler(PyObject *self, PyObject *other)
if (PyObject_TypeCheck(other, &(UnitPy::Type))) {
Base::Unit *a = static_cast<UnitPy*>(self) ->getUnitPtr();
Base::Unit *b = static_cast<UnitPy*>(other)->getUnitPtr();
return new UnitPy(new Unit( (*a) * (*b) ) );
}
else {
@@ -221,7 +242,7 @@ PyObject *UnitPy::getCustomAttributes(const char* /*attr*/) const
int UnitPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}
PyObject * UnitPy::number_divide_handler (PyObject* /*self*/, PyObject* /*other*/)

View File

@@ -57,7 +57,7 @@ using namespace Base;
//{
// // check limits
// assert(t<9);
// // returns
// // returns
// return QString::fromLatin1(QuantityNames[t]);
//}
// === static attributes ================================================

View File

@@ -38,7 +38,7 @@ typedef std::unique_ptr<UnitsSchema> UnitsSchemaPtr;
/**
* The UnitsApi
*/
class BaseExport UnitsApi
class BaseExport UnitsApi
{
public:
@@ -50,7 +50,7 @@ public:
/** set Schema
* set the UnitsSchema of the Application
* this a represented by a class of type UnitSchema which
* defines a set of standard units for that schema and rules
* defines a set of standard units for that schema and rules
* for representative strings.
*/
static void setSchema(UnitSystem s);

View File

@@ -32,7 +32,7 @@
/// Here the FreeCAD includes sorted by Base,App,Gui......
#include "UnitsApi.h"
#include "Quantity.h"
#include "QuantityPy.h"
#include "QuantityPy.h"
@@ -57,13 +57,13 @@ PyMethodDef UnitsApi::Methods[] = {
// " That means if no unit is issued the user prefs are in \n"
// " charge. If one unit is used the user prefs get ignored\n"
// " type can be: \n"
// " Length \n"
// " Area \n"
// " Volume \n"
// " Angle \n"
// " Length \n"
// " Area \n"
// " Volume \n"
// " Angle \n"
// " TimeSpan \n"
// " Velocity \n"
// " Acceleration \n"
// " Acceleration \n"
// " Mass \n"
// " Temperature \n"

View File

@@ -48,10 +48,10 @@ enum class UnitSystem {
/** The UnitSchema class
* The subclasses of this class define the stuff for a
* certain units schema.
* The subclasses of this class define the stuff for a
* certain units schema.
*/
class UnitsSchema
class UnitsSchema
{
public:
virtual ~UnitsSchema(){}

View File

@@ -349,7 +349,7 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant, d
factor = 28316846.592;
}
else if (unit == Unit::Mass) {
unitString = QString::fromLatin1("lb"); //always lbs.
unitString = QString::fromLatin1("lb"); //always lbs.
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {

View File

@@ -30,7 +30,7 @@
#include "UnitsSchema.h"
namespace Base {
/** The schema class for the imperial unit system
* Here are the definitions for the imperial unit system.
@@ -69,7 +69,7 @@ public:
};
/** The schema class for Civil Engineering in the imperial unit system
* All measurements in ft, ft^2, ft^3, ft/sec.
* All measurements in ft, ft^2, ft^3, ft/sec.
* Pressure is in psi.
*/
class UnitsSchemaImperialCivil: public UnitsSchema

View File

@@ -30,7 +30,7 @@
#include "UnitsSchema.h"
namespace Base {
/** The standard units schema
* Here is defined what internal (base) units FreeCAD uses.

View File

@@ -30,7 +30,7 @@
#include "UnitsSchema.h"
namespace Base {
/**
* The UnitSchema class

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* (c) Jürgen Riegel (juergen.riegel@web.de) 2008 *
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -74,19 +74,19 @@ std::string Uuid::createUuid(void)
return Uuid;
}
void Uuid::setValue(const char* sString)
{
if (sString) {
QUuid uuid(QString::fromLatin1(sString));
if (uuid.isNull())
throw std::runtime_error("invalid uuid");
// remove curly braces
QString id = uuid.toString();
id = id.mid(1);
id.chop(1);
_uuid = (const char*)id.toLatin1();
}
}
void Uuid::setValue(const char* sString)
{
if (sString) {
QUuid uuid(QString::fromLatin1(sString));
if (uuid.isNull())
throw std::runtime_error("invalid uuid");
// remove curly braces
QString id = uuid.toString();
id = id.mid(1);
id.chop(1);
_uuid = (const char*)id.toLatin1();
}
}
void Uuid::setValue(const std::string &sString)
{

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* (c) Jürgen Riegel (juergen.riegel@web.de) 2008 *
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *

View File

@@ -193,7 +193,7 @@ Vector3<_Precision> Vector3<_Precision>::Cross(const Vector3<_Precision>& rcVct)
}
template <class _Precision>
bool Vector3<_Precision>::IsOnLineSegment (const Vector3<_Precision>& startVct, const Vector3<_Precision>& endVct) const
bool Vector3<_Precision>::IsOnLineSegment (const Vector3<_Precision>& startVct, const Vector3<_Precision>& endVct) const
{
Vector3<_Precision> vectorAB = endVct - startVct;
Vector3<_Precision> vectorAC = *this - startVct;

View File

@@ -55,7 +55,7 @@ std::string VectorPy::representation(void) const
PyObject *VectorPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of VectorPy and the Twin object
// create a new instance of VectorPy and the Twin object
return new VectorPy(new Vector3d);
}
@@ -330,7 +330,7 @@ PyObject* VectorPy::negative(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
VectorPy::PointerType this_ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
Base::Vector3d v = -(*this_ptr);
return new VectorPy(v);

View File

@@ -170,7 +170,7 @@ std::string Writer::addFile(const char* Name,const Base::Persistence *Object)
FileEntry temp;
temp.FileName = getUniqueFileName(Name);
temp.Object = Object;
FileList.push_back(temp);
FileNames.push_back( temp.FileName );
@@ -240,7 +240,7 @@ void Writer::decInd(void)
// ----------------------------------------------------------------------------
ZipWriter::ZipWriter(const char* FileName)
ZipWriter::ZipWriter(const char* FileName)
: ZipStream(FileName)
{
#ifdef _MSC_VER
@@ -252,7 +252,7 @@ ZipWriter::ZipWriter(const char* FileName)
ZipStream.setf(ios::fixed,ios::floatfield);
}
ZipWriter::ZipWriter(std::ostream& os)
ZipWriter::ZipWriter(std::ostream& os)
: ZipStream(os)
{
#ifdef _MSC_VER

View File

@@ -26,8 +26,8 @@
#include <set>
#include <string>
#include <sstream>
#include <vector>
#include <sstream>
#include <vector>
#include <cassert>
#ifdef _MSC_VER
@@ -48,7 +48,7 @@ namespace Base
class Persistence;
/** The Writer class
/** The Writer class
* This is an important helper class for the store and retrieval system
* of persistent objects in FreeCAD.
* \see Base::Persistence
@@ -137,9 +137,9 @@ protected:
};
/** The ZipWriter class
/** The ZipWriter class
* This is an important helper class implementation for the store and retrieval system
* of persistent objects in FreeCAD.
* of persistent objects in FreeCAD.
* \see Base::Persistence
* \author Juergen Riegel
*/
@@ -162,9 +162,9 @@ private:
zipios::ZipOutputStream ZipStream;
};
/** The StringWriter class
/** The StringWriter class
* This is an important helper class implementation for the store and retrieval system
* of objects in FreeCAD.
* of objects in FreeCAD.
* \see Base::Persistence
* \author Juergen Riegel
*/
@@ -195,7 +195,7 @@ public:
virtual void writeFiles(void);
virtual std::ostream &Stream(void){return FileStream;}
void close() {FileStream.close();}
void close() {FileStream.close();}
/*!
This method can be re-implemented in sub-classes to avoid
to write out certain objects. The default implementation

View File

@@ -80,7 +80,7 @@ inline StrX::StrX(const XMLCh* const toTranscode)
// WideCharToMultiByte(CP_UTF8,0,toTranscode,-1,fLocaleForm)
//#else
// fUnicodeForm = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(toTranscode);
//#endif
//#endif
}
inline StrX::~StrX()
@@ -183,7 +183,7 @@ class XStr
public :
/// Constructors and Destructor
XStr(const char* const toTranscode);
///
///
~XStr();
@@ -204,7 +204,7 @@ inline XStr::XStr(const char* const toTranscode)
// WideCharToMultiByte()
//#else
fUnicodeForm = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(toTranscode);
//#endif
//#endif
}
inline XStr::~XStr()

View File

@@ -1,7 +1,7 @@
/** \defgroup BASE Base
* \ingroup CORE
\brief Basic structures used by other FreeCAD components
The Base module includes most of the basic functions of FreeCAD, such as:
- Console services: printing different kinds of messages to the FreeCAD report view or the terminal
- Python interpreter: handles the execution of Python code in FreeCAD