fix cppcoreguidelines-*

* cppcoreguidelines-init-variables
* cppcoreguidelines-c-copy-assignment-signature
* cppcoreguidelines-macro-usage
* cppcoreguidelines-non-private-member-variables-in-classes
* cppcoreguidelines-pro-type-member-init
* cppcoreguidelines-slicing
* cppcoreguidelines-special-member-functions
* cppcoreguidelines-virtual-class-destructor
This commit is contained in:
wmayer
2023-11-15 17:12:50 +01:00
parent 39337ea12e
commit 08b10cd287
38 changed files with 418 additions and 166 deletions

View File

@@ -30,6 +30,7 @@
using PyObject = struct _object;
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
/// define for subclassing Base::BaseClass
#define TYPESYSTEM_HEADER() \
public: \
@@ -129,6 +130,7 @@ private:
{ \
initSubclass(_class_::classTypeId, #_class_, #_parentclass_, &(_class_::create)); \
}
// NOLINTEND(cppcoreguidelines-macro-usage)
namespace Base
{

View File

@@ -68,7 +68,6 @@ public:
, notifier(notifier)
, msg(msg)
{}
~ConsoleEvent() override = default;
};
class ConsoleOutput: public QObject // clazy:exclude=missing-qobject-macro
@@ -139,13 +138,10 @@ public:
}
private:
ConsoleOutput() = default;
~ConsoleOutput() override = default;
static ConsoleOutput* instance;
static ConsoleOutput* instance; // NOLINT
};
ConsoleOutput* ConsoleOutput::instance = nullptr;
ConsoleOutput* ConsoleOutput::instance = nullptr; // NOLINT
} // namespace Base

View File

