diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-12 10:50:16 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-12 13:47:31 -0400 |
commit | e2f94a8e2cf1761f5e2b0ae166f6a8bd73e0a15d (patch) | |
tree | 02c3bfc9f5bdc351dd92b9817d2acae9be375a93 /sc | |
parent | 5b0b7553241bb5150b12bbf7625b4b0b36970272 (diff) |
Move this function object to o3tl.
Change-Id: I9d1710fbed3c5753e84ed343c5136ab87909624d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/stlalgorithm.hxx | 13 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/columnspanset.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dptabres.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/chartlis.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/tool/rangelst.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97rec.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 4 |
11 files changed, 25 insertions, 34 deletions
diff --git a/sc/inc/stlalgorithm.hxx b/sc/inc/stlalgorithm.hxx index d7b4d517b3d3..3c7014446fa4 100644 --- a/sc/inc/stlalgorithm.hxx +++ b/sc/inc/stlalgorithm.hxx @@ -15,19 +15,6 @@ #include <rtl/alloc.h> -/** - * Function object to allow deleting instances stored in STL containers as - * pointers. - */ -template<typename T> -struct ScDeleteObjectByPtr : public ::std::unary_function<T*, void> -{ - void operator() (T* p) - { - delete p; - } -}; - namespace sc { /** diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 443d8fd2f5db..4a25df7fd2ce 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -51,6 +51,7 @@ #include <svl/sharedstringpool.hxx> #include <editeng/scripttypeitem.hxx> #include <editeng/fieldupdater.hxx> +#include <o3tl/deleter.hxx> #include <cstring> #include <map> @@ -2227,7 +2228,7 @@ class UpdateRefOnNonCopy : std::unary_function<sc::FormulaGroupEntry, void> if (!mpUndoDoc->SetFormulaCells(rOldPos, aCells)) // Insertion failed. Delete all formula cells. - std::for_each(aCells.begin(), aCells.end(), ScDeleteObjectByPtr<ScFormulaCell>()); + std::for_each(aCells.begin(), aCells.end(), o3tl::default_deleter<ScFormulaCell>()); } public: diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx index b06f9f7ed2c1..8cef96692b81 100644 --- a/sc/source/core/data/columnspanset.cxx +++ b/sc/source/core/data/columnspanset.cxx @@ -8,7 +8,6 @@ */ #include "columnspanset.hxx" -#include "stlalgorithm.hxx" #include "column.hxx" #include "table.hxx" #include "document.hxx" @@ -16,6 +15,7 @@ #include "markdata.hxx" #include "rangelst.hxx" #include <fstalgorithm.hxx> +#include <o3tl/deleter.hxx> #include <algorithm> @@ -67,7 +67,7 @@ ColumnSpanSet::~ColumnSpanSet() if (!pTab) continue; - std::for_each(pTab->begin(), pTab->end(), ScDeleteObjectByPtr<ColumnType>()); + std::for_each(pTab->begin(), pTab->end(), o3tl::default_deleter<ColumnType>()); delete pTab; } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d0db4bdd906d..02a1bbb0607a 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -84,7 +84,6 @@ #include "externalrefmgr.hxx" #include "tabprotection.hxx" #include "clipparam.hxx" -#include "stlalgorithm.hxx" #include "defaultsoptions.hxx" #include "editutil.hxx" #include "stringutil.hxx" @@ -99,6 +98,7 @@ #include <tokenstringcontext.hxx> #include <formula/vectortoken.hxx> +#include <o3tl/deleter.hxx> #include <map> #include <limits> @@ -785,7 +785,7 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) TableContainer::iterator it = maTabs.begin() + nTab; TableContainer::iterator itEnd = it + nSheets; - std::for_each(it, itEnd, ScDeleteObjectByPtr<ScTable>()); + std::for_each(it, itEnd, o3tl::default_deleter<ScTable>()); maTabs.erase(it, itEnd); // UpdateBroadcastAreas must be called between UpdateDeleteTab, // which ends listening, and StartAllListeners, to not modify diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 792ebb43b497..542cf54e1be3 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -27,13 +27,13 @@ #include "dpitemdata.hxx" #include "document.hxx" -#include "stlalgorithm.hxx" #include "dpresfilter.hxx" #include "dputil.hxx" #include <osl/diagnose.h> #include <rtl/math.hxx> #include <rtl/strbuf.hxx> +#include <o3tl/deleter.hxx> #include <math.h> #include <float.h> @@ -757,7 +757,7 @@ ScDPResultData::ScDPResultData( ScDPSource& rSrc ) : ScDPResultData::~ScDPResultData() { - std::for_each(maDimMembers.begin(), maDimMembers.end(), ScDeleteObjectByPtr<ResultMembers>()); + std::for_each(maDimMembers.begin(), maDimMembers.end(), o3tl::default_deleter<ResultMembers>()); } void ScDPResultData::SetMeasureData( @@ -3550,7 +3550,7 @@ ScDPDataDimension::ScDPDataDimension( const ScDPResultData* pData ) : ScDPDataDimension::~ScDPDataDimension() { - std::for_each(maMembers.begin(), maMembers.end(), ScDeleteObjectByPtr<ScDPDataMember>()); + std::for_each(maMembers.begin(), maMembers.end(), o3tl::default_deleter<ScDPDataMember>()); } void ScDPDataDimension::InitFrom( const ScDPResultDimension* pDim ) diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 22a2a09da47f..860d0777078f 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -56,13 +56,13 @@ #include "tokenarray.hxx" #include "mtvcellfunc.hxx" #include "columnspanset.hxx" -#include <stlalgorithm.hxx> #include <fstalgorithm.hxx> #include <listenercontext.hxx> #include <sharedformula.hxx> #include <refhint.hxx> #include <svl/sharedstringpool.hxx> +#include <o3tl/deleter.hxx> #include <vector> #include <boost/scoped_ptr.hpp> @@ -293,7 +293,7 @@ public: delete[] pppInfo; if (mpRows) - std::for_each(mpRows->begin(), mpRows->end(), ScDeleteObjectByPtr<Row>()); + std::for_each(mpRows->begin(), mpRows->end(), o3tl::default_deleter<Row>()); } void SetKeepQuery( bool b ) { mbKeepQuery = b; } diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx index db5c6cf34b0e..fafbf25c4e1a 100644 --- a/sc/source/core/tool/chartlis.cxx +++ b/sc/source/core/tool/chartlis.cxx @@ -23,7 +23,8 @@ #include "brdcst.hxx" #include "document.hxx" #include "reftokenhelper.hxx" -#include "stlalgorithm.hxx" + +#include <o3tl/deleter.hxx> using namespace com::sun::star; using ::std::vector; @@ -575,7 +576,7 @@ void ScChartListenerCollection::FreeUnused() std::for_each(aUsed.begin(), aUsed.end(), InsertChartListener(maListeners)); // Now, delete the ones no longer needed. - std::for_each(aUnused.begin(), aUnused.end(), ScDeleteObjectByPtr<ScChartListener>()); + std::for_each(aUnused.begin(), aUnused.end(), o3tl::default_deleter<ScChartListener>()); } void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartDataChangeEventListener >& rListener, @@ -603,7 +604,7 @@ void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartData std::for_each(aUsed.begin(), aUsed.end(), InsertChartListener(maListeners)); // Now, delete the ones no longer needed. - std::for_each(aUnused.begin(), aUnused.end(), ScDeleteObjectByPtr<ScChartListener>()); + std::for_each(aUnused.begin(), aUnused.end(), o3tl::default_deleter<ScChartListener>()); } void ScChartListenerCollection::StartTimer() diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 37c7a0e425c3..c5b0d211bc4f 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -26,7 +26,7 @@ #include "refupdat.hxx" #include "rechead.hxx" #include "compiler.hxx" -#include "stlalgorithm.hxx" +#include <o3tl/deleter.hxx> using ::std::vector; using ::std::advance; @@ -1073,7 +1073,7 @@ ScRange* ScRangeList::Remove(size_t nPos) void ScRangeList::RemoveAll() { - for_each(maRanges.begin(), maRanges.end(), ScDeleteObjectByPtr<ScRange>()); + for_each(maRanges.begin(), maRanges.end(), o3tl::default_deleter<ScRange>()); maRanges.clear(); } @@ -1196,7 +1196,7 @@ ScRangeList ScRangeList::GetIntersectedRange(const ScRange& rRange) const // ScRangePairList ScRangePairList::~ScRangePairList() { - for_each( maPairs.begin(), maPairs.end(), ScDeleteObjectByPtr<ScRangePair>() ); + for_each( maPairs.begin(), maPairs.end(), o3tl::default_deleter<ScRangePair>() ); maPairs.clear(); } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 5f1853c8d3ee..abf9d3b107b0 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -56,6 +56,7 @@ #include <filter/msfilter/msoleexp.hxx> #include <unotools/localedatawrapper.hxx> +#include <o3tl/deleter.hxx> #include <stdio.h> @@ -68,7 +69,6 @@ #include "docoptio.hxx" #include "patattr.hxx" #include "tabprotection.hxx" -#include "stlalgorithm.hxx" #include <com/sun/star/sheet/XCellAddressable.hpp> #include <com/sun/star/sheet/XCellRangeAddressable.hpp> @@ -109,7 +109,7 @@ XclExpObjList::XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx ) XclExpObjList::~XclExpObjList() { - ::std::for_each(maObjs.begin(), maObjs.end(), ScDeleteObjectByPtr<XclObj>()); + std::for_each(maObjs.begin(), maObjs.end(), o3tl::default_deleter<XclObj>()); delete pMsodrawingPerSheet; delete pSolverContainer; } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 29e4efa1f889..e5cb28ebf47d 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -32,7 +32,6 @@ #include "compiler.hxx" #include "reftokenhelper.hxx" #include "chartlis.hxx" -#include "stlalgorithm.hxx" #include "tokenuno.hxx" #include "docsh.hxx" #include "cellvalue.hxx" @@ -55,6 +54,7 @@ #include <comphelper/processfactory.hxx> #include <rtl/math.hxx> +#include <o3tl/deleter.hxx> SC_SIMPLE_SERVICE_INFO( ScChart2DataProvider, "ScChart2DataProvider", "com.sun.star.chart2.data.DataProvider") @@ -156,7 +156,7 @@ struct TokenTable : boost::noncopyable } void clear() { - ::std::for_each(maTokens.begin(), maTokens.end(), ScDeleteObjectByPtr<FormulaToken>()); + std::for_each(maTokens.begin(), maTokens.end(), o3tl::default_deleter<FormulaToken>()); } void push_back( FormulaToken* pToken ) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 7df4869a0f2a..9b2331fc31da 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -61,6 +61,8 @@ #include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <o3tl/deleter.hxx> + #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/document/NamedPropertyValues.hpp> @@ -456,7 +458,7 @@ ScViewData::~ScViewData() KillEditView(); delete pOptions; ::std::for_each( - maTabData.begin(), maTabData.end(), ScDeleteObjectByPtr<ScViewDataTable>()); + maTabData.begin(), maTabData.end(), o3tl::default_deleter<ScViewDataTable>()); } void ScViewData::UpdateCurrentTab() |