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.
This commit is contained in:
parent
971eb4d56e
commit
9f48d3bac2
|
@ -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_"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue