summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cmCPackGeneratorFactory.cxx
diff options
context:
space:
mode:
authorTushar Maheshwari <tushar27192@gmail.com>2019-09-07 08:45:08 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2019-09-17 17:05:26 (GMT)
commitc9c1eb99fe011546b5d9390c7fbbeebfda491c65 (patch)
treea0c691e03d3629e680f09a72685d563c0b82444a /Source/CPack/cmCPackGeneratorFactory.cxx
parente6ddb57479a3620c712719c120a7337a84470d21 (diff)
downloadCMake-c9c1eb99fe011546b5d9390c7fbbeebfda491c65.zip
CMake-c9c1eb99fe011546b5d9390c7fbbeebfda491c65.tar.gz
CMake-c9c1eb99fe011546b5d9390c7fbbeebfda491c65.tar.bz2
cmCPackGeneratorFactory: rule of zero
Diffstat (limited to 'Source/CPack/cmCPackGeneratorFactory.cxx')
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx25
1 files changed, 6 insertions, 19 deletions
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index a564eb1..79e344b 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -6,7 +6,6 @@
#include <utility>
#include "IFW/cmCPackIFWGenerator.h"
-#include "cmAlgorithms.h"
#ifdef HAVE_FREEBSD_PKG
# include "cmCPackFreeBSDGenerator.h"
#endif
@@ -138,33 +137,21 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
#endif
}
-cmCPackGeneratorFactory::~cmCPackGeneratorFactory()
-{
- cmDeleteAll(this->Generators);
-}
-
-cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
+std::unique_ptr<cmCPackGenerator> cmCPackGeneratorFactory::NewGenerator(
const std::string& name)
{
- cmCPackGenerator* gen = this->NewGeneratorInternal(name);
+ auto it = this->GeneratorCreators.find(name);
+ if (it == this->GeneratorCreators.end()) {
+ return nullptr;
+ }
+ std::unique_ptr<cmCPackGenerator> gen(it->second());
if (!gen) {
return nullptr;
}
- this->Generators.push_back(gen);
gen->SetLogger(this->Logger);
return gen;
}
-cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
- const std::string& name)
-{
- auto it = this->GeneratorCreators.find(name);
- if (it == this->GeneratorCreators.end()) {
- return nullptr;
- }
- return (it->second)();
-}
-
void cmCPackGeneratorFactory::RegisterGenerator(
const std::string& name, const char* generatorDescription,
CreateGeneratorCall* createGenerator)