@@ -550,6 +550,10 @@ class BaseExport ILogger
{
public:
ILogger() = default;
ILogger(const ILogger&) = delete;
ILogger(ILogger&&) = delete;
ILogger& operator=(const ILogger&) = delete;
ILogger& operator=(ILogger&&) = delete;
virtual ~ILogger() = 0;
/** Used to send a Log message at the given level.
@@ -841,7 +845,7 @@ public:
inline constexpr FreeCAD_ConsoleMsgType getConsoleMsg(Base::LogStyle style);
protected:
private:
// python exports goes here +++++++++++++++++++++++++++++++++++++++++++
// static python wrapper of the exported functions
static PyObject* sPyLog(PyObject* self, PyObject* args);
@@ -867,7 +871,13 @@ protected:
// Singleton!
ConsoleSingleton();
virtual ~ConsoleSingleton();
~ConsoleSingleton();
public:
ConsoleSingleton(const ConsoleSingleton&) = delete;
ConsoleSingleton(ConsoleSingleton&&) = delete;
ConsoleSingleton& operator=(const ConsoleSingleton&) = delete;
ConsoleSingleton& operator=(ConsoleSingleton&&) = delete;
private:
void postEvent(ConsoleSingleton::FreeCAD_ConsoleMsgType type,
@@ -883,7 +893,7 @@ private:
// singleton
static void Destruct();
static ConsoleSingleton* _pcSingleton;
static ConsoleSingleton* _pcSingleton; // NOLINT
// observer list
std::set<ILogger*> _aclObservers;
@@ -929,6 +939,11 @@ public:
{
Console().EnableRefresh(true);
}
ConsoleRefreshDisabler(const ConsoleRefreshDisabler&) = delete;
ConsoleRefreshDisabler(ConsoleRefreshDisabler&&) = delete;
ConsoleRefreshDisabler& operator=(const ConsoleRefreshDisabler&) = delete;
ConsoleRefreshDisabler& operator=(ConsoleRefreshDisabler&&) = delete;
};

View File

@@ -47,6 +47,8 @@ Exception::Exception()
Exception::Exception(const Exception& inst) = default;
Exception::Exception(Exception&& inst) noexcept = default;
Exception::Exception(const char* sMessage)
: _sErrMsg(sMessage)
, _line(0)
@@ -67,6 +69,17 @@ Exception& Exception::operator=(const Exception& inst)
_file = inst._file;
_line = inst._line;
_function = inst._function;
_isTranslatable = inst._isTranslatable;
return *this;
}
Exception& Exception::operator=(Exception&& inst) noexcept
{
_sErrMsg = std::move(inst._sErrMsg);
_file = std::move(inst._file);
_line = inst._line;
_function = std::move(inst._function);
_isTranslatable = inst._isTranslatable;
return *this;
}
@@ -289,14 +302,6 @@ std::string FileException::getFileName() const
return file.fileName();
}
FileException& FileException::operator=(const FileException& inst)
{
Exception::operator=(inst);
file = inst.file;
_sErrMsgAndFileName = inst._sErrMsgAndFileName;
return *this;
}
const char* FileException::what() const noexcept
{
return _sErrMsgAndFileName.c_str();
@@ -402,12 +407,27 @@ MemoryException::MemoryException(const MemoryException& inst)
#endif
{}
MemoryException::MemoryException(MemoryException&& inst) noexcept
#if defined(__GNUC__)
: std::bad_alloc()
, Exception(inst)
#else
: Exception(inst)
#endif
{}
MemoryException& MemoryException::operator=(const MemoryException& inst)
{
Exception::operator=(inst);
return *this;
}
MemoryException& MemoryException::operator=(MemoryException&& inst) noexcept
{
Exception::operator=(inst);
return *this;
}
#if defined(__GNUC__)
const char* MemoryException::what() const noexcept
{

View File

@@ -199,6 +199,7 @@ public:
~Exception() noexcept override = default;
Exception& operator=(const Exception& inst);
Exception& operator=(Exception&& inst) noexcept;
virtual const char* what() const noexcept;
@@ -250,6 +251,7 @@ protected:
Exception(const std::string& sMessage);
Exception();
Exception(const Exception& inst);
Exception(Exception&& inst) noexcept;
protected:
std::string _sErrMsg;
@@ -274,9 +276,14 @@ public:
AbortException(const char* sMessage);
/// Construction
AbortException();
AbortException(const AbortException&) = default;
AbortException(AbortException&&) = default;
/// Destruction
~AbortException() noexcept override = default;
AbortException& operator=(const AbortException&) = default;
AbortException& operator=(AbortException&&) = default;
/// Description of the exception
const char* what() const noexcept override;
/// returns the corresponding python exception type
@@ -294,9 +301,14 @@ public:
XMLBaseException();
XMLBaseException(const char* sMessage);
XMLBaseException(const std::string& sMessage);
XMLBaseException(const XMLBaseException&) = default;
XMLBaseException(XMLBaseException&&) = default;
/// Destruction
~XMLBaseException() noexcept override = default;
XMLBaseException& operator=(const XMLBaseException&) = default;
XMLBaseException& operator=(XMLBaseException&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -313,9 +325,14 @@ public:
XMLParseException(const std::string& sMessage);
/// Construction
XMLParseException();
XMLParseException(const XMLParseException&) = default;
XMLParseException(XMLParseException&&) = default;
/// Destruction
~XMLParseException() noexcept override = default;
XMLParseException& operator=(const XMLParseException&) = default;
XMLParseException& operator=(XMLParseException&&) = default;
/// Description of the exception
const char* what() const noexcept override;
PyObject* getPyExceptionType() const override;
@@ -334,9 +351,14 @@ public:
XMLAttributeError(const std::string& sMessage);
/// Construction
XMLAttributeError();
XMLAttributeError(const XMLAttributeError&) = default;
XMLAttributeError(XMLAttributeError&&) = default;
/// Destruction
~XMLAttributeError() noexcept override = default;
XMLAttributeError& operator=(const XMLAttributeError&) = default;
XMLAttributeError& operator=(XMLAttributeError&&) = default;
/// Description of the exception
const char* what() const noexcept override;
PyObject* getPyExceptionType() const override;
@@ -355,12 +377,14 @@ public:
FileException(const char* sMessage, const FileInfo& File);
/// standard construction
FileException();
/// Construction
FileException(const FileException&) = default;
FileException(FileException&&) = default;
/// Destruction
~FileException() noexcept override = default;
/// Assignment operator
FileException& operator=(const FileException& inst);
FileException& operator=(const FileException&) = default;
FileException& operator=(FileException&&) = default;
/// Description of the exception
const char* what() const noexcept override;
/// Report generation
@@ -394,8 +418,13 @@ public:
FileSystemError();
FileSystemError(const char* sMessage);
FileSystemError(const std::string& sMessage);
FileSystemError(const FileSystemError&) = default;
FileSystemError(FileSystemError&&) = default;
/// Destruction
~FileSystemError() noexcept override = default;
FileSystemError& operator=(const FileSystemError&) = default;
FileSystemError& operator=(FileSystemError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -410,8 +439,12 @@ public:
BadFormatError();
BadFormatError(const char* sMessage);
BadFormatError(const std::string& sMessage);
BadFormatError(const BadFormatError&) = default;
BadFormatError(BadFormatError&&) = default;
/// Destruction
~BadFormatError() noexcept override = default;
BadFormatError& operator=(const BadFormatError&) = default;
BadFormatError& operator=(BadFormatError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -431,10 +464,12 @@ public:
MemoryException();
/// Construction
MemoryException(const MemoryException& inst);
MemoryException(MemoryException&& inst) noexcept;
/// Destruction
~MemoryException() noexcept override = default;
/// Assignment operator
MemoryException& operator=(const MemoryException& inst);
MemoryException& operator=(MemoryException&& inst) noexcept;
#if defined(__GNUC__)
/// Description of the exception
const char* what() const noexcept override;
@@ -453,8 +488,12 @@ public:
AccessViolation();
AccessViolation(const char* sMessage);
AccessViolation(const std::string& sMessage);
AccessViolation(const AccessViolation&) = default;
AccessViolation(AccessViolation&&) = default;
/// Destruction
~AccessViolation() noexcept override = default;
AccessViolation& operator=(const AccessViolation&) = default;
AccessViolation& operator=(AccessViolation&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -470,8 +509,12 @@ public:
/// Construction
AbnormalProgramTermination(const char* sMessage);
AbnormalProgramTermination(const std::string& sMessage);
AbnormalProgramTermination(const AbnormalProgramTermination&) = default;
AbnormalProgramTermination(AbnormalProgramTermination&&) = default;
/// Destruction
~AbnormalProgramTermination() noexcept override = default;
AbnormalProgramTermination& operator=(const AbnormalProgramTermination&) = default;
AbnormalProgramTermination& operator=(AbnormalProgramTermination&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -486,8 +529,12 @@ public:
UnknownProgramOption();
UnknownProgramOption(const char* sMessage);
UnknownProgramOption(const std::string& sMessage);
UnknownProgramOption(const UnknownProgramOption&) = default;
UnknownProgramOption(UnknownProgramOption&&) = default;
/// Destruction
~UnknownProgramOption() noexcept override = default;
UnknownProgramOption& operator=(const UnknownProgramOption&) = default;
UnknownProgramOption& operator=(UnknownProgramOption&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -502,9 +549,13 @@ public:
ProgramInformation();
ProgramInformation(const char* sMessage);
ProgramInformation(const std::string& sMessage);
ProgramInformation(const ProgramInformation&) = default;
ProgramInformation(ProgramInformation&&) = default;
/// Destruction
~ProgramInformation() noexcept override = default;
ProgramInformation& operator=(const ProgramInformation&) = default;
ProgramInformation& operator=(ProgramInformation&&) = default;
};
/**
@@ -518,8 +569,12 @@ public:
TypeError();
TypeError(const char* sMessage);
TypeError(const std::string& sMessage);
TypeError(const TypeError&) = default;
TypeError(TypeError&&) = default;
/// Destruction
~TypeError() noexcept override = default;
TypeError& operator=(const TypeError&) = default;
TypeError& operator=(TypeError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -534,8 +589,12 @@ public:
ValueError();
ValueError(const char* sMessage);
ValueError(const std::string& sMessage);
ValueError(const ValueError&) = default;
ValueError(ValueError&&) = default;
/// Destruction
~ValueError() noexcept override = default;
ValueError& operator=(const ValueError&) = default;
ValueError& operator=(ValueError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -550,8 +609,12 @@ public:
IndexError();
IndexError(const char* sMessage);
IndexError(const std::string& sMessage);
IndexError(const IndexError&) = default;
IndexError(IndexError&&) = default;
/// Destruction
~IndexError() noexcept override = default;
IndexError& operator=(const IndexError&) = default;
IndexError& operator=(IndexError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -562,8 +625,12 @@ public:
NameError();
NameError(const char* sMessage);
NameError(const std::string& sMessage);
NameError(const NameError&) = default;
NameError(NameError&&) = default;
/// Destruction
~NameError() noexcept override = default;
NameError& operator=(const NameError&) = default;
NameError& operator=(NameError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -574,8 +641,12 @@ public:
ImportError();
ImportError(const char* sMessage);
ImportError(const std::string& sMessage);
ImportError(const ImportError&) = default;
ImportError(ImportError&&) = default;
/// Destruction
~ImportError() noexcept override = default;
ImportError& operator=(const ImportError&) = default;
ImportError& operator=(ImportError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -590,8 +661,12 @@ public:
AttributeError();
AttributeError(const char* sMessage);
AttributeError(const std::string& sMessage);
AttributeError(const AttributeError&) = default;
AttributeError(AttributeError&&) = default;
/// Destruction
~AttributeError() noexcept override = default;
AttributeError& operator=(const AttributeError&) = default;
AttributeError& operator=(AttributeError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -606,8 +681,12 @@ public:
RuntimeError();
RuntimeError(const char* sMessage);
RuntimeError(const std::string& sMessage);
RuntimeError(const RuntimeError&) = default;
RuntimeError(RuntimeError&&) = default;
/// Destruction
~RuntimeError() noexcept override = default;
RuntimeError& operator=(const RuntimeError&) = default;
RuntimeError& operator=(RuntimeError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -622,8 +701,12 @@ public:
BadGraphError();
BadGraphError(const char* sMessage);
BadGraphError(const std::string& sMessage);
BadGraphError(const BadGraphError&) = default;
BadGraphError(BadGraphError&&) = default;
/// Destruction
~BadGraphError() noexcept override = default;
BadGraphError& operator=(const BadGraphError&) = default;
BadGraphError& operator=(BadGraphError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -638,8 +721,12 @@ public:
NotImplementedError();
NotImplementedError(const char* sMessage);
NotImplementedError(const std::string& sMessage);
NotImplementedError(const NotImplementedError&) = default;
NotImplementedError(NotImplementedError&&) = default;
/// Destruction
~NotImplementedError() noexcept override = default;
NotImplementedError& operator=(const NotImplementedError&) = default;
NotImplementedError& operator=(NotImplementedError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -654,8 +741,12 @@ public:
ZeroDivisionError();
ZeroDivisionError(const char* sMessage);
ZeroDivisionError(const std::string& sMessage);
ZeroDivisionError(const ZeroDivisionError&) = default;
ZeroDivisionError(ZeroDivisionError&&) = default;
/// Destruction
~ZeroDivisionError() noexcept override = default;
ZeroDivisionError& operator=(const ZeroDivisionError&) = default;
ZeroDivisionError& operator=(ZeroDivisionError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -670,8 +761,12 @@ public:
ReferenceError();
ReferenceError(const char* sMessage);
ReferenceError(const std::string& sMessage);
ReferenceError(const ReferenceError&) = default;
ReferenceError(ReferenceError&&) = default;
/// Destruction
~ReferenceError() noexcept override = default;
ReferenceError& operator=(const ReferenceError&) = default;
ReferenceError& operator=(ReferenceError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -687,8 +782,12 @@ public:
ExpressionError();
ExpressionError(const char* sMessage);
ExpressionError(const std::string& sMessage);
ExpressionError(const ExpressionError&) = default;
ExpressionError(ExpressionError&&) = default;
/// Destruction
~ExpressionError() noexcept override = default;
ExpressionError& operator=(const ExpressionError&) = default;
ExpressionError& operator=(ExpressionError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -703,8 +802,12 @@ public:
ParserError();
ParserError(const char* sMessage);
ParserError(const std::string& sMessage);
ParserError(const ParserError&) = default;
ParserError(ParserError&&) = default;
/// Destruction
~ParserError() noexcept override = default;
ParserError& operator=(const ParserError&) = default;
ParserError& operator=(ParserError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -719,8 +822,12 @@ public:
UnicodeError();
UnicodeError(const char* sMessage);
UnicodeError(const std::string& sMessage);
UnicodeError(const UnicodeError&) = default;
UnicodeError(UnicodeError&&) = default;
/// Destruction
~UnicodeError() noexcept override = default;
UnicodeError& operator=(const UnicodeError&) = default;
UnicodeError& operator=(UnicodeError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -735,8 +842,12 @@ public:
OverflowError();
OverflowError(const char* sMessage);
OverflowError(const std::string& sMessage);
OverflowError(const OverflowError&) = default;
OverflowError(OverflowError&&) = default;
/// Destruction
~OverflowError() noexcept override = default;
OverflowError& operator=(const OverflowError&) = default;
OverflowError& operator=(OverflowError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -751,8 +862,12 @@ public:
UnderflowError();
UnderflowError(const char* sMessage);
UnderflowError(const std::string& sMessage);
UnderflowError(const UnderflowError&) = default;
UnderflowError(UnderflowError&&) = default;
/// Destruction
~UnderflowError() noexcept override = default;
UnderflowError& operator=(const UnderflowError&) = default;
UnderflowError& operator=(UnderflowError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -767,8 +882,12 @@ public:
UnitsMismatchError();
UnitsMismatchError(const char* sMessage);
UnitsMismatchError(const std::string& sMessage);
UnitsMismatchError(const UnitsMismatchError&) = default;
UnitsMismatchError(UnitsMismatchError&&) = default;
/// Destruction
~UnitsMismatchError() noexcept override = default;
UnitsMismatchError& operator=(const UnitsMismatchError&) = default;
UnitsMismatchError& operator=(UnitsMismatchError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -784,8 +903,12 @@ public:
CADKernelError();
CADKernelError(const char* sMessage);
CADKernelError(const std::string& sMessage);
CADKernelError(const CADKernelError&) = default;
CADKernelError(CADKernelError&&) = default;
/// Destruction
~CADKernelError() noexcept override = default;
CADKernelError& operator=(const CADKernelError&) = default;
CADKernelError& operator=(CADKernelError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -803,8 +926,12 @@ public:
RestoreError();
RestoreError(const char* sMessage);
RestoreError(const std::string& sMessage);
RestoreError(const RestoreError&) = default;
RestoreError(RestoreError&&) = default;
/// Destruction
~RestoreError() noexcept override = default;
RestoreError& operator=(const RestoreError&) = default;
RestoreError& operator=(RestoreError&&) = default;
PyObject* getPyExceptionType() const override;
};
@@ -868,8 +995,10 @@ private:
static void throw_signal(int signum);
private:
struct sigaction new_action, old_action;
bool ok;
// clang-format off
struct sigaction new_action {}, old_action {};
bool ok {false};
// clang-format on
};
#endif

View File

@@ -75,8 +75,6 @@ public:
ExceptionFactory::Instance().AddProducer(typeid(CLASS).name(), this);
}
~ExceptionProducer() override = default;
void raiseException(PyObject* pydict) const override
{
CLASS cls;

View File

@@ -44,6 +44,8 @@ public:
virtual ~AbstractProducer() = default;
/// overwritten by a concrete producer to produce the needed object
virtual void* Produce() const = 0;
FC_DISABLE_COPY_MOVE(AbstractProducer)
};
@@ -62,22 +64,25 @@ public:
bool CanProduce(const char* sClassName) const;
/// returns a list of all registered producer
std::list<std::string> CanProduce() const;
/// destruction
virtual ~Factory();
FC_DISABLE_COPY_MOVE(Factory)
protected:
/// produce a class with the given name
void* Produce(const char* sClassName) const;
std::map<const std::string, AbstractProducer*> _mpcProducers;
/// construction
Factory() = default;
/// destruction
virtual ~Factory();
std::map<const std::string, AbstractProducer*> _mpcProducers;
};
// --------------------------------------------------------------------
/** The ScriptFactorySingleton singleton
*/
class BaseExport ScriptFactorySingleton: public Factory
class BaseExport ScriptFactorySingleton: public Factory // NOLINT
{
public:
static ScriptFactorySingleton& Instance();
@@ -85,9 +90,12 @@ public:
const char* ProduceScript(const char* sScriptName) const;
private:
static ScriptFactorySingleton* _pcSingleton;
FC_DISABLE_COPY_MOVE(ScriptFactorySingleton)
private:
static ScriptFactorySingleton* _pcSingleton; // NOLINT
protected:
ScriptFactorySingleton() = default;
~ScriptFactorySingleton() override = default;
};
@@ -118,9 +126,12 @@ public:
/// Produce an instance
void* Produce() const override
{
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
return const_cast<char*>(mScript);
}
FC_DISABLE_COPY_MOVE(ScriptProducer)
private:
const char* mScript;
};

