[Libreoffice-commits] core.git: editeng/source

Adrien Ollier (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 28 06:37:30 UTC 2019


 editeng/source/editeng/editobj.cxx |   28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

New commits:
commit a3b2c6b8b3ac67dca29605aa1ae856f663683c4b
Author:     Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Sun Jul 28 19:06:49 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 28 08:35:53 2019 +0200

    ContentInfo::Equals uses std::equal
    
    Change-Id: Ia99cd1cb9594d6398ff351f6ded7888a75c83dd6
    Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
    Reviewed-on: https://gerrit.libreoffice.org/76504
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index ad096dfa7f82..a0112468af5b 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -217,24 +217,16 @@ void ContentInfo::Dump() const
 }
 #endif
 
-bool ContentInfo::Equals( const ContentInfo& rCompare, bool bComparePool ) const
-{
-    if( (maText == rCompare.maText) &&
-            (aStyle == rCompare.aStyle ) &&
-            (maCharAttribs.size() == rCompare.maCharAttribs.size()) &&
-            (eFamily == rCompare.eFamily ) &&
-            aParaAttribs.Equals( rCompare.aParaAttribs, bComparePool ) )
-    {
-        for (size_t i = 0, n = maCharAttribs.size(); i < n; ++i)
-        {
-            if (!(*(maCharAttribs[i]) == *(rCompare.maCharAttribs[i])))
-                return false;
-        }
-
-        return true;
-    }
-
-    return false;
+bool ContentInfo::Equals(const ContentInfo& rCompare, bool bComparePool) const
+{
+    return maText == rCompare.maText && aStyle == rCompare.aStyle && eFamily == rCompare.eFamily
+           && aParaAttribs.Equals(rCompare.aParaAttribs, bComparePool)
+           && std::equal(maCharAttribs.cbegin(), maCharAttribs.cend(),
+                         rCompare.maCharAttribs.cbegin(), rCompare.maCharAttribs.cend(),
+                         [](const std::unique_ptr<XEditAttribute>& pAttribute1,
+                            const std::unique_ptr<XEditAttribute>& pAttribute2) -> bool {
+                             return *pAttribute1 == *pAttribute2;
+                         });
 }
 
 EditTextObject::EditTextObject( SfxItemPool* pPool ) :


More information about the Libreoffice-commits mailing list