diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-03 21:04:22 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 13:05:30 -0500 |
commit | 9f48d3bac22118fc1dddbf1eec6da4cb24c585c4 (patch) | |
tree | 25a33c0250d6b3a5c9a7f602f91e4f5cd642bb7a /Source | |
parent | 971eb4d56e3d3c9bc11acf6082e21d5388d808bb (diff) | |
download | cmake-9f48d3bac22118fc1dddbf1eec6da4cb24c585c4.tar.gz |
stringapi: Use strings in CPack generator parameters
Most of these are turned into strings in the body of the method
(multiple times in some cases). Accept strings to simplify the API and
keep string construction down.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.h | 14 | ||||
-rw-r--r-- | Source/CPack/cmCPackGeneratorFactory.cxx | 13 | ||||
-rw-r--r-- | Source/CPack/cmCPackGeneratorFactory.h | 6 |
4 files changed, 23 insertions, 22 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b46fd86238..bed3891c04 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1482,8 +1482,8 @@ bool cmCPackGenerator::WantsComponentInstallation() const //---------------------------------------------------------------------- cmCPackInstallationType* -cmCPackGenerator::GetInstallationType(const char *projectName, - const char *name) +cmCPackGenerator::GetInstallationType(const std::string& projectName, + const std::string& name) { (void) projectName; bool hasInstallationType = this->InstallationTypes.count(name) != 0; @@ -1514,7 +1514,8 @@ cmCPackGenerator::GetInstallationType(const char *projectName, //---------------------------------------------------------------------- cmCPackComponent* -cmCPackGenerator::GetComponent(const char *projectName, const char *name) +cmCPackGenerator::GetComponent(const std::string& projectName, + const std::string& name) { bool hasComponent = this->Components.count(name) != 0; cmCPackComponent *component = &this->Components[name]; @@ -1582,7 +1583,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) ++installTypesIt) { component->InstallationTypes.push_back( - this->GetInstallationType(projectName, installTypesIt->c_str())); + this->GetInstallationType(projectName, *installTypesIt)); } } @@ -1609,7 +1610,8 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) //---------------------------------------------------------------------- cmCPackComponentGroup* -cmCPackGenerator::GetComponentGroup(const char *projectName, const char *name) +cmCPackGenerator::GetComponentGroup(const std::string& projectName, + const std::string& name) { (void) projectName; std::string macroPrefix = "CPACK_COMPONENT_GROUP_" diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 39ef64da76..7e7c94f2ba 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -245,12 +245,14 @@ protected: * @return true if component installation is supported and wanted. */ virtual bool WantsComponentInstallation() const; - virtual cmCPackInstallationType* GetInstallationType(const char *projectName, - const char* name); - virtual cmCPackComponent* GetComponent(const char *projectName, - const char* name); - virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName, - const char* name); + virtual cmCPackInstallationType* GetInstallationType( + const std::string& projectName, + const std::string& name); + virtual cmCPackComponent* GetComponent(const std::string& projectName, + const std::string& name); + virtual cmCPackComponentGroup* GetComponentGroup( + const std::string& projectName, + const std::string& name); cmSystemTools::OutputOption GeneratorVerbose; std::string Name; diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index b36c2a2f82..9faf2b0fe4 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -151,7 +151,8 @@ cmCPackGeneratorFactory::~cmCPackGeneratorFactory() } //---------------------------------------------------------------------- -cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) +cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator( + const std::string& name) { cmCPackGenerator* gen = this->NewGeneratorInternal(name); if ( !gen ) @@ -165,12 +166,8 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) //---------------------------------------------------------------------- cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( - const char* name) + const std::string& name) { - if ( !name ) - { - return 0; - } cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it = this->GeneratorCreators.find(name); if ( it == this->GeneratorCreators.end() ) @@ -181,11 +178,11 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( } //---------------------------------------------------------------------- -void cmCPackGeneratorFactory::RegisterGenerator(const char* name, +void cmCPackGeneratorFactory::RegisterGenerator(const std::string& name, const char* generatorDescription, CreateGeneratorCall* createGenerator) { - if ( !name || !createGenerator ) + if ( !createGenerator ) { cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR, "Cannot register generator" << std::endl); diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index dff2e49eb6..e6f74f9e8d 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -31,12 +31,12 @@ public: ~cmCPackGeneratorFactory(); //! Get the generator - cmCPackGenerator* NewGenerator(const char* name); + cmCPackGenerator* NewGenerator(const std::string& name); void DeleteGenerator(cmCPackGenerator* gen); typedef cmCPackGenerator* CreateGeneratorCall(); - void RegisterGenerator(const char* name, + void RegisterGenerator(const std::string& name, const char* generatorDescription, CreateGeneratorCall* createGenerator); @@ -47,7 +47,7 @@ public: { return this->GeneratorDescriptions; } private: - cmCPackGenerator* NewGeneratorInternal(const char* name); + cmCPackGenerator* NewGeneratorInternal(const std::string& name); std::vector<cmCPackGenerator*> Generators; typedef std::map<cmStdString, CreateGeneratorCall*> t_GeneratorCreatorsMap; |