mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Move assignment operators for some hot-path classes.
This commit is contained in:
parent
43a9c760b1
commit
724e44d5a0
@ -91,6 +91,12 @@ public:
|
|||||||
MAYBE_VERIFY_UTF8( c_str() );
|
MAYBE_VERIFY_UTF8( c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UTF8( const UTF8& o ) :
|
||||||
|
m_s( o.m_s )
|
||||||
|
{
|
||||||
|
MAYBE_VERIFY_UTF8( c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
UTF8()
|
UTF8()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -178,6 +184,23 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UTF8& operator=( const UTF8& aOther )
|
||||||
|
{
|
||||||
|
m_s = aOther.m_s;
|
||||||
|
MAYBE_VERIFY_UTF8( c_str() );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move assignment operator
|
||||||
|
UTF8& operator=( UTF8&& aOther ) noexcept
|
||||||
|
{
|
||||||
|
if (this != &aOther)
|
||||||
|
m_s = std::move( aOther.m_s );
|
||||||
|
|
||||||
|
MAYBE_VERIFY_UTF8( c_str() );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// a substring of a UTF8 is not necessarily a UTF8 if a multibyte character
|
// a substring of a UTF8 is not necessarily a UTF8 if a multibyte character
|
||||||
// was split, so return std::string not UTF8
|
// was split, so return std::string not UTF8
|
||||||
std::string substr( size_t pos = 0, size_t len = npos ) const
|
std::string substr( size_t pos = 0, size_t len = npos ) const
|
||||||
|
@ -250,6 +250,26 @@ public:
|
|||||||
|
|
||||||
SHAPE_LINE_CHAIN& operator=( const SHAPE_LINE_CHAIN& ) = default;
|
SHAPE_LINE_CHAIN& operator=( const SHAPE_LINE_CHAIN& ) = default;
|
||||||
|
|
||||||
|
// Move assignment operator
|
||||||
|
SHAPE_LINE_CHAIN& operator=( SHAPE_LINE_CHAIN&& aOther ) noexcept
|
||||||
|
{
|
||||||
|
if (this != &aOther)
|
||||||
|
{
|
||||||
|
SHAPE_LINE_CHAIN_BASE::operator=( aOther );
|
||||||
|
|
||||||
|
m_points = std::move( aOther.m_points );
|
||||||
|
m_shapes = std::move( aOther.m_shapes );
|
||||||
|
m_arcs = std::move( aOther.m_arcs );
|
||||||
|
|
||||||
|
m_accuracy = aOther.m_accuracy;
|
||||||
|
m_closed = aOther.m_closed;
|
||||||
|
m_width = aOther.m_width;
|
||||||
|
m_bbox = aOther.m_bbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
SHAPE* Clone() const override;
|
SHAPE* Clone() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -535,6 +535,24 @@ public:
|
|||||||
|
|
||||||
SHAPE_POLY_SET& operator=( const SHAPE_POLY_SET& aOther );
|
SHAPE_POLY_SET& operator=( const SHAPE_POLY_SET& aOther );
|
||||||
|
|
||||||
|
// Move assignment operator
|
||||||
|
SHAPE_POLY_SET& operator=( SHAPE_POLY_SET&& aOther ) noexcept
|
||||||
|
{
|
||||||
|
if (this != &aOther)
|
||||||
|
{
|
||||||
|
SHAPE::operator=( aOther );
|
||||||
|
|
||||||
|
m_polys = std::move( aOther.m_polys );
|
||||||
|
m_triangulatedPolys = std::move( aOther.m_triangulatedPolys );
|
||||||
|
|
||||||
|
m_hash = aOther.m_hash;
|
||||||
|
m_hashValid = aOther.m_hashValid;
|
||||||
|
m_triangulationValid.store( aOther.m_triangulationValid );
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a polygon triangulation, needed to draw a polygon on OpenGL and in some
|
* Build a polygon triangulation, needed to draw a polygon on OpenGL and in some
|
||||||
* other calculations
|
* other calculations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user