stringapi: Miscellaneous char* parameters

This commit is contained in:
Ben Boeckel 2014-02-21 19:05:55 -05:00 committed by Brad King
parent 5af95c396d
commit b3bf31a548
49 changed files with 173 additions and 175 deletions

View File

@ -34,12 +34,11 @@ cmWIXPatchParser::cmWIXPatchParser(
}
void cmWIXPatchParser::StartElement(const char *name, const char **atts)
void cmWIXPatchParser::StartElement(const std::string& name, const char **atts)
{
std::string name_str = name;
if(State == BEGIN_DOCUMENT)
{
if(name_str == "CPackWiXPatch")
if(name == "CPackWiXPatch")
{
State = BEGIN_FRAGMENTS;
}
@ -50,7 +49,7 @@ void cmWIXPatchParser::StartElement(const char *name, const char **atts)
}
else if(State == BEGIN_FRAGMENTS)
{
if(name_str == "CPackWiXFragment")
if(name == "CPackWiXFragment")
{
State = INSIDE_FRAGMENT;
StartFragment(atts);
@ -107,12 +106,11 @@ void cmWIXPatchParser::StartFragment(const char **attributes)
}
}
void cmWIXPatchParser::EndElement(const char *name)
void cmWIXPatchParser::EndElement(const std::string& name)
{
std::string name_str = name;
if(State == INSIDE_FRAGMENT)
{
if(name_str == "CPackWiXFragment")
if(name == "CPackWiXFragment")
{
State = BEGIN_FRAGMENTS;
ElementStack.clear();

View File

@ -43,11 +43,11 @@ public:
cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
private:
virtual void StartElement(const char *name, const char **atts);
virtual void StartElement(const std::string& name, const char **atts);
void StartFragment(const char **attributes);
virtual void EndElement(const char *name);
virtual void EndElement(const std::string& name);
virtual void ReportError(int line, int column, const char* msg);
void ReportValidationError(std::string const& message);

View File

@ -16,7 +16,8 @@
#include <string>
//----------------------------------------------------------------------
unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const
unsigned long cmCPackComponent::GetInstalledSize(
const std::string& installDir) const
{
if (this->TotalSize != 0)
{
@ -37,7 +38,7 @@ unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const
//----------------------------------------------------------------------
unsigned long
cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const
cmCPackComponent::GetInstalledSizeInKbytes(const std::string& installDir) const
{
unsigned long result = (GetInstalledSize(installDir) + 512) / 1024;
return result? result : 1;

View File

@ -94,11 +94,11 @@ public:
/// Get the total installed size of all of the files in this
/// component, in bytes. installDir is the directory into which the
/// component was installed.
unsigned long GetInstalledSize(const char* installDir) const;
unsigned long GetInstalledSize(const std::string& installDir) const;
/// Identical to GetInstalledSize, but returns the result in
/// kilobytes.
unsigned long GetInstalledSizeInKbytes(const char* installDir) const;
unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const;
private:
mutable unsigned long TotalSize;

View File

@ -1139,7 +1139,7 @@ int cmCPackGenerator::DoPackage()
}
//----------------------------------------------------------------------
int cmCPackGenerator::Initialize(const char* name, cmMakefile* mf)
int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf)
{
this->MakefileMap = mf;
this->Name = name;

View File

@ -90,7 +90,7 @@ public:
/**
* Initialize generator
*/
int Initialize(const char* name, cmMakefile* mf);
int Initialize(const std::string& name, cmMakefile* mf);
/**
* Construct generator

View File

@ -272,7 +272,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
//----------------------------------------------------------------------
bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name,
const char* dir, const char* outputFileName /* = 0 */,
const std::string& dir, const char* outputFileName /* = 0 */,
bool copyOnly /* = false */)
{
std::string inFName = "CPack.";

View File

@ -39,7 +39,7 @@ protected:
//bool CopyCreateResourceFile(const std::string& name,
// const std::string& dir);
bool CopyResourcePlistFile(const std::string& name, const char* dir,
bool CopyResourcePlistFile(const std::string& name, const std::string& dir,
const char* outputFileName = 0, bool copyOnly = false);
std::string InstallPrefix;
};

View File

@ -43,14 +43,14 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const
}
//----------------------------------------------------------------------
int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir,
const char* script,
const char* name)
int cmCPackPackageMakerGenerator::CopyInstallScript(const std::string& resdir,
const std::string& script,
const std::string& name)
{
std::string dst = resdir;
dst += "/";
dst += name;
cmSystemTools::CopyFileAlways(script, dst.c_str());
cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str());
cmSystemTools::SetPermissions(dst.c_str(),0777);
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"copy script : " << script << "\ninto " << dst.c_str() <<
@ -601,12 +601,13 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(
return true;
}
bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(const char* name,
const char* outName)
bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(
const std::string& name,
const char* outName)
{
if (!outName)
{
outName = name;
outName = name.c_str();
}
std::string inFName = "CPack.";

View File

@ -38,9 +38,9 @@ public:
virtual bool SupportsComponentInstallation() const;
protected:
int CopyInstallScript(const char* resdir,
const char* script,
const char* name);
int CopyInstallScript(const std::string& resdir,
const std::string& script,
const std::string& name);
virtual int InitializeInternal();
int PackageFiles();
virtual const char* GetOutputExtension() { return ".dmg"; }
@ -53,7 +53,7 @@ protected:
// which will be configured via ConfigureFile.
bool CopyCreateResourceFile(const std::string& name,
const std::string& dirName);
bool CopyResourcePlistFile(const char* name, const char* outName = 0);
bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
// Run PackageMaker with the given command line, which will (if
// successful) produce the given package file. Returns true if

View File

@ -225,35 +225,35 @@ private:
return true;
}
virtual void StartElement(const char* name, const char**)
virtual void StartElement(const std::string& name, const char**)
{
this->CData.clear();
if(strcmp(name, "log") == 0)
if(name == "log")
{
this->Rev = Revision();
this->Changes.clear();
}
// affected-files can contain blocks of
// modified, unknown, renamed, kind-changed, removed, conflicts, added
else if(strcmp(name, "modified") == 0
|| strcmp(name, "renamed") == 0
|| strcmp(name, "kind-changed") == 0)
else if(name == "modified"
|| name == "renamed"
|| name == "kind-changed")
{
this->CurChange = Change();
this->CurChange.Action = 'M';
}
else if(strcmp(name, "added") == 0)
else if(name == "added")
{
this->CurChange = Change();
this->CurChange = 'A';
}
else if(strcmp(name, "removed") == 0)
else if(name == "removed")
{
this->CurChange = Change();
this->CurChange = 'D';
}
else if(strcmp(name, "unknown") == 0
|| strcmp(name, "conflicts") == 0)
else if(name == "unknown"
|| name == "conflicts")
{
// Should not happen here
this->CurChange = Change();
@ -265,27 +265,27 @@ private:
this->CData.insert(this->CData.end(), data, data+length);
}
virtual void EndElement(const char* name)
virtual void EndElement(const std::string& name)
{
if(strcmp(name, "log") == 0)
if(name == "log")
{
this->BZR->DoRevision(this->Rev, this->Changes);
}
else if((strcmp(name, "file") == 0 || strcmp(name, "directory") == 0)
&& !this->CData.empty())
else if(!this->CData.empty() &&
(name == "file" || name == "directory"))
{
this->CurChange.Path.assign(&this->CData[0], this->CData.size());
cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path);
this->Changes.push_back(this->CurChange);
}
else if(strcmp(name, "symlink") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "symlink")
{
// symlinks have an arobase at the end in the log
this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1);
cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path);
this->Changes.push_back(this->CurChange);
}
else if(strcmp(name, "committer") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "committer")
{
this->Rev.Author.assign(&this->CData[0], this->CData.size());
if(this->EmailRegex.find(this->Rev.Author))
@ -294,15 +294,15 @@ private:
this->Rev.EMail = this->EmailRegex.match(2);
}
}
else if(strcmp(name, "timestamp") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "timestamp")
{
this->Rev.Date.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "message") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "message")
{
this->Rev.Log.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "revno") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "revno")
{
this->Rev.Rev.assign(&this->CData[0], this->CData.size());
}

