summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Ollier <adr.ollier@hotmail.fr>2019-05-01 23:05:53 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-05-03 20:36:20 +0200
commit69bf59d63d4d2708a7840ff1ffad821a032c90fc (patch)
treeac3772ea08cfb3554e7a1aeca6f5d30371090e6c
parente575a5e8f89beb3ce1df5a1d83edc0f9d1d8ac43 (diff)
makes implementation of Animation::operator =(const Animation&) concise
Using the logical AND, we can evaluate all the expressions from left to right into a single and condensed expression. Change-Id: I973061dcd34322c29565a478bf9b7ba757965231 Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr> Reviewed-on: https://gerrit.libreoffice.org/71651 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--vcl/source/animate/Animation.cxx26
1 files changed, 7 insertions, 19 deletions
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index c4c15584b050..bb3935a41c78 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -86,25 +86,13 @@ Animation& Animation::operator=(const Animation& rAnimation)
bool Animation::operator==(const Animation& rAnimation) const
{
- const size_t nCount = maList.size();
- bool bRet = false;
-
- if (rAnimation.maList.size() == nCount && rAnimation.maBitmapEx == maBitmapEx
- && rAnimation.maGlobalSize == maGlobalSize)
- {
- bRet = true;
-
- for (size_t n = 0; n < nCount; n++)
- {
- if ((*maList[n]) != (*rAnimation.maList[n]))
- {
- bRet = false;
- break;
- }
- }
- }
-
- return bRet;
+ return maList.size() == rAnimation.maList.size() && maBitmapEx == rAnimation.maBitmapEx
+ && maGlobalSize == rAnimation.maGlobalSize
+ && std::equal(maList.begin(), maList.end(), rAnimation.maList.begin(),
+ [](const std::unique_ptr<AnimationBitmap>& pAnim1,
+ const std::unique_ptr<AnimationBitmap>& pAnim2) -> bool {
+ return *pAnim1 == *pAnim2;
+ });
}
void Animation::Clear()