refs #937 Resolved clazy warnings: rule of three.

This commit is contained in:
Mathew Sutcliffe
2017-04-15 01:28:23 +01:00
parent 3ea9e33e6b
commit b20ebd6dfd
15 changed files with 60 additions and 13 deletions

View File

@@ -42,6 +42,12 @@ namespace BlackCore
//! Signature just to set an icon for an action
CActionBind(const QString &action, const QPixmap &icon);
//! Not copyable
//! @{
CActionBind(const CActionBind &) = delete;
CActionBind &operator =(const CActionBind &) = delete;
//! @}
//! Destructor
~CActionBind();

View File

@@ -106,6 +106,9 @@ namespace BlackMisc
//! Move assignment.
CCollection &operator =(CCollection && other) noexcept(std::is_nothrow_move_assignable<T>::value) { m_pimpl.reset(other.m_pimpl.take()); return *this; }
//! Destructor.
~CCollection() = default;
//! Create a new collection with a specific implementation type.
//! \tparam C Becomes the collection's implementation type.
//! \param c Initial value for the collection; default is empty, but it could contain elements if desired. The value is copied.

View File

@@ -43,6 +43,12 @@ namespace BlackMisc
//! Delete files
void deleteFiles();
//! Not copyable.
//! @{
CFileDeleter(const CFileDeleter &) = delete;
CFileDeleter &operator =(const CFileDeleter &) = delete;
//! @}
private:
QStringList m_fileNames;
};

View File

@@ -58,6 +58,9 @@ namespace BlackMisc
return *new (this) OutputIterator(other);
}
//! Destructor.
~OutputIterator() = default;
private:
F m_func;
};
@@ -389,6 +392,9 @@ namespace BlackMisc
//! Move assignment.
ConstForwardIterator &operator =(ConstForwardIterator &&other) noexcept { m_pimpl.reset(other.m_pimpl.take()); return *this; }
//! Destructor.
~ConstForwardIterator() = default;
//! Create a new iterator with a specific implementation type.
//! \tparam I Becomes the iterator's implementation type.
//! \param i Initial value for the iterator. The value is copied.
@@ -513,6 +519,9 @@ namespace BlackMisc
//! Move assignment.
ConstRandomAccessIterator &operator =(ConstRandomAccessIterator &&other) noexcept { m_pimpl.reset(other.m_pimpl.take()); return *this; }
//! Destructor.
~ConstRandomAccessIterator() = default;
//! Create a new iterator with a specific implementation type.
//! \tparam I Becomes the iterator's implementation type.
//! \param i Initial value for the iterator. The value is copied.
@@ -693,6 +702,9 @@ namespace BlackMisc
//! Move assignment.
RandomAccessIterator &operator =(RandomAccessIterator &&other) noexcept { m_pimpl.reset(other.m_pimpl.take()); return *this; }
//! Destructor.
~RandomAccessIterator() = default;
//! Create a new iterator with a specific implementation type.
//! \tparam I Becomes the iterator's implementation type.
//! \param i Initial value for the iterator. The value is copied.

View File

