stringapi: Use strings for test names

This commit is contained in:
Ben Boeckel 2014-02-03 21:20:33 -05:00 committed by Brad King
parent b26c70cc9a
commit 83a5e453f8
8 changed files with 19 additions and 31 deletions

View File

@ -2126,7 +2126,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1)
{
i++;
this->AddCTestConfigurationOverwrite(args[i].c_str());
this->AddCTestConfigurationOverwrite(args[i]);
}
if(this->CheckArgument(arg, "-A", "--add-notes") && i < args.size() - 1)
{
@ -2840,9 +2840,8 @@ void cmCTest::AddSubmitFile(Part part, const char* name)
}
//----------------------------------------------------------------------
void cmCTest::AddCTestConfigurationOverwrite(const char* encstr)
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
{
std::string overStr = encstr;
size_t epos = overStr.find("=");
if ( epos == overStr.npos )
{

View File

@ -70,8 +70,8 @@ public:
{
PartInfo(): Enabled(false) {}
void SetName(const char* name) { this->Name = name; }
const char* GetName() const { return this->Name.c_str(); }
void SetName(const std::string& name) { this->Name = name; }
const std::string& GetName() const { return this->Name; }
void Enable() { this->Enabled = true; }
operator bool() const { return this->Enabled; }
@ -349,7 +349,7 @@ public:
//! Add overwrite to ctest configuration.
// The format is key=value
void AddCTestConfigurationOverwrite(const char* encstr);
void AddCTestConfigurationOverwrite(const std::string& encstr);
//! Create XML file that contains all the notes specified
int GenerateNotesFile(const std::vector<cmStdString> &files);

View File

@ -3852,34 +3852,27 @@ cmTarget* cmMakefile::FindTarget(const std::string& name,
}
//----------------------------------------------------------------------------
cmTest* cmMakefile::CreateTest(const char* testName)
cmTest* cmMakefile::CreateTest(const std::string& testName)
{
if ( !testName )
{
return 0;
}
cmTest* test = this->GetTest(testName);
if ( test )
{
return test;
}
test = new cmTest(this);
test->SetName(testName);
test->SetName(testName.c_str());
this->Tests[testName] = test;
return test;
}
//----------------------------------------------------------------------------
cmTest* cmMakefile::GetTest(const char* testName) const
cmTest* cmMakefile::GetTest(const std::string& testName) const
{
if(testName)
std::map<cmStdString, cmTest*>::const_iterator
mi = this->Tests.find(testName);
if(mi != this->Tests.end())
{
std::map<cmStdString, cmTest*>::const_iterator
mi = this->Tests.find(testName);
if(mi != this->Tests.end())
{
return mi->second;
}
return mi->second;
}
return 0;
}

View File

@ -782,12 +782,12 @@ public:
void AddMacro(const char* name, const char* signature);
///! Add a new cmTest to the list of tests for this makefile.
cmTest* CreateTest(const char* testName);
cmTest* CreateTest(const std::string& testName);
/** Get a cmTest pointer for a given test name, if the name is
* not found, then a null pointer is returned.
*/
cmTest* GetTest(const char* testName) const;
cmTest* GetTest(const std::string& testName) const;
/**
* Get a list of macros as a ; separated string

View File

@ -91,7 +91,7 @@ bool cmSetTestsPropertiesCommand
bool cmSetTestsPropertiesCommand
::SetOneTest(const char *tname,
::SetOneTest(const std::string& tname,
std::vector<std::string> &propertyPairs,
cmMakefile *mf, std::string &errors)
{

View File

@ -36,7 +36,7 @@ public:
cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand);
static bool SetOneTest(const char *tname,
static bool SetOneTest(const std::string& tname,
std::vector<std::string> &propertyPairs,
cmMakefile *mf,
std::string &errors);

View File

@ -38,12 +38,8 @@ cmListFileBacktrace const& cmTest::GetBacktrace() const
}
//----------------------------------------------------------------------------
void cmTest::SetName(const char* name)
void cmTest::SetName(const std::string& name)
{
if ( !name )
{
name = "";
}
this->Name = name;
}

View File

@ -31,8 +31,8 @@ public:
~cmTest();
///! Set the test name
void SetName(const char* name);
const char* GetName() const { return this->Name.c_str(); }
void SetName(const std::string& name);
std::string GetName() const { return this->Name; }
void SetCommand(std::vector<std::string> const& command);
std::vector<std::string> const& GetCommand() const