Kaydet (Commit) 47612d6b authored tarafından Noel Grandin's avatar Noel Grandin

sfx2: boost::ptr_vector->std::vector<std::unique_ptr>

Change-Id: Idd5bec160e81deac2b570ee3137a1d5ccdc55975
üst fe6554d1
...@@ -99,8 +99,10 @@ ...@@ -99,8 +99,10 @@
#include "fltlst.hxx" #include "fltlst.hxx"
#include <sfx2/request.hxx> #include <sfx2/request.hxx>
#include "arrdecl.hxx" #include "arrdecl.hxx"
#include <o3tl/make_unique.hxx>
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
#include <functional> #include <functional>
#if defined(DBG_UTIL) #if defined(DBG_UTIL)
...@@ -280,23 +282,10 @@ public: ...@@ -280,23 +282,10 @@ public:
namespace namespace
{ {
typedef boost::ptr_vector<SfxFilterMatcher_Impl> SfxFilterMatcherArr_Impl; typedef std::vector<std::unique_ptr<SfxFilterMatcher_Impl> > SfxFilterMatcherArr_Impl;
static SfxFilterMatcherArr_Impl aImplArr; static SfxFilterMatcherArr_Impl aImplArr;
static int nSfxFilterMatcherCount; static int nSfxFilterMatcherCount;
class hasName :
public std::unary_function<SfxFilterMatcher_Impl, bool>
{
private:
const OUString& mrName;
public:
explicit hasName(const OUString &rName) : mrName(rName) {}
bool operator() (const SfxFilterMatcher_Impl& rImpl) const
{
return rImpl.aName == mrName;
}
};
SfxFilterMatcher_Impl & getSfxFilterMatcher_Impl(const OUString &rName) SfxFilterMatcher_Impl & getSfxFilterMatcher_Impl(const OUString &rName)
{ {
OUString aName; OUString aName;
...@@ -306,16 +295,13 @@ namespace ...@@ -306,16 +295,13 @@ namespace
// find the impl-Data of any comparable FilterMatcher that was created // find the impl-Data of any comparable FilterMatcher that was created
// previously // previously
SfxFilterMatcherArr_Impl::iterator aEnd = aImplArr.end(); for (std::unique_ptr<SfxFilterMatcher_Impl>& aImpl : aImplArr)
SfxFilterMatcherArr_Impl::iterator aIter = if (aImpl->aName == aName)
std::find_if(aImplArr.begin(), aEnd, hasName(aName)); return *aImpl.get();
if (aIter != aEnd)
return *aIter;
// first Matcher created for this factory // first Matcher created for this factory
SfxFilterMatcher_Impl *pImpl = new SfxFilterMatcher_Impl(aName); aImplArr.push_back(o3tl::make_unique<SfxFilterMatcher_Impl>(aName));
aImplArr.push_back(pImpl); return *aImplArr.back().get();
return *pImpl;
} }
} }
...@@ -1198,7 +1184,7 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate ) ...@@ -1198,7 +1184,7 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate )
// global filter arry was modified, factory specific ones might need an // global filter arry was modified, factory specific ones might need an
// update too // update too
for (auto& aImpl : aImplArr) for (auto& aImpl : aImplArr)
aImpl.Update(); aImpl->Update();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment