diff options
author | Brad King <brad.king@kitware.com> | 2009-02-05 21:31:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-02-05 21:31:37 (GMT) |
commit | dc13914cd698b49cbae491c1e1aebbcd44fbe932 (patch) | |
tree | 4eaa716c3e2160a7e81125360d83dc9f87241ede /Source/CTest/cmCTestCoverageHandler.cxx | |
parent | f16a471576199ec275463e35ff17849350c0da79 (diff) | |
download | CMake-dc13914cd698b49cbae491c1e1aebbcd44fbe932.zip CMake-dc13914cd698b49cbae491c1e1aebbcd44fbe932.tar.gz CMake-dc13914cd698b49cbae491c1e1aebbcd44fbe932.tar.bz2 |
ENH: Create cmXMLSafe to help escapes in XML
This class provides easy syntax to efficiently insert blocks of data
into XML documents with proper escapes. It replaces the old
cmCTest::MakeXMLSafe and cmSystemTools::MakeXMLSafe methods which
allocated extra memory instead of directly streaming the data.
Diffstat (limited to 'Source/CTest/cmCTestCoverageHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 8f73220..40dac00 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -19,6 +19,7 @@ #include "cmake.h" #include "cmSystemTools.h" #include "cmGeneratedFileStream.h" +#include "cmXMLSafe.h" #include <cmsys/Process.h> #include <cmsys/RegularExpression.hxx> @@ -470,8 +471,8 @@ int cmCTestCoverageHandler::ProcessHandler() const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov = fileIterator->second; covLogFile << "\t<File Name=\"" - << this->CTest->MakeXMLSafe(fileName.c_str()) - << "\" FullPath=\"" << this->CTest->MakeXMLSafe( + << cmXMLSafe(fileName) + << "\" FullPath=\"" << cmXMLSafe( this->CTest->GetShortPathToFile( fileIterator->first.c_str())) << "\">" << std::endl << "\t\t<Report>" << std::endl; @@ -507,7 +508,7 @@ int cmCTestCoverageHandler::ProcessHandler() } covLogFile << "\t\t<Line Number=\"" << cc << "\" Count=\"" << fcov[cc] << "\">" - << this->CTest->MakeXMLSafe(line.c_str()) << "</Line>" << std::endl; + << cmXMLSafe(line) << "</Line>" << std::endl; if ( fcov[cc] == 0 ) { untested ++; @@ -536,8 +537,8 @@ int cmCTestCoverageHandler::ProcessHandler() total_untested += untested; covLogFile << "\t\t</Report>" << std::endl << "\t</File>" << std::endl; - covSumFile << "\t<File Name=\"" << this->CTest->MakeXMLSafe(fileName) - << "\" FullPath=\"" << this->CTest->MakeXMLSafe( + covSumFile << "\t<File Name=\"" << cmXMLSafe(fileName) + << "\" FullPath=\"" << cmXMLSafe( this->CTest->GetShortPathToFile(fullFileName.c_str())) << "\" Covered=\"" << (tested > 0 ? "true":"false") << "\">\n" << "\t\t<LOCTested>" << tested << "</LOCTested>\n" @@ -1329,8 +1330,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( << std::endl); // start the file output covLogFile << "\t<File Name=\"" - << this->CTest->MakeXMLSafe(i->first.c_str()) - << "\" FullPath=\"" << this->CTest->MakeXMLSafe( + << cmXMLSafe(i->first) + << "\" FullPath=\"" << cmXMLSafe( this->CTest->GetShortPathToFile( i->second.c_str())) << "\">" << std::endl << "\t\t<Report>" << std::endl; @@ -1339,7 +1340,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( for(int k =0; bullseyeHelp[k] != 0; ++k) { covLogFile << "\t\t<Line Number=\"" << line << "\" Count=\"-1\">" - << this->CTest->MakeXMLSafe(bullseyeHelp[k]) + << cmXMLSafe(bullseyeHelp[k]) << "</Line>" << std::endl; line++; } @@ -1355,7 +1356,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( else if(valid) { covLogFile << "\t\t<Line Number=\"" << line << "\" Count=\"-1\">" - << this->CTest->MakeXMLSafe(lineIn.c_str()) + << cmXMLSafe(lineIn) << "</Line>" << std::endl; line++; } @@ -1561,8 +1562,8 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( tmpLog << "percentBranch: " << percentBranch << "\n"; tmpLog << "percentCoverage: " << percent_coverage << "\n"; tmpLog << "coverage metric: " << cmet << "\n"; - covSumFile << "\t<File Name=\"" << this->CTest->MakeXMLSafe(sourceFile) - << "\" FullPath=\"" << this->CTest->MakeXMLSafe( + covSumFile << "\t<File Name=\"" << cmXMLSafe(sourceFile) + << "\" FullPath=\"" << cmXMLSafe( this->CTest->GetShortPathToFile(file.c_str())) << "\" Covered=\"" << (cmet>0?"true":"false") << "\">\n" << "\t\t<BranchesTested>" |