forked from qt-creator/qt-creator
It is very often a mistake to define a destructor without a copy (and move) constructor and assignment operator. In C++11 no move constructor and assignment operator will be generated if a destructor is defined. So it is better to omit a lonely destructor in out template. https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29 Change-Id: If911556f872d878939f0f2fcaa974494a4df8a8a Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
42 lines
838 B
C++
42 lines
838 B
C++
%{Cpp:LicenseTemplate}\
|
|
#include "%{HdrFileName}"
|
|
%{JS: Cpp.openNamespaces('%{Class}')}
|
|
@if '%{IncludeQSharedData}'
|
|
class %{CN}Data : public QSharedData
|
|
{
|
|
public:
|
|
|
|
};
|
|
|
|
@endif
|
|
@if '%{Base}' === 'QObject'
|
|
%{CN}::%{CN}(QObject *parent) : QObject(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''}
|
|
@elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow'
|
|
%{CN}::%{CN}(QWidget *parent) : %{Base}(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''}
|
|
@else
|
|
%{CN}::%{CN}()%{JS: ('%{SharedDataInit}') ? ' : %{SharedDataInit}' : ''}
|
|
@endif
|
|
{
|
|
|
|
}
|
|
@if '%{IncludeQSharedData}'
|
|
|
|
%{CN}::%{CN}(const %{CN} &rhs) : data(rhs.data)
|
|
{
|
|
|
|
}
|
|
|
|
%{CN} &%{CN}::operator=(const %{CN} &rhs)
|
|
{
|
|
if (this != &rhs)
|
|
data.operator=(rhs.data);
|
|
return *this;
|
|
}
|
|
|
|
%{CN}::~%{CN}()
|
|
{
|
|
|
|
}
|
|
@endif
|
|
%{JS: Cpp.closeNamespaces('%{Class}')}\
|