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; }
const QString &local() const;
bool operator==(const QMakeLocalFileName &other) {
bool operator==(const QMakeLocalFileName &other) const {
return (this->real_name == other.real_name);
}
bool operator!=(const QMakeLocalFileName &other) {
bool operator!=(const QMakeLocalFileName &other) const {
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 &&
m_priority == other.m_priority;

View File

@ -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<QMimeMagicRule> &rules);

View File

@ -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 &&

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.
*/
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);
}

View File

@ -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;