View File

@@ -401,7 +401,9 @@ bool FileInfo::isFile() const
}
return ok;
#else
struct stat st;
// clang-format off
struct stat st {};
// clang-format on
if (stat(FileName.c_str(), &st) != 0) {
return false;
}

View File

@@ -38,12 +38,19 @@ using namespace Base;
*/
ClassTemplate::ClassTemplate() = default;
ClassTemplate::ClassTemplate(const ClassTemplate&) = default;
ClassTemplate::ClassTemplate(ClassTemplate&&) = default;
/**
* A destructor.
* A more elaborate description of the destructor.
*/
ClassTemplate::~ClassTemplate() = default;
ClassTemplate& ClassTemplate::operator=(const ClassTemplate&) = default;
ClassTemplate& ClassTemplate::operator=(ClassTemplate&&) = default;
//**************************************************************************
// separator for other implementation aspects

View File

@@ -86,9 +86,13 @@ class BaseExport ClassTemplate
public:
/// Construction
ClassTemplate();
ClassTemplate(const ClassTemplate&);
ClassTemplate(ClassTemplate&&);
/// Destruction
virtual ~ClassTemplate();
ClassTemplate& operator=(const ClassTemplate&);
ClassTemplate& operator=(ClassTemplate&&);
int testMe(int a, const char* s);
/**

View File

@@ -148,7 +148,7 @@ Py::Object Vector2dPy::repr()
str << static_cast<std::string>(vx.repr()) << ", " << static_cast<std::string>(vy.repr());
str << ")";
return Py::String(str.str());
return Py::String(str.str()); // NOLINT
}
Py::Object Vector2dPy::getattro(const Py::String& name_)
@@ -162,13 +162,13 @@ Py::Object Vector2dPy::getattro(const Py::String& name_)
Py::Dict attr;
attr.setItem(Py::String("x"), Py::Float(v.x));
attr.setItem(Py::String("y"), Py::Float(v.y));
return attr;
return attr; // NOLINT
}
if (name == "x") {
return Py::Float(v.x);
return Py::Float(v.x); // NOLINT
}
if (name == "y") {
return Py::Float(v.y);
return Py::Float(v.y); // NOLINT
}
return genericGetAttro(name_);
@@ -192,17 +192,17 @@ int Vector2dPy::setattro(const Py::String& name_, const Py::Object& value)
Py::Object Vector2dPy::number_negative()
{
return create(-v.x, -v.y);
return create(-v.x, -v.y); // NOLINT
}
Py::Object Vector2dPy::number_positive()
{
return create(v.x, v.y);
return create(v.x, v.y); // NOLINT
}
Py::Object Vector2dPy::number_absolute()
{
return create(fabs(v.x), fabs(v.y));
return create(fabs(v.x), fabs(v.y)); // NOLINT
}
Py::Object Vector2dPy::number_invert()
@@ -224,14 +224,14 @@ Py::Object Vector2dPy::number_add(const Py::Object& py)
{
Vector2d vec(Py::toVector2d(py));
vec = v + vec;
return create(vec);
return create(vec); // NOLINT
}
Py::Object Vector2dPy::number_subtract(const Py::Object& py)
{
Vector2d vec(Py::toVector2d(py));
vec = v - vec;
return create(vec);
return create(vec); // NOLINT
}
Py::Object Vector2dPy::number_multiply(const Py::Object& py)
@@ -239,11 +239,11 @@ Py::Object Vector2dPy::number_multiply(const Py::Object& py)
if (PyObject_TypeCheck(py.ptr(), Vector2dPy::type_object())) {
Vector2d vec(Py::toVector2d(py));
double scalar = v * vec;
return Py::Float(scalar);
return Py::Float(scalar); // NOLINT
}
if (py.isNumeric()) {
double scale = static_cast<double>(Py::Float(py));
return create(v * scale);
return create(v * scale); // NOLINT
}
throw Py::TypeError("Argument must be Vector2d or Float");
@@ -295,25 +295,25 @@ Py::Object Vector2dPy::isNull(const Py::Tuple& args)
if (args.size() > 0) {
tol = static_cast<double>(Py::Float(args[0]));
}
return Py::Boolean(v.IsNull(tol));
return Py::Boolean(v.IsNull(tol)); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, isNull)
Py::Object Vector2dPy::length(const Py::Tuple&)
{
return Py::Float(v.Length());
return Py::Float(v.Length()); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, length)
Py::Object Vector2dPy::atan2(const Py::Tuple&)
{
return Py::Float(v.Angle());
return Py::Float(v.Angle()); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, atan2)
Py::Object Vector2dPy::square(const Py::Tuple&)
{
return Py::Float(v.Sqr());
return Py::Float(v.Sqr()); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, square)
@@ -344,14 +344,14 @@ Py::Object Vector2dPy::perpendicular(const Py::Tuple& args)
{
bool value = static_cast<bool>(Py::Boolean(args[0]));
Base::Vector2d pnt = v.Perpendicular(value);
return create(pnt);
return create(pnt); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, perpendicular)
Py::Object Vector2dPy::distance(const Py::Tuple& args)
{
Base::Vector2d pnt = Py::toVector2d(args[0]);
return Py::Float(pnt.Distance(v));
return Py::Float(pnt.Distance(v)); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, distance)
@@ -359,14 +359,14 @@ Py::Object Vector2dPy::isEqual(const Py::Tuple& args)
{
Base::Vector2d pnt = Py::toVector2d(args[0]);
double tol = static_cast<double>(Py::Float(args[1]));
return Py::Boolean(v.IsEqual(pnt, tol));
return Py::Boolean(v.IsEqual(pnt, tol)); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, isEqual)
Py::Object Vector2dPy::getAngle(const Py::Tuple& args)
{
Base::Vector2d vec = Py::toVector2d(args[0]);
return Py::Float(v.GetAngle(vec));
return Py::Float(v.GetAngle(vec)); // NOLINT
}
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, getAngle)

View File

@@ -236,7 +236,8 @@ public:
}
GeometryT& operator=(const Object& rhs)
{
return (*this = *rhs);
*this = *rhs;
return *this;
}
GeometryT& operator=(PyObject* rhsp)
{

View File

@@ -63,7 +63,9 @@ public:
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
StdInputStream(const StdInputStream&) = delete;
StdInputStream(StdInputStream&&) = delete;
StdInputStream& operator=(const StdInputStream&) = delete;
StdInputStream& operator=(StdInputStream&&) = delete;
private:
// -----------------------------------------------------------------------
@@ -91,7 +93,9 @@ public:
XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream* makeStream() const override;
StdInputSource(const StdInputSource&) = delete;
StdInputSource(StdInputSource&&) = delete;
StdInputSource& operator=(const StdInputSource&) = delete;
StdInputSource& operator=(StdInputSource&&) = delete;
private:
std::istream& stream;

View File

@@ -303,7 +303,7 @@ std::string InterpreterSingleton::runStringWithKey(const char* psCmd,
Py::Object key_return_value = localDictionary.getItem(key);
if (!key_return_value.isString()) {
key_return_value = key_return_value.str();
key_return_value = key_return_value.str(); // NOLINT
}
Py::Bytes str = Py::String(key_return_value).encode("utf-8", "~E~");

View File

@@ -96,8 +96,12 @@ public:
/// constructor does the whole job
PyException();
PyException(const Py::Object& obj);
PyException(const PyException&) = default;
PyException(PyException&&) = default;
~PyException() noexcept override;
PyException& operator=(const PyException&) = default;
PyException& operator=(PyException&&) = default;
void raiseException();
/// this method determines if the original exception
@@ -122,7 +126,7 @@ public:
/// Sets the Python error indicator and an error message
void setPyException() const override;
protected:
private:
std::string _stackTrace;
std::string _errorType;
PyObject* _exceptionType;
@@ -155,7 +159,11 @@ class BaseExport SystemExitException: public Exception
{
public:
SystemExitException();
SystemExitException(const SystemExitException&) = default;
SystemExitException(SystemExitException&&) = default;
~SystemExitException() noexcept override = default;
SystemExitException& operator=(const SystemExitException&) = default;
SystemExitException& operator=(SystemExitException&&) = default;
long getExitCode() const
{
return _exitCode;
@@ -177,13 +185,18 @@ class BaseExport PyGILStateLocker
public:
PyGILStateLocker()
{
gstate = PyGILState_Ensure();
gstate = PyGILState_Ensure(); // NOLINT
}
~PyGILStateLocker()
{
PyGILState_Release(gstate);
}
PyGILStateLocker(const PyGILStateLocker&) = delete;
PyGILStateLocker(PyGILStateLocker&&) = delete;
PyGILStateLocker& operator=(const PyGILStateLocker&) = delete;
PyGILStateLocker& operator=(PyGILStateLocker&&) = delete;
private:
PyGILState_STATE gstate;
};
@@ -203,7 +216,7 @@ public:
PyGILStateRelease()
{
// release the global interpreter lock
state = PyEval_SaveThread();
state = PyEval_SaveThread(); // NOLINT
}
~PyGILStateRelease()
{
@@ -211,6 +224,11 @@ public:
PyEval_RestoreThread(state);
}
PyGILStateRelease(const PyGILStateRelease&) = delete;
PyGILStateRelease(PyGILStateRelease&&) = delete;
PyGILStateRelease& operator=(const PyGILStateRelease&) = delete;
PyGILStateRelease& operator=(PyGILStateRelease&&) = delete;
private:
PyThreadState* state;
};
@@ -226,6 +244,11 @@ public:
InterpreterSingleton();
~InterpreterSingleton();
InterpreterSingleton(const InterpreterSingleton&) = delete;
InterpreterSingleton(InterpreterSingleton&&) = delete;
InterpreterSingleton& operator=(const InterpreterSingleton&) = delete;
InterpreterSingleton& operator=(InterpreterSingleton&&) = delete;
/** @name execution methods
*/
//@{