View File

@ -131,8 +131,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
std::string buildCommand
= this->GlobalGenerator->
GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "",
cmakeBuildConfiguration,
cmakeBuildAdditionalFlags, true);
cmakeBuildConfiguration,
cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:"
<< buildCommand.c_str() << "\n");

View File

@ -189,10 +189,10 @@ private:
return true;
}
virtual void StartElement(const char* name, const char** atts)
virtual void StartElement(const std::string& name, const char** atts)
{
this->CData.clear();
if(strcmp(name, "logentry") == 0)
if(name == "logentry")
{
this->Rev = Revision();
if(const char* rev = this->FindAttribute(atts, "revision"))
@ -208,29 +208,29 @@ private:
this->CData.insert(this->CData.end(), data, data+length);
}
virtual void EndElement(const char* name)
virtual void EndElement(const std::string& name)
{
if(strcmp(name, "logentry") == 0)
if(name == "logentry")
{
this->HG->DoRevision(this->Rev, this->Changes);
}
else if(strcmp(name, "author") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "author")
{
this->Rev.Author.assign(&this->CData[0], this->CData.size());
}
else if ( strcmp(name, "email") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "email")
{
this->Rev.EMail.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "date") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "date")
{
this->Rev.Date.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "msg") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "msg")
{
this->Rev.Log.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "files") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "files")
{
std::vector<std::string> paths = this->SplitCData();
for(unsigned int i = 0; i < paths.size(); ++i)
@ -242,7 +242,7 @@ private:
this->Changes.push_back(this->CurChange);
}
}
else if(strcmp(name, "file_adds") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "file_adds")
{
std::string added_paths(this->CData.begin(), this->CData.end());
for(unsigned int i = 0; i < this->Changes.size(); ++i)
@ -253,7 +253,7 @@ private:
}
}
}
else if(strcmp(name, "file_dels") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "file_dels")
{
std::string added_paths(this->CData.begin(), this->CData.end());
for(unsigned int i = 0; i < this->Changes.size(); ++i)

View File

@ -49,21 +49,15 @@ class cmBoundsCheckerParser : public cmXMLParser
{
public:
cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;}
void StartElement(const char* name, const char** atts)
void StartElement(const std::string& name, const char** atts)
{
if(strcmp(name, "MemoryLeak") == 0)
if(name == "MemoryLeak" ||
name == "ResourceLeak")
{
this->Errors.push_back(cmCTestMemCheckHandler::MLK);
}
if(strcmp(name, "ResourceLeak") == 0)
{
this->Errors.push_back(cmCTestMemCheckHandler::MLK);
}
if(strcmp(name, "Error") == 0)
{
this->ParseError(atts);
}
if(strcmp(name, "Dangling Pointer") == 0)
else if(name == "Error" ||
name == "Dangling Pointer")
{
this->ParseError(atts);
}
@ -79,7 +73,7 @@ public:
ostr << "\n";
this->Log += ostr.str();
}
void EndElement(const char* )
void EndElement(const std::string& )
{
}

View File

@ -361,10 +361,10 @@ private:
return true;
}
virtual void StartElement(const char* name, const char** atts)
virtual void StartElement(const std::string& name, const char** atts)
{
this->CData.clear();
if(strcmp(name, "logentry") == 0)
if(name == "logentry")
{
this->Rev = Revision();
this->Rev.SVNInfo = &SVNRepo;
@ -374,7 +374,7 @@ private:
}
this->Changes.clear();
}
else if(strcmp(name, "path") == 0)
else if(name == "path")
{
this->CurChange = Change();
if(const char* action = this->FindAttribute(atts, "action"))
@ -389,28 +389,28 @@ private:
this->CData.insert(this->CData.end(), data, data+length);
}
virtual void EndElement(const char* name)
virtual void EndElement(const std::string& name)
{
if(strcmp(name, "logentry") == 0)
if(name == "logentry")
{
this->SVN->DoRevisionSVN(this->Rev, this->Changes);
}
else if(strcmp(name, "path") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "path")
{
std::string orig_path(&this->CData[0], this->CData.size());
std::string new_path = SVNRepo.BuildLocalPath( orig_path );
this->CurChange.Path.assign(new_path);
this->Changes.push_back(this->CurChange);
}
else if(strcmp(name, "author") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "author")
{
this->Rev.Author.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "date") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "date")
{
this->Rev.Date.assign(&this->CData[0], this->CData.size());
}
else if(strcmp(name, "msg") == 0 && !this->CData.empty())
else if(!this->CData.empty() && name == "msg")
{
this->Rev.Log.assign(&this->CData[0], this->CData.size());
}

