Merge branch 'master' into empty_identifier_not_allowed
This commit is contained in:
@@ -231,6 +231,7 @@ SET(FreeCADBase_CPP_SRCS
|
||||
MatrixPyImp.cpp
|
||||
MemDebug.cpp
|
||||
Mutex.cpp
|
||||
Observer.cpp
|
||||
Parameter.xsd
|
||||
Parameter.cpp
|
||||
ParameterPy.cpp
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
|
||||
|
||||
/** Base class of all factories
|
||||
* This class has the purpose to produce at runtime instances
|
||||
* of classes not known at compile time. It holds a map of so called
|
||||
* This class has the purpose to produce instances of classes at runtime
|
||||
* that are unknown 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
|
||||
*/
|
||||
|
||||
34
src/Base/Observer.cpp
Normal file
34
src/Base/Observer.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Library General Public License (LGPL) *
|
||||
* as published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* 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 *
|
||||
* 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 *
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
* USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "Observer.h"
|
||||
|
||||
|
||||
namespace Base {
|
||||
|
||||
template class BaseExport Observer<const char*>;
|
||||
template class BaseExport Subject<const char*>;
|
||||
|
||||
} //namespace Base
|
||||
@@ -216,16 +216,17 @@ protected:
|
||||
std::set<Observer <_MessageType> *> _ObserverSet;
|
||||
};
|
||||
|
||||
#if defined (FC_OS_WIN32) || defined(FC_OS_CYGWIN)
|
||||
# ifdef FCBase
|
||||
template class BaseExport Observer<const char*>;
|
||||
template class BaseExport Subject<const char*>;
|
||||
# else
|
||||
extern template class BaseExport Observer<const char*>;
|
||||
extern template class BaseExport Subject<const char*>;
|
||||
# endif
|
||||
// Workaround for MSVC
|
||||
#if defined (FreeCADBase_EXPORTS) && defined(_MSC_VER)
|
||||
# define Base_EXPORT
|
||||
#else
|
||||
# define Base_EXPORT BaseExport
|
||||
#endif
|
||||
|
||||
extern template class Base_EXPORT Observer<const char*>;
|
||||
extern template class Base_EXPORT Subject<const char*>;
|
||||
|
||||
|
||||
} //namespace Base
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,21 @@ void ProgressIndicatorPy::init_type()
|
||||
add_varargs_method("stop",&ProgressIndicatorPy::stop,"stop()");
|
||||
}
|
||||
|
||||
Py::PythonType& ProgressIndicatorPy::behaviors()
|
||||
{
|
||||
return Py::PythonExtension<ProgressIndicatorPy>::behaviors();
|
||||
}
|
||||
|
||||
PyTypeObject* ProgressIndicatorPy::type_object()
|
||||
{
|
||||
return Py::PythonExtension<ProgressIndicatorPy>::type_object();
|
||||
}
|
||||
|
||||
bool ProgressIndicatorPy::check(PyObject* p)
|
||||
{
|
||||
return Py::PythonExtension<ProgressIndicatorPy>::check(p);
|
||||
}
|
||||
|
||||
PyObject *ProgressIndicatorPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
|
||||
{
|
||||
return new ProgressIndicatorPy();
|
||||
|
||||
@@ -35,6 +35,9 @@ class BaseExport ProgressIndicatorPy : public Py::PythonExtension<ProgressIndica
|
||||
{
|
||||
public:
|
||||
static void init_type(); // announce properties and methods
|
||||
static Py::PythonType& behaviors();
|
||||
static PyTypeObject* type_object();
|
||||
static bool check(PyObject* p);
|
||||
|
||||
ProgressIndicatorPy();
|
||||
~ProgressIndicatorPy() override;
|
||||
|
||||
@@ -271,6 +271,12 @@ bool Quantity::isDimensionless() const
|
||||
return isValid() && myUnit.isEmpty();
|
||||
}
|
||||
|
||||
/// true if it has a specific unit or no dimension.
|
||||
bool Quantity::isDimensionlessOrUnit(const Unit& unit) const
|
||||
{
|
||||
return isDimensionless() || myUnit == unit;
|
||||
}
|
||||
|
||||
// true if it has a number and a valid unit
|
||||
bool Quantity::isQuantity() const
|
||||
{
|
||||
|
||||
@@ -181,6 +181,8 @@ public:
|
||||
|
||||
/// true if it has a number without a unit
|
||||
bool isDimensionless()const;
|
||||
/// true if it has a specific unit or no dimension.
|
||||
bool isDimensionlessOrUnit(const Unit& unit)const;
|
||||
/// true if it has a number and a valid unit
|
||||
bool isQuantity()const;
|
||||
/// true if it has a number with or without a unit
|
||||
|
||||
Reference in New Issue
Block a user