View File

@@ -969,8 +969,7 @@ std::array<Matrix4D, 4> Matrix4D::decompose() const
std::array<Vector3d, 3> dirs = {Vector3d(1., 0., 0.),
Vector3d(0., 1., 0.),
Vector3d(0., 0., 1.)};
int i;
for (i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
if (residualMatrix.getCol(i).IsNull()) {
continue;
}
@@ -1032,7 +1031,7 @@ std::array<Matrix4D, 4> Matrix4D::decompose() const
// Restore trace in shear matrix
residualMatrix.setDiagonal(Vector3d(1.0, 1.0, 1.0));
// Remove values close to zero
for (i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
if (std::abs(scaleMatrix.dMtrx4D[i][i]) < 1e-15) {
scaleMatrix.dMtrx4D[i][i] = 0.0;
}

View File

@@ -90,6 +90,9 @@ public:
{
return nullptr;
}
protected:
FC_DEFAULT_COPY_MOVE(Observer)
};
/** Subject class
@@ -225,8 +228,10 @@ public:
_ObserverSet.clear();
}
protected:
FC_DEFAULT_COPY_MOVE(Subject)
private:
/// Vector of attached observers
std::set<Observer<MsgType>*> _ObserverSet;
};

View File

@@ -76,14 +76,6 @@ using namespace Base;
class DOMTreeErrorReporter: public ErrorHandler
{
public:
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
DOMTreeErrorReporter() = default;
~DOMTreeErrorReporter() override = default;
// -----------------------------------------------------------------------
// Implementation of the error handler interface
// -----------------------------------------------------------------------
@@ -131,10 +123,13 @@ public:
// unimplemented copy ctor and assignment operator
DOMPrintFilter(const DOMPrintFilter&) = delete;
DOMPrintFilter(DOMPrintFilter&&) = delete;
DOMPrintFilter& operator=(const DOMPrintFilter&) = delete;
DOMPrintFilter& operator=(DOMPrintFilter&&) = delete;
ShowType fWhatToShow;
};
class DOMPrintErrorHandler: public DOMErrorHandler
{
public:
@@ -147,8 +142,10 @@ public:
{}
/* Unimplemented constructors and operators */
explicit DOMPrintErrorHandler(const DOMErrorHandler&) = delete;
void operator=(const DOMErrorHandler&) = delete;
DOMPrintErrorHandler(const DOMPrintErrorHandler&) = delete;
DOMPrintErrorHandler(DOMPrintErrorHandler&&) = delete;
void operator=(const DOMPrintErrorHandler&) = delete;
void operator=(DOMPrintErrorHandler&&) = delete;
};

