Making classes non-assignable

Following CppCheck recomendation, all classes that should not be manipulated by value are made non-assignable to ensure no mistake is made.
This commit is contained in:
Bruno
2021-04-18 13:04:16 +02:00
parent c6d01c1420
commit 2392d844d9
17 changed files with 83 additions and 23 deletions

View File

@@ -17,7 +17,7 @@
#include "Source.h"
SourceCore::SourceCore() : processingshader_(nullptr)
SourceCore::SourceCore()
{
// default nodes
groups_[View::RENDERING] = new Group;
@@ -40,6 +40,11 @@ SourceCore::SourceCore() : processingshader_(nullptr)
renderingshader_ = static_cast<Shader *>(new ImageShader);
}
SourceCore::SourceCore(SourceCore const& other) : SourceCore()
{
copy(other);
}
SourceCore::~SourceCore()
{
// all groups and their children are deleted in the scene
@@ -61,6 +66,22 @@ SourceCore::~SourceCore()
groups_.clear();
}
void SourceCore::copy(SourceCore const& other)
{
// copy groups properties
groups_[View::RENDERING]->copyTransform( other.group(View::RENDERING) );
groups_[View::MIXING]->copyTransform( other.group(View::MIXING) );
groups_[View::GEOMETRY]->copyTransform( other.group(View::GEOMETRY) );
groups_[View::LAYER]->copyTransform( other.group(View::LAYER) );
groups_[View::TEXTURE]->copyTransform( other.group(View::TEXTURE) );
groups_[View::TRANSITION]->copyTransform( other.group(View::TRANSITION) );
stored_status_->copyTransform( other.stored_status_ );
// copy shader properties
processingshader_->copy(*other.processingshader_);
renderingshader_->copy(*other.renderingshader_);
}
void SourceCore::store (View::Mode m)
{
stored_status_->copyTransform(groups_[m]);
@@ -69,18 +90,7 @@ void SourceCore::store (View::Mode m)
SourceCore& SourceCore::operator= (SourceCore const& other)
{
if (this != &other) { // no self assignment
// copy groups properties
groups_[View::RENDERING]->copyTransform( other.group(View::RENDERING) );
groups_[View::MIXING]->copyTransform( other.group(View::MIXING) );
groups_[View::GEOMETRY]->copyTransform( other.group(View::GEOMETRY) );
groups_[View::LAYER]->copyTransform( other.group(View::LAYER) );
groups_[View::TEXTURE]->copyTransform( other.group(View::TEXTURE) );
groups_[View::TRANSITION]->copyTransform( other.group(View::TRANSITION) );
stored_status_->copyTransform( other.stored_status_ );
// copy shader properties
processingshader_->copy(*other.processingshader_);
renderingshader_->copy(*other.renderingshader_);
copy(other);
}
return *this;
}