mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-08 16:59:59 +01:00
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:
36
Source.cpp
36
Source.cpp
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user