forked from qt-creator/qt-creator
Wizards: Add move semantics to shared data class template
Fixes: QTCREATORBUG-30526 Change-Id: I9a3423fcbbc19a26876bf1d6c863285639449df3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
%{JS: Cpp.licenseTemplate()}\
|
%{JS: Cpp.licenseTemplate()}\
|
||||||
#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}"
|
#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}"
|
||||||
|
|
||||||
|
@if '%{IncludeQSharedData}'
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
@endif
|
||||||
%{JS: Cpp.openNamespaces('%{Class}')}
|
%{JS: Cpp.openNamespaces('%{Class}')}
|
||||||
@if '%{IncludeQSharedData}'
|
@if '%{IncludeQSharedData}'
|
||||||
class %{CN}Data : public QSharedData
|
class %{CN}Data : public QSharedData
|
||||||
@@ -32,10 +37,23 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%{CN}::%{CN}(%{CN} &&rhs)
|
||||||
|
: data{std::move(rhs.data)}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
%{CN} &%{CN}::operator=(const %{CN} &rhs)
|
%{CN} &%{CN}::operator=(const %{CN} &rhs)
|
||||||
{
|
{
|
||||||
if (this != &rhs)
|
if (this != &rhs)
|
||||||
data.operator=(rhs.data);
|
data = rhs.data;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
%{CN} &%{CN}::operator=(%{CN} &&rhs)
|
||||||
|
{
|
||||||
|
if (this != &rhs)
|
||||||
|
data = std::move(rhs.data);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,9 @@ public:
|
|||||||
@endif
|
@endif
|
||||||
@if '%{IncludeQSharedData}'
|
@if '%{IncludeQSharedData}'
|
||||||
%{CN}(const %{CN} &);
|
%{CN}(const %{CN} &);
|
||||||
|
%{CN}(%{CN} &&);
|
||||||
%{CN} &operator=(const %{CN} &);
|
%{CN} &operator=(const %{CN} &);
|
||||||
|
%{CN} &operator=(%{CN} &&);
|
||||||
~%{CN}();
|
~%{CN}();
|
||||||
@endif
|
@endif
|
||||||
@if %{isQObject}
|
@if %{isQObject}
|
||||||
|
Reference in New Issue
Block a user