summaryrefslogtreecommitdiffstats
path: root/Source/cmStringCommand.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 17:42:58 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-13 18:18:39 (GMT)
commit7bbaa4283de26864b2e55e819db0884771585467 (patch)
treeecb748dbe41a13d8bdea77acd0049cde999d933e /Source/cmStringCommand.cxx
parentbe9db98946b7918f279812fd0616abb650eebed0 (diff)
downloadCMake-7bbaa4283de26864b2e55e819db0884771585467.zip
CMake-7bbaa4283de26864b2e55e819db0884771585467.tar.gz
CMake-7bbaa4283de26864b2e55e819db0884771585467.tar.bz2
Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with trailing whitespace. Wipe out all remnants of trailing whitespace everywhere except third-party code. Run the following shell code: git ls-files -z -- \ bootstrap doxygen.config '*.readme' \ '*.c' '*.cmake' '*.cpp' '*.cxx' \ '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \ '*.mm' '*.pike' '*.py' '*.txt' '*.vim' | egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' | egrep -z -v '^(Modules/CPack\..*\.in)' | xargs -0 sed -i 's/ \+$//'
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r--Source/cmStringCommand.cxx72
1 files changed, 36 insertions, 36 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index ec10d57..0193dc9 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -28,7 +28,7 @@ bool cmStringCommand
this->SetError("must be called with at least one argument.");
return false;
}
-
+
const std::string &subCommand = args[0];
if(subCommand == "REGEX")
{
@@ -134,11 +134,11 @@ bool cmStringCommand::HandleToUpperLowerCommand(
std::string outvar = args[2];
std::string output;
- if (toUpper)
+ if (toUpper)
{
output = cmSystemTools::UpperCase(args[1]);
- }
- else
+ }
+ else
{
output = cmSystemTools::LowerCase(args[1]);
}
@@ -266,7 +266,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args)
}
return this->RegexReplace(args);
}
-
+
std::string e = "sub-command REGEX does not recognize mode "+mode;
this->SetError(e.c_str());
return false;
@@ -279,25 +279,25 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
// <input> [<input>...])\n";
std::string regex = args[2];
std::string outvar = args[3];
-
+
// Concatenate all the last arguments together.
std::string input = args[4];
for(unsigned int i=5; i < args.size(); ++i)
{
input += args[i];
}
-
+
this->ClearMatches(this->Makefile);
// Compile the regular expression.
cmsys::RegularExpression re;
if(!re.compile(regex.c_str()))
{
- std::string e =
+ std::string e =
"sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\".";
this->SetError(e.c_str());
return false;
}
-
+
// Scan through the input for all matches.
std::string output;
if(re.find(input.c_str()))
@@ -307,7 +307,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
std::string::size_type r = re.end();
if(r-l == 0)
{
- std::string e =
+ std::string e =
"sub-command REGEX, mode MATCH regex \""+regex+
"\" matched an empty string.";
this->SetError(e.c_str());
@@ -315,7 +315,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
}
output = input.substr(l, r-l);
}
-
+
// Store the output in the provided variable.
this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
return true;
@@ -324,18 +324,18 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
//----------------------------------------------------------------------------
bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
{
- //"STRING(REGEX MATCHALL <regular_expression> <output variable> <input>
+ //"STRING(REGEX MATCHALL <regular_expression> <output variable> <input>
// [<input>...])\n";
std::string regex = args[2];
std::string outvar = args[3];
-
+
// Concatenate all the last arguments together.
std::string input = args[4];
for(unsigned int i=5; i < args.size(); ++i)
{
input += args[i];
}
-
+
this->ClearMatches(this->Makefile);
// Compile the regular expression.
cmsys::RegularExpression re;
@@ -347,7 +347,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
this->SetError(e.c_str());
return false;
}
-
+
// Scan through the input for all matches.
std::string output;
const char* p = input.c_str();
@@ -370,7 +370,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
output += std::string(p+l, r-l);
p += r;
}
-
+
// Store the output in the provided variable.
this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
return true;
@@ -379,12 +379,12 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
//----------------------------------------------------------------------------
bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
{
- //"STRING(REGEX REPLACE <regular_expression> <replace_expression>
+ //"STRING(REGEX REPLACE <regular_expression> <replace_expression>
// <output variable> <input> [<input>...])\n"
std::string regex = args[2];
- std::string replace = args[3];
+ std::string replace = args[3];
std::string outvar = args[4];
-
+
// Pull apart the replace expression to find the escaped [0-9] values.
std::vector<RegexReplacement> replacement;
std::string::size_type l = 0;
@@ -432,26 +432,26 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
}
l = r;
}
-
+
// Concatenate all the last arguments together.
std::string input = args[5];
for(unsigned int i=6; i < args.size(); ++i)
{
input += args[i];
}
-
+
this->ClearMatches(this->Makefile);
// Compile the regular expression.
cmsys::RegularExpression re;
if(!re.compile(regex.c_str()))
{
- std::string e =
+ std::string e =
"sub-command REGEX, mode REPLACE failed to compile regex \""+
regex+"\".";
this->SetError(e.c_str());
return false;
}
-
+
// Scan through the input for all matches.
std::string output;
std::string::size_type base = 0;
@@ -460,10 +460,10 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
this->StoreMatches(this->Makefile, re);
std::string::size_type l2 = re.start();
std::string::size_type r = re.end();
-
+
// Concatenate the part of the input that was not matched.
output += input.substr(base, l2);
-
+
// Make sure the match had some text.
if(r-l2 == 0)
{
@@ -472,7 +472,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
this->SetError(e.c_str());
return false;
}
-
+
// Concatenate the replacement for the match.
for(unsigned int i=0; i < replacement.size(); ++i)
{
@@ -504,14 +504,14 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
}
}
}
-
+
// Move past the match.
base += r;
}
-
+
// Concatenate the text after the last match.
output += input.substr(base, input.length()-base);
-
+
// Store the output in the provided variable.
this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
return true;
@@ -624,9 +624,9 @@ bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const&
this->SetError(e.c_str());
return false;
}
-
+
const std::string& left = args[2];
- const std::string& right = args[3];
+ const std::string& right = args[3];
const std::string& outvar = args[4];
bool result;
if(mode == "LESS")
@@ -654,7 +654,7 @@ bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const&
this->Makefile->AddDefinition(outvar.c_str(), "0");
}
return true;
- }
+ }
std::string e = "sub-command COMPARE does not recognize mode "+mode;
this->SetError(e.c_str());
return false;
@@ -680,7 +680,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
input += args[i];
}
- cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
+ cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
replaceExpression.c_str());
this->Makefile->AddDefinition(variableName.c_str(), input.c_str());
@@ -688,7 +688,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
}
//----------------------------------------------------------------------------
-bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
+bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
args)
{
if(args.size() != 5)
@@ -722,7 +722,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
return false;
}
- this->Makefile->AddDefinition(variableName.c_str(),
+ this->Makefile->AddDefinition(variableName.c_str(),
stringValue.substr(begin, end).c_str());
return true;
}
@@ -780,7 +780,7 @@ bool cmStringCommand::HandleStripCommand(
size_t outLength = 0;
- // if the input string didn't contain any non-space characters, return
+ // if the input string didn't contain any non-space characters, return
// an empty string
if (startPos > inStringLength)
{