diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-07 12:32:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-19 07:13:35 +0100 |
commit | e5fe9cbb421dfc0f373e5ea56c93aab2a149ddcc (patch) | |
tree | 0dbac372e0a6a927babb3b2a68313490ea508294 /extensions/source | |
parent | ef8ed797598062273ecb43fac8dbae4dbe3bf3cb (diff) |
loplugin:useuniqueptr in BibConfig
Change-Id: I35a75bc9b4bb49dc3505fdc02167a8e62ece2f2e
Reviewed-on: https://gerrit.libreoffice.org/49946
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 20 | ||||
-rw-r--r-- | extensions/source/bibliography/bibconfig.hxx | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index cd8f2709187a..bf3ea97bdd58 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -60,7 +60,6 @@ Sequence<OUString> const & BibConfig::GetPropertyNames() BibConfig::BibConfig() : ConfigItem("Office.DataAccess/Bibliography", ConfigItemMode::DelayedUpdate) , nTblOrQuery(0) - , pMappingsArr(new MappingArray) , nBeamerSize(0) , nViewSize(0) , bShowColumnAssignmentWarning(false) @@ -181,7 +180,7 @@ BibConfig::BibConfig() pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal; } } - pMappingsArr->push_back(std::unique_ptr<Mapping>(pMapping)); + mvMappings.push_back(std::unique_ptr<Mapping>(pMapping)); } } } @@ -189,7 +188,6 @@ BibConfig::BibConfig() BibConfig::~BibConfig() { assert(!IsModified()); // should have been committed - delete pMappingsArr; } BibDBDescriptor BibConfig::GetBibliographyURL() @@ -223,13 +221,13 @@ void BibConfig::ImplCommit() css::uno::Any(sQueryField), css::uno::Any(bShowColumnAssignmentWarning)}); ClearNodeSet(cDataSourceHistory); - Sequence< PropertyValue > aNodeValues(pMappingsArr->size() * 3); + Sequence< PropertyValue > aNodeValues(mvMappings.size() * 3); PropertyValue* pNodeValues = aNodeValues.getArray(); sal_Int32 nIndex = 0; - for(sal_Int32 i = 0; i < static_cast<sal_Int32>(pMappingsArr->size()); i++) + for(sal_Int32 i = 0; i < static_cast<sal_Int32>(mvMappings.size()); i++) { - const Mapping* pMapping = (*pMappingsArr)[i].get(); + const Mapping* pMapping = mvMappings[i].get(); OUString sPrefix(cDataSourceHistory); sPrefix += "/_"; sPrefix += OUString::number(i); @@ -270,7 +268,7 @@ void BibConfig::ImplCommit() const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const { - for(std::unique_ptr<Mapping> & i : *pMappingsArr) + for(std::unique_ptr<Mapping> const & i : mvMappings) { Mapping& rMapping = *i.get(); bool bURLEqual = rDesc.sDataSource == rMapping.sURL; @@ -282,17 +280,17 @@ const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapping) { - for(size_t i = 0; i < pMappingsArr->size(); i++) + for(size_t i = 0; i < mvMappings.size(); i++) { - Mapping& rMapping = *(*pMappingsArr)[i].get(); + Mapping& rMapping = *mvMappings[i]; bool bURLEqual = rDesc.sDataSource == rMapping.sURL; if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual) { - pMappingsArr->erase(pMappingsArr->begin()+i); + mvMappings.erase(mvMappings.begin()+i); break; } } - pMappingsArr->push_back(o3tl::make_unique<Mapping>(*pSetMapping)); + mvMappings.push_back(o3tl::make_unique<Mapping>(*pSetMapping)); SetModified(); } diff --git a/extensions/source/bibliography/bibconfig.hxx b/extensions/source/bibliography/bibconfig.hxx index 2b1ed8ceb880..73240e94efc8 100644 --- a/extensions/source/bibliography/bibconfig.hxx +++ b/extensions/source/bibliography/bibconfig.hxx @@ -94,7 +94,7 @@ class BibConfig : public utl::ConfigItem OUString sQueryField; OUString sQueryText; - MappingArray* pMappingsArr; + MappingArray mvMappings; long nBeamerSize; long nViewSize; bool bShowColumnAssignmentWarning; |