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

loplugin:useuniqueptr in scaddins::ConvertDataLinear

Change-Id: I071e7b072ea6b96a527ccbac91e122f0253eb448
Reviewed-on: https://gerrit.libreoffice.org/61117
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7384e53b
...@@ -2298,10 +2298,10 @@ double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const ...@@ -2298,10 +2298,10 @@ double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const
ConvertDataList::ConvertDataList() ConvertDataList::ConvertDataList()
{ {
#define NEWD(str,unit,cl) maVector.push_back(new ConvertData(str,unit,cl)) #define NEWD(str,unit,cl) maVector.emplace_back(new ConvertData(str,unit,cl))
#define NEWDP(str,unit,cl) maVector.push_back(new ConvertData(str,unit,cl,true)) #define NEWDP(str,unit,cl) maVector.emplace_back(new ConvertData(str,unit,cl,true))
#define NEWL(str,unit,offs,cl) maVector.push_back(new ConvertDataLinear(str,unit,offs,cl)) #define NEWL(str,unit,offs,cl) maVector.emplace_back(new ConvertDataLinear(str,unit,offs,cl))
#define NEWLP(str,unit,offs,cl) maVector.push_back(new ConvertDataLinear(str,unit,offs,cl,true)) #define NEWLP(str,unit,offs,cl) maVector.emplace_back(new ConvertDataLinear(str,unit,offs,cl,true))
// *** are extra and not standard Excel Analysis Addin! // *** are extra and not standard Excel Analysis Addin!
...@@ -2481,8 +2481,6 @@ ConvertDataList::ConvertDataList() ...@@ -2481,8 +2481,6 @@ ConvertDataList::ConvertDataList()
ConvertDataList::~ConvertDataList() ConvertDataList::~ConvertDataList()
{ {
for( std::vector<ConvertData*>::const_iterator it = maVector.begin(); it != maVector.end(); ++it )
delete *it;
} }
...@@ -2495,10 +2493,10 @@ double ConvertDataList::Convert( double fVal, const OUString& rFrom, const OUStr ...@@ -2495,10 +2493,10 @@ double ConvertDataList::Convert( double fVal, const OUString& rFrom, const OUStr
sal_Int16 nLevelFrom = 0; sal_Int16 nLevelFrom = 0;
sal_Int16 nLevelTo = 0; sal_Int16 nLevelTo = 0;
std::vector<ConvertData*>::iterator it = maVector.begin(); auto it = maVector.begin();
while( it != maVector.end() && ( bSearchFrom || bSearchTo ) ) while( it != maVector.end() && ( bSearchFrom || bSearchTo ) )
{ {
ConvertData* p = *it; ConvertData* p = it->get();
if( bSearchFrom ) if( bSearchFrom )
{ {
sal_Int16 n = p->GetMatchingLevel( rFrom ); sal_Int16 n = p->GetMatchingLevel( rFrom );
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "analysisdefs.hxx" #include "analysisdefs.hxx"
#include <memory>
#include <vector> #include <vector>
...@@ -576,7 +577,7 @@ public: ...@@ -576,7 +577,7 @@ public:
class ConvertDataList class ConvertDataList
{ {
private: private:
std::vector<ConvertData*> maVector; std::vector<std::unique_ptr<ConvertData>> maVector;
public: public:
ConvertDataList(); ConvertDataList();
~ConvertDataList(); ~ConvertDataList();
......
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