Check for C++ operators that should be 'const'

Make sure all C++ class comparison operators are const.

Change-Id: Ib4a66f2afe6c62f437dae1ecde94287d3db8442d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <faure@kde.org>
This commit is contained in:
Sergio Ahumada 2012-09-04 21:10:05 +02:00 committed by Qt by Nokia
parent afb0260f50
commit ce8e6abe7f
6 changed files with 9 additions and 9 deletions

View File

@ -63,10 +63,10 @@ public:
inline const QString &real() const { return real_name; } inline const QString &real() const { return real_name; }
const QString &local() const; const QString &local() const;
bool operator==(const QMakeLocalFileName &other) { bool operator==(const QMakeLocalFileName &other) const {
return (this->real_name == other.real_name); return (this->real_name == other.real_name);
} }
bool operator!=(const QMakeLocalFileName &other) { bool operator!=(const QMakeLocalFileName &other) const {
return !(*this == other); return !(*this == other);
} }
}; };

View File

@ -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 && return m_list == other.m_list &&
m_priority == other.m_priority; m_priority == other.m_priority;

View File

@ -55,7 +55,7 @@ class QMimeMagicRuleMatcher
public: public:
explicit QMimeMagicRuleMatcher(const QString &mime, unsigned priority = 65535); 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 addRule(const QMimeMagicRule &rule);
void addRules(const QList<QMimeMagicRule> &rules); void addRules(const QList<QMimeMagicRule> &rules);

View File

@ -399,7 +399,7 @@ public:
bool useOpacityAttribute; bool useOpacityAttribute;
bool usePmvMatrixAttribute; bool usePmvMatrixAttribute;
bool operator==(const QOpenGLEngineShaderProg& other) { bool operator==(const QOpenGLEngineShaderProg& other) const {
// We don't care about the program // We don't care about the program
return ( mainVertexShader == other.mainVertexShader && return ( mainVertexShader == other.mainVertexShader &&
positionVertexShader == other.positionVertexShader && positionVertexShader == other.positionVertexShader &&

View File

@ -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. 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); 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. 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); return (errorType != other.errorType);
} }

View File

@ -66,8 +66,8 @@ public:
int number = -1); int number = -1);
QSqlError(const QSqlError& other); QSqlError(const QSqlError& other);
QSqlError& operator=(const QSqlError& other); QSqlError& operator=(const QSqlError& other);
bool operator==(const QSqlError& other); bool operator==(const QSqlError& other) const;
bool operator!=(const QSqlError& other); bool operator!=(const QSqlError& other) const;
~QSqlError(); ~QSqlError();
QString driverText() const; QString driverText() const;