From kde-commits Wed Aug 03 08:25:22 2011 From: "Dr. Robert Marmorstein" Date: Wed, 03 Aug 2011 08:25:22 +0000 To: kde-commits Subject: [koffice] /: Make comparison operator const. Message-Id: <20110803082522.483EBA60B4 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=131235995529868 Git commit d17a135f11bebdeab5a641a90b03a852b4c069fb by Dr. Robert Marmorstein. Committed on 03/08/2011 at 10:18. Pushed by robertm into branch 'master'. Make comparison operator const. Makes krazy happy and perhaps allows the compiler to optimize this a little better. Possibly could also prevent errors due to incorrect function signatures, I suppose, too. M +2 -2 libs/kotext/KTextBlockBorderData.h M +1 -1 showcase/part/SCSoundData.h M +2 -2 libs/kotext/KTextBlockBorderData.cpp http://commits.kde.org/koffice/d17a135f11bebdeab5a641a90b03a852b4c069fb diff --git a/libs/kotext/KTextBlockBorderData.cpp b/libs/kotext/KTextBlockBorderData.cpp index 4c88115..58339dd 100644 --- a/libs/kotext/KTextBlockBorderData.cpp +++ b/libs/kotext/KTextBlockBorderData.cpp @@ -65,11 +65,11 @@ bool KTextBlockBorderData::hasBorders() const return false; } -bool KTextBlockBorderData::operator==(const KTextBlockBorderData &border) +bool KTextBlockBorderData::operator==(const KTextBlockBorderData &border) const { return equals(border); } -bool KTextBlockBorderData::equals(const KTextBlockBorderData &border) +bool KTextBlockBorderData::equals(const KTextBlockBorderData &border) const { for (int i = Top; i <= Right; i++) { if (d->edges[i].outerPen != border.d->edges[i].outerPen) diff --git a/libs/kotext/KTextBlockBorderData.h b/libs/kotext/KTextBlockBorderData.h index 922b547..aa0d509 100644 --- a/libs/kotext/KTextBlockBorderData.h +++ b/libs/kotext/KTextBlockBorderData.h @@ -123,8 +123,8 @@ public: qreal inset(Side side) const; /// returns true if the borders of param border are the same as this one. - bool operator==(const KTextBlockBorderData &border); - bool equals(const KTextBlockBorderData &border); + bool operator==(const KTextBlockBorderData &border) const; + bool equals(const KTextBlockBorderData &border) const; /** * Paint the borders. diff --git a/showcase/part/SCSoundData.h b/showcase/part/SCSoundData.h index 4722ab5..bd4de95 100644 --- a/showcase/part/SCSoundData.h +++ b/showcase/part/SCSoundData.h @@ -101,7 +101,7 @@ public: bool isTaggedForSaving(); - bool operator==(const SCSoundData &other) { + bool operator==(const SCSoundData &other) const { return other.d == d; }