[Libreoffice-commits] core.git: sc/inc sc/source

Julien Nabet serval2412 at yahoo.fr
Fri Jan 2 16:47:58 PST 2015


 sc/inc/dbdata.hxx              |    1 +
 sc/source/core/tool/dbdata.cxx |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 31e82d9f6f07335a2526bd44956eebfcaf0a289d
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri Jan 2 23:11:55 2015 +0100

    Add deleteOnTab for ScDBCollection::AnonDBs
    
    and use it instead of just using remove_if which is useless nothing!
    
    Change-Id: I37d8254b05123e50b076ddbb6f67726198ec4d6c
    Reviewed-on: https://gerrit.libreoffice.org/13723
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index bb2684a..c2a8426 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -203,6 +203,7 @@ public:
         const_iterator end() const;
         const ScDBData* findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const;
         const ScDBData* findByRange(const ScRange& rRange) const;
+        void deleteOnTab(SCTAB nTab);
         ScDBData* getByRange(const ScRange& rRange);
         void insert(ScDBData* p);
         bool empty() const;
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index e96e5b8..5dd0f6a 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -762,6 +762,12 @@ const ScDBData* ScDBCollection::AnonDBs::findByRange(const ScRange& rRange) cons
     return itr == maDBs.end() ? NULL : &(*itr);
 }
 
+void ScDBCollection::AnonDBs::deleteOnTab(SCTAB nTab)
+{
+    FindByTable func(nTab);
+    maDBs.erase_if(func);
+}
+
 ScDBData* ScDBCollection::AnonDBs::getByRange(const ScRange& rRange)
 {
     const ScDBData* pData = findByRange(rRange);
@@ -905,7 +911,7 @@ void ScDBCollection::DeleteOnTab( SCTAB nTab )
     for (; itr != itrEnd; ++itr)
         maNamedDBs.erase(*itr);
 
-    remove_if(maAnonDBs.begin(), maAnonDBs.end(), func);
+    maAnonDBs.deleteOnTab(nTab);
 }
 
 void ScDBCollection::UpdateReference(UpdateRefMode eUpdateRefMode,


More information about the Libreoffice-commits mailing list