View File

@@ -94,6 +94,11 @@ class ParameterManager;
class BaseExport ParameterGrp: public Base::Handled, public Base::Subject<const char*>
{
public:
ParameterGrp(const ParameterGrp&) = delete;
ParameterGrp(ParameterGrp&&) = delete;
ParameterGrp& operator=(const ParameterGrp&) = delete;
ParameterGrp& operator=(ParameterGrp&&) = delete;
/** @name copy and insertation */
//@{
/// make a deep copy to the other group
@@ -346,7 +351,9 @@ protected:
class BaseExport ParameterSerializer
{
public:
ParameterSerializer(const std::string& fn);
explicit ParameterSerializer(const std::string& fn);
ParameterSerializer(const ParameterSerializer&) = delete;
ParameterSerializer(ParameterSerializer&&) = delete;
virtual ~ParameterSerializer();
virtual void SaveDocument(const ParameterManager&);
@@ -357,7 +364,10 @@ public:
return filename;
}
protected:
ParameterSerializer& operator=(const ParameterSerializer&) = delete;
ParameterSerializer& operator=(ParameterSerializer&&) = delete;
private:
std::string filename;
};
@@ -446,7 +456,14 @@ private:
private:
ParameterManager();
public:
~ParameterManager() override;
ParameterManager(const ParameterManager&) = delete;
ParameterManager(ParameterManager&&) = delete;
ParameterManager& operator=(const ParameterManager&) = delete;
ParameterManager& operator=(ParameterManager&&) = delete;
};
/** python wrapper function

View File

@@ -46,7 +46,7 @@
namespace Base
{
class ParameterGrpObserver: public ParameterGrp::ObserverType
class ParameterGrpObserver: public ParameterGrp::ObserverType // NOLINT
{
public:
explicit ParameterGrpObserver(const Py::Object& obj)
@@ -100,7 +100,7 @@ private:
using ParameterGrpObserverList = std::list<ParameterGrpObserver*>;
class ParameterGrpPy: public Py::PythonExtension<ParameterGrpPy>
class ParameterGrpPy: public Py::PythonExtension<ParameterGrpPy> // NOLINT
{
public:
static void init_type(); // announce properties and methods
@@ -267,7 +267,7 @@ Py::Object ParameterGrpPy::repr()
{
std::stringstream s;
s << "<ParameterGrp at " << this << ">";
return Py::String(s.str());
return Py::String(s.str()); // NOLINT
}
Py::Object ParameterGrpPy::importFrom(const Py::Tuple& args)
@@ -372,7 +372,7 @@ Py::Object ParameterGrpPy::getGroupName(const Py::Tuple& args)
// get the Handle of the wanted group
std::string name = _cParamGrp->GetGroupName();
return Py::String(name);
return Py::String(name); // NOLINT
}
Py::Object ParameterGrpPy::getGroups(const Py::Tuple& args)
@@ -388,7 +388,7 @@ Py::Object ParameterGrpPy::getGroups(const Py::Tuple& args)
list.append(Py::String(it->GetGroupName()));
}
return list;
return list; // NOLINT
}
Py::Object ParameterGrpPy::setBool(const Py::Tuple& args)
@@ -411,7 +411,7 @@ Py::Object ParameterGrpPy::getBool(const Py::Tuple& args)
throw Py::Exception();
}
return Py::Boolean(_cParamGrp->GetBool(pstr, Bool != 0));
return Py::Boolean(_cParamGrp->GetBool(pstr, Bool != 0)); // NOLINT
}
Py::Object ParameterGrpPy::getBools(const Py::Tuple& args)
@@ -427,7 +427,7 @@ Py::Object ParameterGrpPy::getBools(const Py::Tuple& args)
list.append(Py::String(it.first));
}
return list;
return list; // NOLINT
}
Py::Object ParameterGrpPy::setInt(const Py::Tuple& args)
@@ -449,7 +449,7 @@ Py::Object ParameterGrpPy::getInt(const Py::Tuple& args)
if (!PyArg_ParseTuple(args.ptr(), "s|i", &pstr, &Int)) {
throw Py::Exception();
}
return Py::Long(_cParamGrp->GetInt(pstr, Int));
return Py::Long(_cParamGrp->GetInt(pstr, Int)); // NOLINT
}
Py::Object ParameterGrpPy::getInts(const Py::Tuple& args)
@@ -465,7 +465,7 @@ Py::Object ParameterGrpPy::getInts(const Py::Tuple& args)
list.append(Py::String(it.first));
}
return list;
return list; // NOLINT
}
Py::Object ParameterGrpPy::setUnsigned(const Py::Tuple& args)
@@ -487,7 +487,7 @@ Py::Object ParameterGrpPy::getUnsigned(const Py::Tuple& args)
if (!PyArg_ParseTuple(args.ptr(), "s|I", &pstr, &UInt)) {
throw Py::Exception();
}
return Py::Long(_cParamGrp->GetUnsigned(pstr, UInt));
return Py::Long(_cParamGrp->GetUnsigned(pstr, UInt)); // NOLINT
}
Py::Object ParameterGrpPy::getUnsigneds(const Py::Tuple& args)
@@ -503,7 +503,7 @@ Py::Object ParameterGrpPy::getUnsigneds(const Py::Tuple& args)
list.append(Py::String(it.first));
}
return list;
return list; // NOLINT
}
Py::Object ParameterGrpPy::setFloat(const Py::Tuple& args)
@@ -526,7 +526,7 @@ Py::Object ParameterGrpPy::getFloat(const Py::Tuple& args)
throw Py::Exception();
}
return Py::Float(_cParamGrp->GetFloat(pstr, Float));
return Py::Float(_cParamGrp->GetFloat(pstr, Float)); // NOLINT
}
Py::Object ParameterGrpPy::getFloats(const Py::Tuple& args)
@@ -542,7 +542,7 @@ Py::Object ParameterGrpPy::getFloats(const Py::Tuple& args)
list.append(Py::String(it.first));
}
return list;
return list; // NOLINT
}
Py::Object ParameterGrpPy::setString(const Py::Tuple& args)
@@ -565,7 +565,7 @@ Py::Object ParameterGrpPy::getString(const Py::Tuple& args)
throw Py::Exception();
}
return Py::String(_cParamGrp->GetASCII(pstr, str));
return Py::String(_cParamGrp->GetASCII(pstr, str)); // NOLINT
}
Py::Object ParameterGrpPy::getStrings(const Py::Tuple& args)
@@ -581,7 +581,7 @@ Py::Object ParameterGrpPy::getStrings(const Py::Tuple& args)
list.append(Py::String(it.first));
}
return list;
return list; // NOLINT
}
Py::Object ParameterGrpPy::remInt(const Py::Tuple& args)
@@ -666,7 +666,7 @@ Py::Object ParameterGrpPy::isEmpty(const Py::Tuple& args)
throw Py::Exception();
}
return Py::Boolean(_cParamGrp->IsEmpty());
return Py::Boolean(_cParamGrp->IsEmpty()); // NOLINT
}
Py::Object ParameterGrpPy::hasGroup(const Py::Tuple& args)
@@ -676,7 +676,7 @@ Py::Object ParameterGrpPy::hasGroup(const Py::Tuple& args)
throw Py::Exception();
}
return Py::Boolean(_cParamGrp->HasGroup(pstr));
return Py::Boolean(_cParamGrp->HasGroup(pstr)); // NOLINT
}
Py::Object ParameterGrpPy::attach(const Py::Tuple& args)
@@ -870,7 +870,7 @@ Py::Object ParameterGrpPy::getContents(const Py::Tuple& args)
list.append(t6);
}
return list;
return list; // NOLINT
}
} // namespace Base

View File

@@ -24,6 +24,7 @@
#define BASE_PYOBJECTBASE_H
// clang-format off
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
// Std. configurations
// (re-)defined in pyconfig.h
@@ -556,6 +557,7 @@ inline void PyTypeCheck(PyObject** ptr, int (*method)(PyObject*), const char* ms
} // namespace Base
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
// clang-format on
#endif // BASE_PYOBJECTBASE_H

View File

@@ -81,39 +81,6 @@ Rotation::Rotation(const Vector3d& rotateFrom, const Vector3d& rotateTo)
this->setValue(rotateFrom, rotateTo);
}
Rotation::Rotation(const Rotation& rot)
: Rotation()
{
this->quat[0] = rot.quat[0];
this->quat[1] = rot.quat[1];
this->quat[2] = rot.quat[2];
this->quat[3] = rot.quat[3];
this->_axis[0] = rot._axis[0];
this->_axis[1] = rot._axis[1];
this->_axis[2] = rot._axis[2];
this->_angle = rot._angle;
}
Rotation& Rotation::operator=(const Rotation& rot)
{
if (this == &rot) {
return *this;
}
this->quat[0] = rot.quat[0];
this->quat[1] = rot.quat[1];
this->quat[2] = rot.quat[2];
this->quat[3] = rot.quat[3];
this->_axis[0] = rot._axis[0];
this->_axis[1] = rot._axis[1];
this->_axis[2] = rot._axis[2];
this->_angle = rot._angle;
return *this;
}
const double* Rotation::getValue() const
{
return &this->quat[0];

View File

@@ -46,7 +46,9 @@ public:
Rotation(const double q[4]);
Rotation(double q0, double q1, double q2, double q3);
Rotation(const Vector3d& rotateFrom, const Vector3d& rotateTo);
Rotation(const Rotation& rot);
Rotation(const Rotation& rot) = default;
Rotation(Rotation&& rot) = default;
~Rotation() = default;
//@}
/** Methods to get or set rotations. */
@@ -141,7 +143,8 @@ public:
{
return quat[usIndex];
}
Rotation& operator=(const Rotation&);
Rotation& operator=(const Rotation&) = default;
Rotation& operator=(Rotation&&) = default;
Rotation& multRight(const Base::Rotation& q);
Rotation& multLeft(const Base::Rotation& q);

