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

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

Change-Id: Ie19e898e3a5e558906cfad841c01d6d9b380b18b
üst 5de806fb
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
...@@ -185,7 +186,7 @@ BibConfig::BibConfig() ...@@ -185,7 +186,7 @@ BibConfig::BibConfig()
pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal; pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal;
} }
} }
pMappingsArr->push_back(pMapping); pMappingsArr->push_back(std::unique_ptr<Mapping>(pMapping));
} }
} }
} }
...@@ -250,7 +251,7 @@ void BibConfig::ImplCommit() ...@@ -250,7 +251,7 @@ void BibConfig::ImplCommit()
OUString sCommandType("CommandType"); OUString sCommandType("CommandType");
for(sal_Int32 i = 0; i < (sal_Int32)pMappingsArr->size(); i++) for(sal_Int32 i = 0; i < (sal_Int32)pMappingsArr->size(); i++)
{ {
const Mapping* pMapping = &(*pMappingsArr)[i]; const Mapping* pMapping = (*pMappingsArr)[i].get();
OUString sPrefix(cDataSourceHistory); OUString sPrefix(cDataSourceHistory);
sPrefix += "/_"; sPrefix += "/_";
sPrefix += OUString::number(i); sPrefix += OUString::number(i);
...@@ -296,7 +297,7 @@ const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const ...@@ -296,7 +297,7 @@ const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const
{ {
for(size_t i = 0; i < pMappingsArr->size(); i++) for(size_t i = 0; i < pMappingsArr->size(); i++)
{ {
Mapping& rMapping = (*pMappingsArr)[i]; Mapping& rMapping = *(*pMappingsArr)[i].get();
bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL); bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL);
if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual) if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual)
return &rMapping; return &rMapping;
...@@ -308,7 +309,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp ...@@ -308,7 +309,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp
{ {
for(size_t i = 0; i < pMappingsArr->size(); i++) for(size_t i = 0; i < pMappingsArr->size(); i++)
{ {
Mapping& rMapping = (*pMappingsArr)[i]; Mapping& rMapping = *(*pMappingsArr)[i].get();
bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL); bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL);
if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual) if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual)
{ {
...@@ -316,8 +317,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp ...@@ -316,8 +317,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp
break; break;
} }
} }
Mapping* pNew = new Mapping(*pSetMapping); pMappingsArr->push_back(o3tl::make_unique<Mapping>(*pSetMapping));
pMappingsArr->push_back(pNew);
SetModified(); SetModified();
} }
......
...@@ -21,10 +21,11 @@ ...@@ -21,10 +21,11 @@
#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX
#include <unotools/configitem.hxx> #include <unotools/configitem.hxx>
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
struct Mapping; struct Mapping;
typedef boost::ptr_vector<Mapping> MappingArray; typedef std::vector<std::unique_ptr<Mapping> > MappingArray;
......
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