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

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

Change-Id: Ia9d061d9f5fb07e07fd6253a6493a4e9b1f9c975
üst 91f571a2
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <boost/ptr_container/ptr_map.hpp>
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
namespace container { namespace container {
...@@ -337,8 +335,8 @@ public: ...@@ -337,8 +335,8 @@ public:
class DBCaches class DBCaches
{ {
friend class ScDPCollection; friend class ScDPCollection;
typedef ::boost::ptr_map<DBType, ScDPCache, DBType::less> CachesType; typedef ::std::map<DBType, std::unique_ptr<ScDPCache>, DBType::less> CachesType;
CachesType maCaches; CachesType m_Caches;
ScDocument* mpDoc; ScDocument* mpDoc;
public: public:
DBCaches(ScDocument* pDoc); DBCaches(ScDocument* pDoc);
......
...@@ -68,7 +68,6 @@ ...@@ -68,7 +68,6 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <o3tl/ptr_container.hxx>
#include <sal/macros.h> #include <sal/macros.h>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
...@@ -3104,8 +3103,8 @@ ScDPCollection::DBCaches::DBCaches(ScDocument* pDoc) : mpDoc(pDoc) {} ...@@ -3104,8 +3103,8 @@ ScDPCollection::DBCaches::DBCaches(ScDocument* pDoc) : mpDoc(pDoc) {}
bool ScDPCollection::DBCaches::hasCache(sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand) const bool ScDPCollection::DBCaches::hasCache(sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand) const
{ {
DBType aType(nSdbType, rDBName, rCommand); DBType aType(nSdbType, rDBName, rCommand);
CachesType::const_iterator itr = maCaches.find(aType); CachesType::const_iterator const itr = m_Caches.find(aType);
return itr != maCaches.end(); return itr != m_Caches.end();
} }
const ScDPCache* ScDPCollection::DBCaches::getCache( const ScDPCache* ScDPCollection::DBCaches::getCache(
...@@ -3113,10 +3112,10 @@ const ScDPCache* ScDPCollection::DBCaches::getCache( ...@@ -3113,10 +3112,10 @@ const ScDPCache* ScDPCollection::DBCaches::getCache(
const ScDPDimensionSaveData* pDimData) const ScDPDimensionSaveData* pDimData)
{ {
DBType aType(nSdbType, rDBName, rCommand); DBType aType(nSdbType, rDBName, rCommand);
CachesType::const_iterator itr = maCaches.find(aType); CachesType::const_iterator const itr = m_Caches.find(aType);
if (itr != maCaches.end()) if (itr != m_Caches.end())
// already cached. // already cached.
return itr->second; return itr->second.get();
uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand); uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand);
if (!xRowSet.is()) if (!xRowSet.is())
...@@ -3140,7 +3139,7 @@ const ScDPCache* ScDPCollection::DBCaches::getCache( ...@@ -3140,7 +3139,7 @@ const ScDPCache* ScDPCollection::DBCaches::getCache(
::comphelper::disposeComponent(xRowSet); ::comphelper::disposeComponent(xRowSet);
const ScDPCache* p = pCache.get(); const ScDPCache* p = pCache.get();
o3tl::ptr_container::insert(maCaches, aType, std::move(pCache)); m_Caches.insert(std::make_pair(aType, std::move(pCache)));
return p; return p;
} }
...@@ -3148,8 +3147,8 @@ ScDPCache* ScDPCollection::DBCaches::getExistingCache( ...@@ -3148,8 +3147,8 @@ ScDPCache* ScDPCollection::DBCaches::getExistingCache(
sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand) sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand)
{ {
DBType aType(nSdbType, rDBName, rCommand); DBType aType(nSdbType, rDBName, rCommand);
CachesType::iterator itr = maCaches.find(aType); CachesType::iterator const itr = m_Caches.find(aType);
return itr != maCaches.end() ? itr->second : nullptr; return itr != m_Caches.end() ? itr->second.get() : nullptr;
} }
uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet( uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet(
...@@ -3215,8 +3214,8 @@ void ScDPCollection::DBCaches::updateCache( ...@@ -3215,8 +3214,8 @@ void ScDPCollection::DBCaches::updateCache(
std::set<ScDPObject*>& rRefs) std::set<ScDPObject*>& rRefs)
{ {
DBType aType(nSdbType, rDBName, rCommand); DBType aType(nSdbType, rDBName, rCommand);
CachesType::iterator it = maCaches.find(aType); CachesType::iterator const it = m_Caches.find(aType);
if (it == maCaches.end()) if (it == m_Caches.end())
{ {
// not cached. // not cached.
rRefs.clear(); rRefs.clear();
...@@ -3255,12 +3254,12 @@ void ScDPCollection::DBCaches::updateCache( ...@@ -3255,12 +3254,12 @@ void ScDPCollection::DBCaches::updateCache(
bool ScDPCollection::DBCaches::remove(const ScDPCache* p) bool ScDPCollection::DBCaches::remove(const ScDPCache* p)
{ {
CachesType::iterator it = maCaches.begin(), itEnd = maCaches.end(); CachesType::iterator it = m_Caches.begin(), itEnd = m_Caches.end();
for (; it != itEnd; ++it) for (; it != itEnd; ++it)
{ {
if (it->second == p) if (it->second.get() == p)
{ {
maCaches.erase(it); m_Caches.erase(it);
return true; return true;
} }
} }
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <dpsave.hxx> #include <dpsave.hxx>
#include <algorithm>
namespace sc { namespace sc {
PivotTableSources::SelectedPages::SelectedPages( ScDPObject* pObj, const SelectedPagesType& rSelected ) : PivotTableSources::SelectedPages::SelectedPages( ScDPObject* pObj, const SelectedPagesType& rSelected ) :
......
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