View File

@ -68,10 +68,10 @@ private:
return val;
}
virtual void StartElement(const char* name, const char** atts)
virtual void StartElement(const std::string& name, const char** atts)
{
this->CurrentValue.clear();
if(strcmp(name, "cdash") == 0)
if(name == "cdash")
{
this->CDashVersion = this->FindAttribute(atts, "version");
}
@ -82,9 +82,9 @@ private:
this->CurrentValue.insert(this->CurrentValue.end(), data, data+length);
}
virtual void EndElement(const char* name)
virtual void EndElement(const std::string& name)
{
if(strcmp(name, "status") == 0)
if(name == "status")
{
std::string status = cmSystemTools::UpperCase(this->GetCurrentValue());
if(status == "OK" || status == "SUCCESS")
@ -100,15 +100,15 @@ private:
this->Status = STATUS_ERROR;
}
}
else if(strcmp(name, "filename") == 0)
else if(name == "filename")
{
this->Filename = this->GetCurrentValue();
}
else if(strcmp(name, "md5") == 0)
else if(name == "md5")
{
this->MD5 = this->GetCurrentValue();
}
else if(strcmp(name, "message") == 0)
else if(name == "message")
{
this->Message = this->GetCurrentValue();
}

View File

@ -20,9 +20,9 @@ public:
protected:
virtual void StartElement(const char* name, const char** atts)
virtual void StartElement(const std::string& name, const char** atts)
{
if(strcmp(name, "class") == 0)
if(name == "class")
{
int tagCount = 0;
while(true)
@ -57,7 +57,7 @@ protected:
++tagCount;
}
}
else if(strcmp(name, "line") == 0)
else if(name == "line")
{
int tagCount = 0;
int curNumber = -1;
@ -85,7 +85,7 @@ protected:
}
}
virtual void EndElement(const char*) {}
virtual void EndElement(const std::string&) {}
private:

