Refactoring.
Code style.
This commit is contained in:
parent
914a2c9d09
commit
8b29cd6b36
|
@ -29,26 +29,26 @@
|
|||
#ifndef VCONTAINER_H
|
||||
#define VCONTAINER_H
|
||||
|
||||
#include <qcompilerdetection.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QMessageLogger>
|
||||
#include <QSet>
|
||||
#include <QSharedPointer>
|
||||
#include <QSharedData>
|
||||
#include <QSharedDataPointer>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTypeInfo>
|
||||
#include <QtGlobal>
|
||||
#include <new>
|
||||
#include <qcompilerdetection.h>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../ifc/exception/vexceptionbadid.h"
|
||||
#include "../vgeometry/vabstractcubicbezierpath.h"
|
||||
#include "../vgeometry/vabstractcurve.h"
|
||||
#include "../vgeometry/vgobject.h"
|
||||
#include "../vmisc/def.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
@ -76,7 +76,6 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
|
|||
class VContainerData final : public QSharedData //-V690
|
||||
{
|
||||
public:
|
||||
|
||||
VContainerData(const VTranslateVars *trVars, const Unit *patternUnit, const QString &nspace)
|
||||
: calculationObjects(QHash<quint32, QSharedPointer<VGObject>>()),
|
||||
modelingObjects(QSharedPointer<QHash<quint32, QSharedPointer<VGObject>>>::create()),
|
||||
|
@ -86,7 +85,8 @@ public:
|
|||
trVars(trVars),
|
||||
patternUnit(patternUnit),
|
||||
nspace(nspace)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
VContainerData(const VContainerData &data)
|
||||
: QSharedData(data),
|
||||
|
@ -98,7 +98,8 @@ public:
|
|||
trVars(data.trVars),
|
||||
patternUnit(data.patternUnit),
|
||||
nspace(data.nspace)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~VContainerData();
|
||||
|
||||
|
@ -131,6 +132,7 @@ QT_WARNING_POP
|
|||
class VContainer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VContainer) // NOLINT
|
||||
|
||||
public:
|
||||
VContainer(const VTranslateVars *trVars, const Unit *patternUnit, const QString &nspace);
|
||||
VContainer(const VContainer &data);
|
||||
|
@ -141,7 +143,8 @@ public:
|
|||
auto operator=(const VContainer &data) -> VContainer &;
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
VContainer(VContainer &&data) Q_DECL_NOTHROW;
|
||||
auto operator=(VContainer &&data) Q_DECL_NOTHROW->VContainer &;
|
||||
auto operator=(VContainer &&data) Q_DECL_NOTHROW
|
||||
->VContainer &;
|
||||
#endif
|
||||
|
||||
static auto UniqueNamespace() -> QString;
|
||||
|
@ -166,27 +169,20 @@ public:
|
|||
auto AddPiece(const VPiece &detail) -> quint32;
|
||||
auto AddPiecePath(const VPiecePath &path) -> quint32;
|
||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||
void AddArc(const QSharedPointer<VAbstractCurve> &arc, const quint32 &id,
|
||||
const quint32 &parentId = NULL_ID);
|
||||
void AddArc(const QSharedPointer<VAbstractCurve> &arc, const quint32 &id, const quint32 &parentId = NULL_ID);
|
||||
void AddSpline(const QSharedPointer<VAbstractBezier> &curve, quint32 id, quint32 parentId = NULL_ID);
|
||||
void AddCurveWithSegments(const QSharedPointer<VAbstractCubicBezierPath> &curve, const quint32 &id,
|
||||
quint32 parentId = NULL_ID);
|
||||
|
||||
template <typename T>
|
||||
void AddUniqueVariable(T *var);
|
||||
template <typename T>
|
||||
void AddUniqueVariable(const QSharedPointer<T> &var);
|
||||
template <typename T>
|
||||
void AddVariable(T *var);
|
||||
template <typename T>
|
||||
void AddVariable(const QSharedPointer<T> &var);
|
||||
template <typename T> void AddUniqueVariable(T *var);
|
||||
template <typename T> void AddUniqueVariable(const QSharedPointer<T> &var);
|
||||
template <typename T> void AddVariable(T *var);
|
||||
template <typename T> void AddVariable(const QSharedPointer<T> &var);
|
||||
void RemoveVariable(const QString &name);
|
||||
void RemovePiece(quint32 id);
|
||||
|
||||
template <class T>
|
||||
void UpdateGObject(quint32 id, T* obj);
|
||||
template <class T>
|
||||
void UpdateGObject(quint32 id, const QSharedPointer<T> &obj);
|
||||
template <class T> void UpdateGObject(quint32 id, T *obj);
|
||||
template <class T> void UpdateGObject(quint32 id, const QSharedPointer<T> &obj);
|
||||
void UpdatePiece(quint32 id, const VPiece &detail);
|
||||
void UpdatePiecePath(quint32 id, const VPiecePath &path);
|
||||
|
||||
|
@ -246,8 +242,7 @@ private:
|
|||
|
||||
template <class T> auto qHash(const QSharedPointer<T> &p) -> uint;
|
||||
|
||||
template <typename T>
|
||||
void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
|
||||
template <typename T> void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
|
||||
|
||||
template <typename T> auto DataVar(const VarType &type) const -> const QMap<QString, QSharedPointer<T>>;
|
||||
|
||||
|
@ -287,7 +282,6 @@ template <typename T> auto VContainer::GeometricObject(const quint32 &id) const
|
|||
return obj;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetVariable return varible by name
|
||||
|
@ -317,15 +311,13 @@ template <typename T> auto VContainer::GetVariable(const QString &name) const ->
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void VContainer::AddUniqueVariable(T *var)
|
||||
template <typename T> void VContainer::AddUniqueVariable(T *var)
|
||||
{
|
||||
AddUniqueVariable(QSharedPointer<T>(var));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void VContainer::AddUniqueVariable(const QSharedPointer<T> &var)
|
||||
template <typename T> void VContainer::AddUniqueVariable(const QSharedPointer<T> &var)
|
||||
{
|
||||
AddVariable(var);
|
||||
|
||||
|
@ -336,15 +328,13 @@ void VContainer::AddUniqueVariable(const QSharedPointer<T> &var)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void VContainer::AddVariable(T *var)
|
||||
template <typename T> void VContainer::AddVariable(T *var)
|
||||
{
|
||||
AddVariable(QSharedPointer<T>(var));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void VContainer::AddVariable(const QSharedPointer<T> &var)
|
||||
template <typename T> void VContainer::AddVariable(const QSharedPointer<T> &var)
|
||||
{
|
||||
SCASSERT(not var->GetName().isEmpty())
|
||||
AddVariable(var, var->GetName());
|
||||
|
@ -356,8 +346,7 @@ void VContainer::AddVariable(const QSharedPointer<T> &var)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void VContainer::AddVariable(const QSharedPointer<T> &var, const QString &name)
|
||||
template <typename T> void VContainer::AddVariable(const QSharedPointer<T> &var, const QString &name)
|
||||
{
|
||||
if (name.isEmpty())
|
||||
{
|
||||
|
@ -398,16 +387,14 @@ template <class T> auto VContainer::qHash(const QSharedPointer<T> &p) -> uint
|
|||
* @param id id of existing GObject
|
||||
* @param obj object
|
||||
*/
|
||||
template <class T>
|
||||
void VContainer::UpdateGObject(quint32 id, T* obj)
|
||||
template <class T> void VContainer::UpdateGObject(quint32 id, T *obj)
|
||||
{
|
||||
SCASSERT(obj != nullptr)
|
||||
UpdateGObject(id, QSharedPointer<T>(obj));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
void VContainer::UpdateGObject(quint32 id, const QSharedPointer<T> &obj)
|
||||
template <class T> void VContainer::UpdateGObject(quint32 id, const QSharedPointer<T> &obj)
|
||||
{
|
||||
SCASSERT(not obj.isNull())
|
||||
UpdateObject(id, obj);
|
||||
|
@ -420,8 +407,7 @@ void VContainer::UpdateGObject(quint32 id, const QSharedPointer<T> &obj)
|
|||
* @param id id of existing object
|
||||
* @param point object
|
||||
*/
|
||||
template <typename T>
|
||||
void VContainer::UpdateObject(const quint32 &id, const QSharedPointer<T> &point)
|
||||
template <typename T> void VContainer::UpdateObject(const quint32 &id, const QSharedPointer<T> &point)
|
||||
{
|
||||
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||
SCASSERT(point.isNull() == false)
|
||||
|
|
Loading…
Reference in New Issue
Block a user