diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-10 16:21:02 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-11 11:35:39 +0200 |
commit | d1bda375a077d0de31cc4f5e602b3e33fdde0d55 (patch) | |
tree | 2356e81835db7d1a9a87cb09af2eb5a35dc8db82 | |
parent | 5de806fbd2040c8e047aca04a1d80efb10a6f0f2 (diff) |
extensions: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ie19e898e3a5e558906cfad841c01d6d9b380b18b
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 12 | ||||
-rw-r--r-- | extensions/source/bibliography/bibconfig.hxx | 5 |
2 files changed, 9 insertions, 8 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 406067121a6a..fd62c912d51a 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <comphelper/processfactory.hxx> +#include <o3tl/make_unique.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -185,7 +186,7 @@ BibConfig::BibConfig() pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal; } } - pMappingsArr->push_back(pMapping); + pMappingsArr->push_back(std::unique_ptr<Mapping>(pMapping)); } } } @@ -250,7 +251,7 @@ void BibConfig::ImplCommit() OUString sCommandType("CommandType"); 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); sPrefix += "/_"; sPrefix += OUString::number(i); @@ -296,7 +297,7 @@ const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const { 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); if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual) return &rMapping; @@ -308,7 +309,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp { 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); if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual) { @@ -316,8 +317,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp break; } } - Mapping* pNew = new Mapping(*pSetMapping); - pMappingsArr->push_back(pNew); + pMappingsArr->push_back(o3tl::make_unique<Mapping>(*pSetMapping)); SetModified(); } diff --git a/extensions/source/bibliography/bibconfig.hxx b/extensions/source/bibliography/bibconfig.hxx index 4bd0d981d23e..590e90759515 100644 --- a/extensions/source/bibliography/bibconfig.hxx +++ b/extensions/source/bibliography/bibconfig.hxx @@ -21,10 +21,11 @@ #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX #include <unotools/configitem.hxx> -#include <boost/ptr_container/ptr_vector.hpp> +#include <vector> +#include <memory> struct Mapping; -typedef boost::ptr_vector<Mapping> MappingArray; +typedef std::vector<std::unique_ptr<Mapping> > MappingArray; |