View File

@ -89,7 +89,7 @@ void cmCursesOptionsWidget::PreviousOption()
this->SetValue(this->Options[this->CurrentOption].c_str());
}
void cmCursesOptionsWidget::SetOption(const char* value)
void cmCursesOptionsWidget::SetOption(const std::string& value)
{
this->CurrentOption = 0; // default to 0 index
this->SetValue(value);

View File

@ -25,7 +25,7 @@ public:
// when this widget has focus. Returns true if the input was
// handled.
virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
void SetOption(const char*);
void SetOption(const std::string&);
void AddOption(std::string const &);
void NextOption();
void PreviousOption();

View File

@ -195,7 +195,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
return true;
}
void cmCursesStringWidget::SetString(const char* value)
void cmCursesStringWidget::SetString(const std::string& value)
{
this->SetValue(value);
}

View File

@ -37,7 +37,7 @@ public:
/**
* Set/Get the string.
*/
void SetString(const char* value);
void SetString(const std::string& value);
const char* GetString();
virtual const char* GetValue();

View File

@ -46,10 +46,10 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage)
}
}
void cmCursesWidget::SetValue(const char* value)
void cmCursesWidget::SetValue(const std::string& value)
{
this->Value = value;
set_field_buffer(this->Field, 0, value);
set_field_buffer(this->Field, 0, value.c_str());
}
const char* cmCursesWidget::GetValue()

