cmVisualStudioGeneratorOptions: Simplify XML escaping API
Accept arguments as std::string to avoid c_str() calls.
This commit is contained in:
parent
1c209ac165
commit
8fa087ab38
@ -3,9 +3,9 @@
|
|||||||
#include <cmsys/System.h>
|
#include <cmsys/System.h>
|
||||||
#include "cmVisualStudio10TargetGenerator.h"
|
#include "cmVisualStudio10TargetGenerator.h"
|
||||||
|
|
||||||
inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s)
|
static
|
||||||
|
std::string cmVisualStudio10GeneratorOptionsEscapeForXML(std::string ret)
|
||||||
{
|
{
|
||||||
std::string ret = s;
|
|
||||||
cmSystemTools::ReplaceString(ret, ";", "%3B");
|
cmSystemTools::ReplaceString(ret, ";", "%3B");
|
||||||
cmSystemTools::ReplaceString(ret, "&", "&");
|
cmSystemTools::ReplaceString(ret, "&", "&");
|
||||||
cmSystemTools::ReplaceString(ret, "<", "<");
|
cmSystemTools::ReplaceString(ret, "<", "<");
|
||||||
@ -13,9 +13,9 @@ inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s)
|
static
|
||||||
|
std::string cmVisualStudioGeneratorOptionsEscapeForXML(std::string ret)
|
||||||
{
|
{
|
||||||
std::string ret = s;
|
|
||||||
cmSystemTools::ReplaceString(ret, "&", "&");
|
cmSystemTools::ReplaceString(ret, "&", "&");
|
||||||
cmSystemTools::ReplaceString(ret, "\"", """);
|
cmSystemTools::ReplaceString(ret, "\"", """);
|
||||||
cmSystemTools::ReplaceString(ret, "<", "<");
|
cmSystemTools::ReplaceString(ret, "<", "<");
|
||||||
@ -269,7 +269,7 @@ cmVisualStudioGeneratorOptions
|
|||||||
// Escape this flag for the IDE.
|
// Escape this flag for the IDE.
|
||||||
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
|
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
|
||||||
{
|
{
|
||||||
define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str());
|
define = cmVisualStudio10GeneratorOptionsEscapeForXML(define);
|
||||||
|
|
||||||
if(lang == "RC")
|
if(lang == "RC")
|
||||||
{
|
{
|
||||||
@ -278,7 +278,7 @@ cmVisualStudioGeneratorOptions
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
define = cmVisualStudioGeneratorOptionsEscapeForXML(define.c_str());
|
define = cmVisualStudioGeneratorOptionsEscapeForXML(define);
|
||||||
}
|
}
|
||||||
// Store the flag in the project file.
|
// Store the flag in the project file.
|
||||||
fout << sep << define;
|
fout << sep << define;
|
||||||
@ -379,8 +379,7 @@ cmVisualStudioGeneratorOptions
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
fout << prefix << "AdditionalOptions=\"";
|
fout << prefix << "AdditionalOptions=\"";
|
||||||
fout <<
|
fout << cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString);
|
||||||
cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString.c_str());
|
|
||||||
fout << "\"" << suffix;
|
fout << "\"" << suffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user