From ce8e6abe7fff563b11ab1e83e2bd83cbac5745f9 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 4 Sep 2012 21:10:05 +0200 Subject: Check for C++ operators that should be 'const' Make sure all C++ class comparison operators are const. Change-Id: Ib4a66f2afe6c62f437dae1ecde94287d3db8442d Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- src/corelib/mimetypes/qmimemagicrulematcher.cpp | 2 +- src/corelib/mimetypes/qmimemagicrulematcher_p.h | 2 +- src/gui/opengl/qopenglengineshadermanager_p.h | 2 +- src/sql/kernel/qsqlerror.cpp | 4 ++-- src/sql/kernel/qsqlerror.h | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/corelib/mimetypes/qmimemagicrulematcher.cpp b/src/corelib/mimetypes/qmimemagicrulematcher.cpp index cdd73076fd..4a9cd2971e 100644 --- a/src/corelib/mimetypes/qmimemagicrulematcher.cpp +++ b/src/corelib/mimetypes/qmimemagicrulematcher.cpp @@ -67,7 +67,7 @@ QMimeMagicRuleMatcher::QMimeMagicRuleMatcher(const QString &mime, unsigned thePr { } -bool QMimeMagicRuleMatcher::operator==(const QMimeMagicRuleMatcher &other) +bool QMimeMagicRuleMatcher::operator==(const QMimeMagicRuleMatcher &other) const { return m_list == other.m_list && m_priority == other.m_priority; diff --git a/src/corelib/mimetypes/qmimemagicrulematcher_p.h b/src/corelib/mimetypes/qmimemagicrulematcher_p.h index b2bb287207..e4099da3cd 100644 --- a/src/corelib/mimetypes/qmimemagicrulematcher_p.h +++ b/src/corelib/mimetypes/qmimemagicrulematcher_p.h @@ -55,7 +55,7 @@ class QMimeMagicRuleMatcher public: explicit QMimeMagicRuleMatcher(const QString &mime, unsigned priority = 65535); - bool operator==(const QMimeMagicRuleMatcher &other); + bool operator==(const QMimeMagicRuleMatcher &other) const; void addRule(const QMimeMagicRule &rule); void addRules(const QList &rules); diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h index 72ae1f9073..997a9d8e79 100644 --- a/src/gui/opengl/qopenglengineshadermanager_p.h +++ b/src/gui/opengl/qopenglengineshadermanager_p.h @@ -399,7 +399,7 @@ public: bool useOpacityAttribute; bool usePmvMatrixAttribute; - bool operator==(const QOpenGLEngineShaderProg& other) { + bool operator==(const QOpenGLEngineShaderProg& other) const { // We don't care about the program return ( mainVertexShader == other.mainVertexShader && positionVertexShader == other.positionVertexShader && diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp index edf034a48d..67c3be0c2d 100644 --- a/src/sql/kernel/qsqlerror.cpp +++ b/src/sql/kernel/qsqlerror.cpp @@ -121,7 +121,7 @@ QSqlError& QSqlError::operator=(const QSqlError& other) Compare the \a other error's values to this error and returns true, if it equal. */ -bool QSqlError::operator==(const QSqlError& other) +bool QSqlError::operator==(const QSqlError& other) const { return (errorType == other.errorType); } @@ -131,7 +131,7 @@ bool QSqlError::operator==(const QSqlError& other) Compare the \a other error's values to this error and returns true if it is not equal. */ -bool QSqlError::operator!=(const QSqlError& other) +bool QSqlError::operator!=(const QSqlError& other) const { return (errorType != other.errorType); } diff --git a/src/sql/kernel/qsqlerror.h b/src/sql/kernel/qsqlerror.h index 5a9cb50af0..dd2b650a57 100644 --- a/src/sql/kernel/qsqlerror.h +++ b/src/sql/kernel/qsqlerror.h @@ -66,8 +66,8 @@ public: int number = -1); QSqlError(const QSqlError& other); QSqlError& operator=(const QSqlError& other); - bool operator==(const QSqlError& other); - bool operator!=(const QSqlError& other); + bool operator==(const QSqlError& other) const; + bool operator!=(const QSqlError& other) const; ~QSqlError(); QString driverText() const; -- cgit v1.2.3