View File

@ -40,7 +40,7 @@ public:
* Set/Get the value (setting the value also changes the contents
* of the field buffer).
*/
virtual void SetValue(const char* value);
virtual void SetValue(const std::string& value);
virtual const char* GetValue();
/**

View File

@ -94,7 +94,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
return this->LoadCache(path, internal, emptySet, emptySet);
}
static bool ParseEntryWithoutType(const char* entry,
static bool ParseEntryWithoutType(const std::string& entry,
std::string& var,
std::string& value)
{
@ -132,7 +132,7 @@ static bool ParseEntryWithoutType(const char* entry,
return flag;
}
bool cmCacheManager::ParseEntry(const char* entry,
bool cmCacheManager::ParseEntry(const std::string& entry,
std::string& var,
std::string& value,
CacheEntryType& type)

View File

@ -136,7 +136,7 @@ public:
return static_cast<int>(this->Cache.size()); }
///! Break up a line like VAR:type="value" into var, type and value
static bool ParseEntry(const char* entry,
static bool ParseEntry(const std::string& entry,
std::string& var,
std::string& value,
CacheEntryType& type);

View File

@ -50,7 +50,7 @@ public:
const char *GetMainExportFileName() const;
/** Set the namespace in which to place exported target names. */
void SetNamespace(const char* ns) { this->Namespace = ns; }
void SetNamespace(const std::string& ns) { this->Namespace = ns; }
std::string GetNamespace() const { return this->Namespace; }
void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }

View File

@ -1790,7 +1790,7 @@ int cmGlobalGenerator::Build(
//----------------------------------------------------------------------------
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
const std::string& target, const std::string& config,
const char* native,
const std::string& native,
bool ignoreErrors)
{
std::string makeCommand = cmSystemTools::GetCMakeCommand();
@ -1819,7 +1819,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
sep = " ";
}
}
if(native && *native)
if(!native.empty())
{
makeCommand += sep;
makeCommand += native;
@ -2528,9 +2528,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::AppendDirectoryForConfig(const char*,
void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&,
const std::string&,
const char*, std::string&)
const std::string&,
std::string&)
{
// Subclasses that support multiple configurations should implement
// this method to append the subdirectory for the given build

View File

@ -138,7 +138,7 @@ public:
/** Generate a "cmake --build" call for a given target and config. */
std::string GenerateCMakeBuildCommand(const std::string& target,
const std::string& config,
const char* native,
const std::string& native,
bool ignoreErrors);
///! Set the CMake instance
@ -230,9 +230,9 @@ public:
/** Append the subdirectory for the given configuration. If anything is
appended the given prefix and suffix will be appended around it, which
is useful for leading or trailing slashes. */
virtual void AppendDirectoryForConfig(const char* prefix,
virtual void AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir);
/** Get the manifest of all targets that will be built for each
@ -292,7 +292,7 @@ public:
return this->BinaryDirectories.insert(dir).second;
}
/** Supported systems creates a GUID for the given name */
virtual void CreateGUID(const char*) {}
virtual void CreateGUID(const std::string&) {}
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */

View File

@ -418,9 +418,9 @@ void cmGlobalVisualStudio6Generator
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio6Generator
::AppendDirectoryForConfig(const char* prefix,
::AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir)
{
if(!config.empty())

View File

@ -81,9 +81,9 @@ public:
std::vector<cmLocalGenerator*>& generators);
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
virtual void AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir);
///! What is the configurations directory variable called?

View File

