Kaydet (Commit) 7086ed59 authored tarafından Michael Stahl's avatar Michael Stahl

sc: replace boost::ptr_map with std::map<std::unique_ptr>

Change-Id: I800f8d4facaa6dc8eb04b2544ce0e9035af66442
üst 14a0115b
......@@ -22,7 +22,8 @@
#include <rtl/ustring.hxx>
#include <boost/ptr_container/ptr_map.hpp>
#include <memory>
#include <map>
#define MAXFUNCPARAM 16
#define MAXARRSIZE 0xfffe
......@@ -86,8 +87,9 @@ public:
class LegacyFuncCollection
{
typedef boost::ptr_map<OUString, LegacyFuncData> MapType;
MapType maData;
typedef std::map<OUString, std::unique_ptr<LegacyFuncData>> MapType;
MapType m_Data;
public:
typedef MapType::const_iterator const_iterator;
......
......@@ -451,7 +451,7 @@ ScFunctionList::ScFunctionList() :
LegacyFuncCollection::const_iterator it = rLegacyFuncColl.begin(), itEnd = rLegacyFuncColl.end();
for (; it != itEnd; ++it)
{
const LegacyFuncData* pLegacyFuncData = it->second;
const LegacyFuncData *const pLegacyFuncData = it->second.get();
pDesc = new ScFuncDesc;
sal_uInt16 nArgs = pLegacyFuncData->GetParamCount() - 1;
pLegacyFuncData->getParamDesc( aArgName, aArgDesc, 0 );
......
......@@ -25,6 +25,8 @@
#include <osl/module.hxx>
#include <osl/file.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <o3tl/make_unique.hxx>
#include <boost/ptr_container/ptr_map.hpp>
#include <memory>
#include "callform.hxx"
......@@ -398,34 +400,40 @@ bool LegacyFuncData::getParamDesc( OUString& aName, OUString& aDesc, sal_uInt16
}
LegacyFuncCollection::LegacyFuncCollection() {}
LegacyFuncCollection::LegacyFuncCollection(const LegacyFuncCollection& r) : maData(r.maData) {}
LegacyFuncCollection::LegacyFuncCollection(const LegacyFuncCollection& r)
{
for (auto const& it : r.m_Data)
{
m_Data.insert(std::make_pair(it.first, o3tl::make_unique<LegacyFuncData>(*it.second)));
}
}
const LegacyFuncData* LegacyFuncCollection::findByName(const OUString& rName) const
{
MapType::const_iterator it = maData.find(rName);
return it == maData.end() ? nullptr : it->second;
MapType::const_iterator it = m_Data.find(rName);
return it == m_Data.end() ? nullptr : it->second.get();
}
LegacyFuncData* LegacyFuncCollection::findByName(const OUString& rName)
{
MapType::iterator it = maData.find(rName);
return it == maData.end() ? nullptr : it->second;
MapType::iterator it = m_Data.find(rName);
return it == m_Data.end() ? nullptr : it->second.get();
}
void LegacyFuncCollection::insert(LegacyFuncData* pNew)
{
OUString aName = pNew->GetInternalName();
maData.insert(aName, pNew);
m_Data.insert(std::make_pair(aName, std::unique_ptr<LegacyFuncData>(pNew)));
}
LegacyFuncCollection::const_iterator LegacyFuncCollection::begin() const
{
return maData.begin();
return m_Data.begin();
}
LegacyFuncCollection::const_iterator LegacyFuncCollection::end() const
{
return maData.end();
return m_Data.end();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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