View File

@@ -126,6 +126,8 @@ public:
* @see Sequencer
*/
static SequencerBase& Instance();
/** Destruction */
virtual ~SequencerBase();
/**
* Returns true if the running sequencer is blocking any user input.
* This might be only of interest of the GUI where the progress bar or dialog
@@ -205,9 +207,9 @@ protected:
/** construction */
SequencerBase();
SequencerBase(const SequencerBase&) = default;
SequencerBase(SequencerBase&&) = default;
SequencerBase& operator=(const SequencerBase&) = default;
/** Destruction */
virtual ~SequencerBase();
SequencerBase& operator=(SequencerBase&&) = default;
/**
* Sets a text what the pending operation is doing. The default implementation
* does nothing.
@@ -375,7 +377,9 @@ public:
bool wasCanceled() const;
SequencerLauncher(const SequencerLauncher&) = delete;
SequencerLauncher(SequencerLauncher&&) = delete;
void operator=(const SequencerLauncher&) = delete;
void operator=(SequencerLauncher&&) = delete;
};
/** Access to the only SequencerBase instance */

View File

@@ -58,8 +58,9 @@ TimeInfo::~TimeInfo() = default;
void TimeInfo::setCurrent()
{
// clang-format off
#if defined(FC_OS_BSD) || defined(FC_OS_LINUX) || defined(__MINGW32__)
struct timeval tv;
struct timeval tv {};
gettimeofday(&tv, nullptr);
timebuffer.time = tv.tv_sec;
timebuffer.millitm = tv.tv_usec / 1000;
@@ -68,6 +69,7 @@ void TimeInfo::setCurrent()
#else
ftime(&timebuffer); // deprecated
#endif
// clang-format on
}
void TimeInfo::setTime_t(int64_t seconds)

View File

@@ -60,8 +60,9 @@ public:
/// Construction
TimeInfo();
TimeInfo(const TimeInfo&) = default;
TimeInfo(TimeInfo&&) = default;
/// Destruction
virtual ~TimeInfo();
~TimeInfo();
/// sets the object to the actual system time
void setCurrent();
@@ -70,7 +71,8 @@ public:
int64_t getSeconds() const;
unsigned short getMiliseconds() const;
void operator=(const TimeInfo& time);
TimeInfo& operator=(const TimeInfo& time) = default;
TimeInfo& operator=(TimeInfo&& time) = default;
bool operator==(const TimeInfo& time) const;
bool operator!=(const TimeInfo& time) const;
@@ -85,12 +87,14 @@ public:
bool isNull() const;
static TimeInfo null();
protected:
private:
// clang-format off
#if defined(_MSC_VER)
struct _timeb timebuffer;
#elif defined(__GNUC__)
struct timeb timebuffer;
struct timeb timebuffer {};
#endif
// clang-format on
};
@@ -110,11 +114,6 @@ inline bool TimeInfo::operator!=(const TimeInfo& time) const
|| timebuffer.millitm != time.timebuffer.millitm);
}
inline void TimeInfo::operator=(const TimeInfo& time)
{
timebuffer = time.timebuffer;
}
inline bool TimeInfo::operator==(const TimeInfo& time) const
{
return (timebuffer.time == time.timebuffer.time

View File

@@ -156,6 +156,11 @@ public:
int elapsed();
std::string toString(int ms) const;
StopWatch(const StopWatch&) = delete;
StopWatch(StopWatch&&) = delete;
StopWatch& operator=(const StopWatch&) = delete;
StopWatch& operator=(StopWatch&&) = delete;
private:
struct Private;
Private* d;

View File

@@ -24,6 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#include <array>
#include <cstdlib>
#include <set>
#endif
@@ -302,7 +303,7 @@ bool Polygon2d::Contains(const Vector2d& rclV) const
// Using the number of turns method, determines
// whether a point is contained within a polygon.
// The sum of all turns indicates whether yes or no.
std::array<double, 4> pfTmp;
std::array<double, 4> pfTmp {};
unsigned long i = 0;
short sTorsion = 0;

View File

@@ -119,12 +119,7 @@ Unit::Unit() //NOLINT
Sig.Angle = 0;
}
Unit::Unit(const Unit& that)
{
this->Sig = that.Sig;
}
Unit::Unit(const QString& expr)
Unit::Unit(const QString& expr) // NOLINT
{
try {
*this = Quantity::parse(expr).getUnit();
@@ -242,20 +237,6 @@ Unit Unit::operator /(const Unit &right) const
return result;
}
Unit& Unit::operator = (const Unit &New)
{
Sig.Length = New.Sig.Length;
Sig.Mass = New.Sig.Mass;
Sig.Time = New.Sig.Time;
Sig.ElectricCurrent = New.Sig.ElectricCurrent;
Sig.ThermodynamicTemperature = New.Sig.ThermodynamicTemperature;
Sig.AmountOfSubstance = New.Sig.AmountOfSubstance;
Sig.LuminousIntensity = New.Sig.LuminousIntensity;
Sig.Angle = New.Sig.Angle;
return *this;
}
QString Unit::getString() const
{
std::stringstream ret;

View File

@@ -70,7 +70,8 @@ public:
int8_t LuminousIntensity = 0,
int8_t Angle = 0);
Unit();
Unit(const Unit&);
Unit(const Unit&) = default;
Unit(Unit&&) = default;
explicit Unit(const QString& expr);
/// Destruction
~Unit() = default;
@@ -87,7 +88,8 @@ public:
{
return !(*this == that);
}
Unit& operator=(const Unit&);
Unit& operator=(const Unit&) = default;
Unit& operator=(Unit&&) = default;
Unit pow(double exp) const;
//@}
/// get the unit signature
@@ -171,7 +173,7 @@ public:
static Unit InverseVolume;
//@}
protected:
private:
UnitSignature Sig;
};

View File

@@ -56,6 +56,11 @@ enum class UnitSystem
class UnitsSchema
{
public:
UnitsSchema() = default;
UnitsSchema(const UnitsSchema&) = default;
UnitsSchema(UnitsSchema&&) = default;
UnitsSchema& operator=(const UnitsSchema&) = default;
UnitsSchema& operator=(UnitsSchema&&) = default;
virtual ~UnitsSchema() = default;
/** Gets called if this schema gets activated.
* Here it's theoretically possible that you can change the static factors

View File

@@ -261,7 +261,7 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant,
// Process into string. Start with negative sign if quantity is less
// than zero
char plusOrMinus;
char plusOrMinus {};
if (quant.getValue() < 0) {
output << "-";
plusOrMinus = '-';

View File

@@ -43,7 +43,9 @@ public:
/// Construction
Uuid();
Uuid(const Uuid&) = default;
Uuid(Uuid&&) = default;
Uuid& operator=(const Uuid&) = default;
Uuid& operator=(Uuid&&) = default;
/// Destruction
virtual ~Uuid();

View File

@@ -38,7 +38,9 @@ class BaseExport ViewProjMethod
{
public:
ViewProjMethod(const ViewProjMethod&) = default;
ViewProjMethod(ViewProjMethod&&) = default;
ViewProjMethod& operator=(const ViewProjMethod&) = default;
ViewProjMethod& operator=(ViewProjMethod&&) = default;
virtual ~ViewProjMethod() = default;
virtual bool isValid() const;
@@ -87,7 +89,7 @@ public:
Matrix4D getProjectionMatrix() const override;
protected:
private:
bool isOrthographic;
Matrix4D _clMtx, _clMtxInv;
};
@@ -110,7 +112,7 @@ public:
Matrix4D getProjectionMatrix() const override;
protected:
private:
Matrix4D _clMtx, _clMtxInv;
};

View File

@@ -143,6 +143,7 @@ public:
/// Return the current character output stream
std::ostream& charStream();
// NOLINTBEGIN
/// name for underlying file saves
std::string ObjectName;
@@ -163,10 +164,13 @@ protected:
bool forceXML {false};
int fileVersion {1};
// NOLINTEND
public:
Writer(const Writer&) = delete;
Writer(Writer&&) = delete;
Writer& operator=(const Writer&) = delete;
Writer& operator=(Writer&&) = delete;
private:
std::unique_ptr<std::ostream> CharStream;
@@ -207,6 +211,11 @@ public:
ZipStream.putNextEntry(str);
}
ZipWriter(const ZipWriter&) = delete;
ZipWriter(ZipWriter&&) = delete;
ZipWriter& operator=(const ZipWriter&) = delete;
ZipWriter& operator=(ZipWriter&&) = delete;
private:
zipios::ZipOutputStream ZipStream;
};
@@ -265,9 +274,16 @@ public:
*/
virtual bool shouldWrite(const std::string& name, const Base::Persistence* Object) const;
FileWriter(const FileWriter&) = delete;
FileWriter(FileWriter&&) = delete;
FileWriter& operator=(const FileWriter&) = delete;
FileWriter& operator=(FileWriter&&) = delete;
protected:
// NOLINTBEGIN
std::string DirName;
std::ofstream FileStream;
// NOLINTEND
};

View File

@@ -48,7 +48,7 @@ public:
static void terminate();
private:
static std::unique_ptr<XERCES_CPP_NAMESPACE::XMLTranscoder> transcoder;
static std::unique_ptr<XERCES_CPP_NAMESPACE::XMLTranscoder> transcoder; // NOLINT
};
//**************************************************************************
@@ -64,6 +64,7 @@ public:
/// Getter method
const char* c_str() const;
FC_DISABLE_COPY_MOVE(StrX)
private:
// This is the local code page form of the string.
@@ -143,12 +144,12 @@ class XStr
public:
/// Constructors and Destructor
XStr(const char* const toTranscode);
///
~XStr();
/// Getter method
const XMLCh* unicodeForm() const;
FC_DISABLE_COPY_MOVE(XStr)
private:
/// This is the Unicode XMLCh format of the string.
@@ -189,6 +190,8 @@ public:
/// Getter method
const XMLCh* unicodeForm() const;
FC_DISABLE_COPY_MOVE(XUTF8Str)
private:
std::basic_string<XMLCh> str;
};