@@ -82,7 +82,7 @@ namespace BlackMisc
template <typename T, std::enable_if_t<TIsOneOf<T, Ts...>::value, int> = 0>
auto maybeUnmemoize(T &member) const
{
struct Memo
struct Memo // clazy:exclude=rule-of-three
{
int index;
T &member;

View File

@@ -22,9 +22,6 @@ namespace BlackMisc
{
CUrlList::CUrlList() { }
CUrlList::CUrlList(const CUrlList &other) : CSequence<CUrl>(other)
{ }
CUrlList::CUrlList(const CSequence<CUrl> &other) :
CSequence<CUrl>(other)
{ }

View File

@@ -37,9 +37,6 @@ namespace BlackMisc
//! Default constructor.
CUrlList();
//! Copy constructor (because of mutex)
CUrlList(const CUrlList &other);
//! Construct from a base class object.
CUrlList(const CSequence<CUrl> &other);

View File

@@ -43,6 +43,9 @@ namespace BlackMisc
//! Copy assignment (because of mutex)
CPixmap &operator =(const CPixmap &other);
//! Destructor.
~CPixmap() = default;
//! Corresponding pixmap
const QPixmap &pixmap() const;

View File

@@ -84,6 +84,9 @@ namespace BlackMisc
//! Move assignment.
CSequence &operator =(CSequence && other) noexcept(std::is_nothrow_move_assignable<T>::value) { m_pimpl.reset(other.m_pimpl.take()); return *this; }
//! Destructor.
~CSequence() = default;
//! Create a new sequence with a specific implementation type.
//! \tparam C Becomes the sequence's implementation type.
//! \param c Initial value for the sequence; default is empty, but it could contain elements if desired. The value is copied.

View File

@@ -175,6 +175,9 @@ namespace BlackMisc
//! Copy assignment (because of mutex)
CStatusMessage &operator =(const CStatusMessage &other);
//! Destructor.
~CStatusMessage() = default;
//! Constructor
CStatusMessage(const QString &message);

View File

@@ -132,7 +132,7 @@ namespace BlackMisc
CVariant(const CVariant &) = default;
//! Move constructor.
CVariant(CVariant &&other) noexcept : m_v(std::move(other.m_v)) {}
CVariant(CVariant &&other) noexcept = default;
//! Construct from a QVariant.
CVariant(const QVariant &var) : m_v(var) {}
@@ -165,10 +165,10 @@ namespace BlackMisc
void reset(QVariant &&var) { m_v = std::move(var); }
//! Copy assignment operator.
CVariant &operator =(const CVariant &other) { m_v = other.m_v; return *this; }
CVariant &operator =(const CVariant &other) = default;
//! Move assignment operatior.
CVariant &operator =(CVariant && other) noexcept { m_v = std::move(other.m_v); return *this; }
CVariant &operator =(CVariant && other) noexcept = default;
//! Change the internal QVariant
CVariant &operator =(const QVariant &var) { m_v = var; return *this; }

View File

@@ -37,6 +37,12 @@ namespace XBus
XPLMUnregisterCommandHandler(m_command, callback, false, static_cast<void*>(this));
}
//! Not copyable.
//! @{
CCommand(const CCommand &) = delete;
CCommand &operator =(const CCommand &) = delete;
//! @}
private:
static int callback(XPLMCommandRef, XPLMCommandPhase phase, void *refcon)
{

View File

@@ -95,6 +95,8 @@ namespace XBus
std::unique_ptr<ItemList> items;
std::vector<CMenu> subMenus;
~Data();
Data(const Data &) = delete;
Data &operator =(const Data &) = delete;
};
std::shared_ptr<Data> m_data;
};

View File

@@ -26,6 +26,12 @@ namespace XBus
//! Destructor;
~CTerrainProbe();
//! Not copyable.
//! @{
CTerrainProbe(const CTerrainProbe &) = delete;
CTerrainProbe &operator =(const CTerrainProbe &) = delete;
//! @}
//! Get the elevation in meters at the given point in OpenGL space.
//! \note Due to the Earth's curvature, the OpenGL vertical axis may not be exactly perpendicular to the surface of the geoid.
//! \return NaN if no ground was detected.

View File

@@ -30,9 +30,6 @@
*/
class QXPlaneMessageHandler
{
QXPlaneMessageHandler();
QXPlaneMessageHandler(const QXPlaneMessageHandler &);
static void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
@@ -76,6 +73,12 @@ public:
{
qInstallMessageHandler(handler);
}
//! Not copyable.
//! @{
QXPlaneMessageHandler(const QXPlaneMessageHandler &) = delete;
QXPlaneMessageHandler &operator =(const QXPlaneMessageHandler &) = delete;
//! @}
};
/*!