From da19c9882295a8f3216284935c05ad4b89c445bd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 19 Apr 2017 16:03:33 +0200 Subject: QXmlName: Add copy constructor and use default for copy/assignment Fix Clang warning: 95:15: warning: definition of implicit copy constructor for 'QXmlName' is deprecated because it has a user-declared copy assignment operator qmetatype.h:1684:83: note: in instantiation of member function 'QtMetaTypePrivate::QMetaTypeFunctionHelper::Construct' requested here qmetatype.h:1712:12: note: in instantiation of function template specialization 'qRegisterNormalizedMetaType' requested here 134:1: note: in instantiation of function template specialization 'qRegisterMetaType' requested here qmetatype.h:1848:34: note: expanded from macro 'Q_DECLARE_METATYPE' qmetatype.h:1860:35: note: expanded from macro 'Q_DECLARE_METATYPE_IMPL' qmetatype.h:765:32: note: implicit copy constructor for 'QXmlName' first required here Change-Id: I5e194201278d2a5d613eac9dc9cd7b36679697b3 Reviewed-by: Marc Mutz --- src/xmlpatterns/api/qxmlname.cpp | 14 +++++++++----- src/xmlpatterns/api/qxmlname.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/xmlpatterns/api/qxmlname.cpp b/src/xmlpatterns/api/qxmlname.cpp index 241aa5e..83b72cf 100644 --- a/src/xmlpatterns/api/qxmlname.cpp +++ b/src/xmlpatterns/api/qxmlname.cpp @@ -401,14 +401,18 @@ QString QXmlName::toClarkName(const QXmlNamePool &namePool) const return namePool.d->toClarkName(*this); } +/*! + Constructs a copy of \a other. + + \sa operator=() + \since 5.9 +*/ +QXmlName::QXmlName(const QXmlName &) = default; // ### Qt 6: remove + /*! Assigns \a other to \e this and returns \e this. */ -QXmlName &QXmlName::operator=(const QXmlName &other) -{ - m_qNameCode = other.m_qNameCode; - return *this; -} +QXmlName &QXmlName::operator=(const QXmlName &) = default; // ### Qt 6: remove /*! Returns true if \a candidate is an \c NCName. An \c NCName diff --git a/src/xmlpatterns/api/qxmlname.h b/src/xmlpatterns/api/qxmlname.h index 7dad306..0e30b4c 100644 --- a/src/xmlpatterns/api/qxmlname.h +++ b/src/xmlpatterns/api/qxmlname.h @@ -92,6 +92,7 @@ public: QString toClarkName(const QXmlNamePool &query) const; bool operator==(const QXmlName &other) const; bool operator!=(const QXmlName &other) const; + QXmlName(const QXmlName &other); QXmlName &operator=(const QXmlName &other); bool isNull() const; static bool isNCName(const QString &candidate); -- cgit v1.2.1