summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-02-04 02:20:33 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-08 18:05:30 (GMT)
commit83a5e453f8c0dc0fc9b6bdee9723478aafefd0da (patch)
tree787734e3c75d2a75cafbb054195473c24582e03e
parentb26c70cc9a59de5b8ece8b00b67d571aaf6ee8f0 (diff)
downloadCMake-83a5e453f8c0dc0fc9b6bdee9723478aafefd0da.zip
CMake-83a5e453f8c0dc0fc9b6bdee9723478aafefd0da.tar.gz
CMake-83a5e453f8c0dc0fc9b6bdee9723478aafefd0da.tar.bz2
stringapi: Use strings for test names
-rw-r--r--Source/cmCTest.cxx5
-rw-r--r--Source/cmCTest.h6
-rw-r--r--Source/cmMakefile.cxx21
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx2
-rw-r--r--Source/cmSetTestsPropertiesCommand.h2
-rw-r--r--Source/cmTest.cxx6
-rw-r--r--Source/cmTest.h4
8 files changed, 19 insertions, 31 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 39b623d..72bb7fd 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -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 )
{
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 6418f09..1eb0e01 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -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);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 97628f3..ff0576e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a8ad1e2..044324e 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -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
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 3d52cf2..c725d35 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -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)
{
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 9e85495..7f8d57d 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -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);
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 4ff71ac..28a7bb1 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -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;
}
diff --git a/Source/cmTest.h b/Source/cmTest.h
index 1becbf7..a5795c3 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -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