View File

@@ -57,8 +57,6 @@ public:
/** Create a copy of this instance. */
FileCollection* clone() const override;
~ZipHeader() override = default;
void close() override;
std::istream* getInputStream(const ConstEntryPointer& entry) override;

View File

@@ -59,4 +59,34 @@
# define GuiExport FREECAD_DECL_IMPORT
#endif
// Disable copy/move
#define FC_DISABLE_COPY(Class) \
Class(const Class &) = delete;\
Class &operator=(const Class &) = delete;
#define FC_DISABLE_MOVE(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#define FC_DISABLE_COPY_MOVE(Class) \
FC_DISABLE_COPY(Class) \
FC_DISABLE_MOVE(Class)
// Default copy/move
#define FC_DEFAULT_COPY(Class) \
Class(const Class &) = default;\
Class &operator=(const Class &) = default;
#define FC_DEFAULT_MOVE(Class) \
Class(Class &&) = default; \
Class &operator=(Class &&) = default;
#define FC_DEFAULT_COPY_MOVE(Class) \
FC_DEFAULT_COPY(Class) \
FC_DEFAULT_MOVE(Class)
#ifndef Q_DISABLE_COPY_MOVE
#define Q_DISABLE_COPY_MOVE FC_DEFAULT_COPY_MOVE
#endif
#endif //FC_GLOBAL_H