@ -924,7 +924,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name)
}
void cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
{
std::string guidStoreName = name;
guidStoreName += "_GUID_CMAKE";
@ -961,9 +961,9 @@ void cmGlobalVisualStudio7Generator
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio7Generator
::AppendDirectoryForConfig(const char* prefix,
::AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir)
{
if(!config.empty())

View File

@ -89,13 +89,13 @@ public:
std::vector<std::string> *GetConfigurations();
///! Create a GUID or get an existing one.
void CreateGUID(const char* name);
void CreateGUID(const std::string& name);
std::string GetGUID(const std::string& name);
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
virtual void AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir);
///! What is the configurations directory variable called?

View File

@ -34,17 +34,17 @@ class cmXcodeVersionParser : public cmXMLParser
{
public:
cmXcodeVersionParser(): Version("1.5") {}
void StartElement(const char* , const char** )
void StartElement(const std::string&, const char**)
{
this->Data = "";
}
void EndElement(const char* name)
void EndElement(const std::string& name)
{
if(strcmp(name, "key") == 0)
if(name == "key")
{
this->Key = this->Data;
}
else if(strcmp(name, "string") == 0)
else if(name == "string")
{
if(this->Key == "CFBundleShortVersionString")
{
@ -1005,7 +1005,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
gtgt->GetTargetSourceFileFlags(*i);
if(filetype &&
strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0)
filetype->GetString() == "compiled.mach-o.objfile")
{
externalObjFiles.push_back(xsf);
}
@ -3771,9 +3771,9 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p)
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator
::AppendDirectoryForConfig(const char* prefix,
::AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir)
{
if(this->XcodeVersion > 20)

View File

@ -72,9 +72,9 @@ public:
virtual void Generate();
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
virtual void AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
const char* suffix,
const std::string& suffix,
std::string& dir);
///! What is the configurations directory variable called?

View File

@ -1299,7 +1299,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
::CreateMakeVariable(const char* sin, const char* s2in)
::CreateMakeVariable(const std::string& sin, const std::string& s2in)
{
std::string s = sin;
std::string s2 = s2in;

View File

@ -75,7 +75,7 @@ public:
/**
* Set the flag used to keep the make program silent.
*/
void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; }
void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; }
std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; }
/**
@ -130,8 +130,9 @@ public:
* Set the string used to include one makefile into another default
* is include.
*/
void SetIncludeDirective(const char* s) { this->IncludeDirective = s; }
const char *GetIncludeDirective() { return this->IncludeDirective.c_str(); }
void SetIncludeDirective(const std::string& s)
{ this->IncludeDirective = s; }
const std::string& GetIncludeDirective() { return this->IncludeDirective; }
/**
* Set max makefile variable size, default is 0 which means unlimited.
@ -192,7 +193,8 @@ public:
static std::string ConvertToQuotedOutputPath(const char* p);
std::string CreateMakeVariable(const char* sin, const char* s2in);
std::string CreateMakeVariable(const std::string& sin,
const std::string& s2in);
/** Called from command-line hook to bring dependencies up to date
for a target. */

View File

@ -19,7 +19,7 @@
class cmVS10XMLParser : public cmXMLParser
{
public:
virtual void EndElement(const char* /* name */)
virtual void EndElement(const std::string& /* name */)
{
}
virtual void CharacterDataHandler(const char* data, int length)
@ -30,14 +30,14 @@ class cmVS10XMLParser : public cmXMLParser
this->DoGUID = false;
}
}
virtual void StartElement(const char* name, const char**)
virtual void StartElement(const std::string& name, const char**)
{
// once the GUID is found do nothing
if(this->GUID.size())
{
return;
}
if(strcmp("ProjectGUID", name) == 0 || strcmp("ProjectGuid", name) == 0)
if("ProjectGUID" == name || "ProjectGuid" == name)
{
this->DoGUID = true;
}
@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator::Generate()
void cmLocalVisualStudio10Generator
::ReadAndStoreExternalGUID(const char* name,
::ReadAndStoreExternalGUID(const std::string& name,
const char* path)
{
cmVS10XMLParser parser;

View File

@ -34,7 +34,7 @@ public:
* Generate the makefile for this directory.
*/
virtual void Generate();
virtual void ReadAndStoreExternalGUID(const char* name,
virtual void ReadAndStoreExternalGUID(const std::string& name,
const char* path);
protected:

View File

@ -2146,10 +2146,10 @@ std::string cmLocalVisualStudio7Generator
class cmVS7XMLParser : public cmXMLParser
{
public:
virtual void EndElement(const char* /* name */)
virtual void EndElement(const std::string& /* name */)
{
}
virtual void StartElement(const char* name, const char** atts)
virtual void StartElement(const std::string& name, const char** atts)
{
// once the GUID is found do nothing
if(this->GUID.size())
@ -2157,7 +2157,7 @@ public:
return;
}
int i =0;
if(strcmp("VisualStudioProject", name) == 0)
if("VisualStudioProject" == name)
{
while(atts[i])
{
@ -2194,7 +2194,7 @@ public:
};
void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
const char* name,
const std::string& name,
const char* path)
{
cmVS7XMLParser parser;

View File

@ -51,7 +51,7 @@ public:
/**
* Specify the type of the build: static, dll, or executable.
*/
void SetBuildType(BuildType,const char *name);
void SetBuildType(BuildType,const std::string& name);
void SetPlatformName(const char* n) { this->PlatformName = n;}
@ -62,7 +62,7 @@ public:
void WriteStampFiles();
virtual std::string ComputeLongestObjectDirectory(cmTarget&) const;
virtual void ReadAndStoreExternalGUID(const char* name,
virtual void ReadAndStoreExternalGUID(const std::string& name,
const char* path);
virtual void AddCMakeListsRules();
protected:

View File

@ -81,7 +81,7 @@ std::string
cmLocalVisualStudioGenerator
::ConstructScript(cmCustomCommand const& cc,
const std::string& configName,
const char* newline_text)
const std::string& newline_text)
{
bool useLocal = this->CustomCommandUseLocal();
const char* workingDirectory = cc.GetWorkingDirectory();
@ -89,7 +89,7 @@ cmLocalVisualStudioGenerator
RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT;
// Avoid leading or trailing newlines.
const char* newline = "";
std::string newline = "";
// Line to check for error between commands.
std::string check_error = newline_text;

View File

@ -48,7 +48,7 @@ public:
/** Construct a script from the given list of command lines. */
std::string ConstructScript(cmCustomCommand const& cc,
const std::string& configName,
const char* newline = "\n");
const std::string& newline = "\n");
/** Label to which to jump in a batch file after a failed step in a
sequence of custom commands. */

View File

@ -4100,7 +4100,8 @@ bool cmTarget::ComputeOutputDir(const std::string& config,
}
//----------------------------------------------------------------------------
bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config,
bool cmTarget::ComputePDBOutputDir(const std::string& kind,
const std::string& config,
std::string& out) const
{
// Look for a target property defining the target output directory

View File

@ -714,7 +714,7 @@ private:
bool
ComputeOutputDir(const std::string& config,
bool implib, std::string& out) const;
bool ComputePDBOutputDir(const char* kind, const std::string& config,
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const;
// Cache import information from properties for each configuration.

View File

@ -62,7 +62,7 @@ const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const
return 0;
}
void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name,
const char** attributes)
{
if(this->FoundRequiredName)
@ -72,7 +72,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->CharacterData = "";
if(strcmp(name, "PlatformData") == 0)
if(name == "PlatformData")
{
this->PlatformName = "";
this->OSMajorVersion = "";
@ -80,7 +80,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->Macros.clear();
}
if(strcmp(name, "Macro") == 0)
if(name == "Macro")
{
std::string macroName;
std::string macroValue;
@ -102,7 +102,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->Macros[macroName] = macroValue;
}
}
else if(strcmp(name, "Directories") == 0)
else if(name == "Directories")
{
for(const char** attr = attributes; *attr; attr += 2)
{
@ -122,11 +122,11 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
}
}
void cmVisualStudioWCEPlatformParser::EndElement(const char* name)
void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name)
{
if(!this->RequiredName)
{
if(strcmp(name, "PlatformName") == 0)
if(name == "PlatformName")
{
this->AvailablePlatforms.push_back(this->CharacterData);
}
@ -138,19 +138,19 @@ void cmVisualStudioWCEPlatformParser::EndElement(const char* name)
return;
}
if(strcmp(name, "PlatformName") == 0)
if(name == "PlatformName")
{
this->PlatformName = this->CharacterData;
}
else if(strcmp(name, "OSMajorVersion") == 0)
else if(name == "OSMajorVersion")
{
this->OSMajorVersion = this->CharacterData;
}
else if(strcmp(name, "OSMinorVersion") == 0)
else if(name == "OSMinorVersion")
{
this->OSMinorVersion = this->CharacterData;
}
else if(strcmp(name, "Platform") == 0)
else if(name == "Platform")
{
if(this->PlatformName == this->RequiredName)
{

View File

@ -41,8 +41,8 @@ public:
return this->AvailablePlatforms; }
protected:
virtual void StartElement(const char* name, const char** attributes);
void EndElement(const char* name);
virtual void StartElement(const std::string& name, const char** attributes);
void EndElement(const std::string& name);
void CharacterDataHandler(const char* data, int length);
private:

View File

@ -38,12 +38,12 @@ public:
PBXType GetIsA() { return this->IsA;}
void SetString(const std::string& s);
const char* GetString()
const std::string& GetString()
{
return this->String.c_str();
return this->String;
}
void AddAttribute(const char* name, cmXCodeObject* value)
void AddAttribute(const std::string& name, cmXCodeObject* value)
{
this->ObjectAttributes[name] = value;
}
@ -79,11 +79,11 @@ public:
static void PrintList(std::vector<cmXCodeObject*> const&,
std::ostream& out);
const char* GetId()
const std::string& GetId()
{
return this->Id.c_str();
return this->Id;
}
void SetId(const char* id)
void SetId(const std::string& id)
{
this->Id = id;
}
@ -95,8 +95,8 @@ public:
{
this->Target = t;
}
const char* GetComment() {return this->Comment.c_str();}
bool HasComment() { return (this->Comment.size() != 0);}
const std::string& GetComment() {return this->Comment;}
bool HasComment() { return (!this->Comment.empty());}
cmXCodeObject* GetObject(const char* name)
{
if(this->ObjectAttributes.count(name))
@ -141,7 +141,7 @@ public:
return this->DependTargets;
}
std::vector<cmXCodeObject*> const& GetObjectList() { return this->List;}
void SetComment(const char* c) { this->Comment = c;}
void SetComment(const std::string& c) { this->Comment = c;}
static void PrintString(std::ostream& os,std::string String);
protected:
void PrintString(std::ostream& os) const;

View File

@ -152,14 +152,14 @@ int cmXMLParser::ParsingComplete()
}
//----------------------------------------------------------------------------
void cmXMLParser::StartElement(const char * name,
void cmXMLParser::StartElement(const std::string& name,
const char ** /*atts*/)
{
std::cout << "Start element: " << name << std::endl;
}
//----------------------------------------------------------------------------
void cmXMLParser::EndElement(const char * name)
void cmXMLParser::EndElement(const std::string& name)
{
std::cout << "End element: " << name << std::endl;
}

View File

@ -74,11 +74,11 @@ protected:
* element. atts = Null-terminated array of attribute name/value pairs.
* Even indices are attribute names, and odd indices are values.
*/
virtual void StartElement(const char* name, const char** atts);
virtual void StartElement(const std::string& name, const char** atts);
//! Called at the end of an element in the XML source opened when
//StartElement was called.
virtual void EndElement(const char* name);
virtual void EndElement(const std::string& name);
//! Called when there is character data to handle.
virtual void CharacterDataHandler(const char* data, int length);