summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-12 11:59:36 +0200
committerNoel Grandin <noel@peralex.com>2015-11-12 12:29:26 +0200
commit147b74beea7b5f0fb121e5495bbdfb4869786603 (patch)
treed7530f0180fcb8936d2cade8f93c1a2638407614
parent51e4d1dcfb8fcbc0c36d433896d4b9b7bf021985 (diff)
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ifd88084d18df73ee18c497d0e4fd05acc3402ddf
-rw-r--r--sc/source/filter/inc/orcusinterface.hxx4
-rw-r--r--sc/source/filter/orcus/interface.cxx28
2 files changed, 16 insertions, 16 deletions
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index d42a46c0a439..36dcbdcbedf2 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -25,7 +25,7 @@
#define __ORCUS_STATIC_LIB
#include <orcus/spreadsheet/import_interface.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
#include <map>
#include <unordered_map>
#include <vector>
@@ -455,7 +455,7 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
StringCellCaches maStringCells;
ScOrcusGlobalSettings maGlobalSettings;
ScOrcusSharedStrings maSharedStrings;
- boost::ptr_vector<ScOrcusSheet> maSheets;
+ std::vector< std::unique_ptr<ScOrcusSheet> > maSheets;
ScOrcusStyles maStyles;
int mnProgress;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 334efb38c947..78c0b9d3d02b 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -34,6 +34,7 @@
#include <formula/token.hxx>
#include <tools/datetime.hxx>
#include <svl/sharedstringpool.hxx>
+#include <o3tl/make_unique.hxx>
#include <com/sun/star/task/XStatusIndicator.hpp>
@@ -74,18 +75,18 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char
return nullptr;
SCTAB nTab = maDoc.getSheetCount() - 1;
- maSheets.push_back(new ScOrcusSheet(maDoc, nTab, *this));
- return &maSheets.back();
+ maSheets.push_back(o3tl::make_unique<ScOrcusSheet>(maDoc, nTab, *this));
+ return maSheets.back().get();
}
-class FindSheetByIndex : std::unary_function<ScOrcusSheet, bool>
+class FindSheetByIndex : std::unary_function< std::unique_ptr<ScOrcusSheet>, bool>
{
SCTAB mnTab;
public:
explicit FindSheetByIndex(SCTAB nTab) : mnTab(nTab) {}
- bool operator() (const ScOrcusSheet& rSheet) const
+ bool operator() (const std::unique_ptr<ScOrcusSheet>& rSheet) const
{
- return rSheet.getIndex() == mnTab;
+ return rSheet->getIndex() == mnTab;
}
};
@@ -98,33 +99,32 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* s
return nullptr;
// See if we already have an orcus sheet instance by that index.
- boost::ptr_vector<ScOrcusSheet>::iterator it =
+ std::vector< std::unique_ptr<ScOrcusSheet> >::iterator it =
std::find_if(maSheets.begin(), maSheets.end(), FindSheetByIndex(nTab));
if (it != maSheets.end())
// We already have one. Return it.
- return &(*it);
+ return it->get();
// Create a new orcus sheet instance for this.
- maSheets.push_back(new ScOrcusSheet(maDoc, nTab, *this));
- return &maSheets.back();
+ maSheets.push_back(o3tl::make_unique<ScOrcusSheet>(maDoc, nTab, *this));
+ return maSheets.back().get();
}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(orcus::spreadsheet::sheet_t sheet_index)
{
SCTAB nTab = static_cast<SCTAB>(sheet_index);
// See if we already have an orcus sheet instance by that index.
- boost::ptr_vector<ScOrcusSheet>::iterator it =
+ std::vector< std::unique_ptr<ScOrcusSheet> >::iterator it =
std::find_if(maSheets.begin(), maSheets.end(), FindSheetByIndex(nTab));
if (it != maSheets.end())
// We already have one. Return it.
- return &(*it);
+ return it->get();
// Create a new orcus sheet instance for this.
- maSheets.push_back(new ScOrcusSheet(maDoc, nTab, *this));
- return &maSheets.back();
-
+ maSheets.push_back(o3tl::make_unique<ScOrcusSheet>(maDoc, nTab, *this));
+ return maSheets.back().get();
}
orcus::spreadsheet::iface::import_global_settings* ScOrcusFactory::get_global_settings()