Kaydet (Commit) 147b74be authored tarafından Noel Grandin's avatar Noel Grandin

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

Change-Id: Ifd88084d18df73ee18c497d0e4fd05acc3402ddf
üst 51e4d1dc
......@@ -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;
......
......@@ -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()
......
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