summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-08-06 10:07:58 -0400
committerBrad King <brad.king@kitware.com>2013-08-08 13:26:27 -0400
commit0546484e4b7856c417f30a5b8ff6af6a5a080f0d (patch)
tree3ef8308e1115129bf5777a65a0525b0e81ff58e4 /Source
parent28685ade7a8f60e8519b6bf8a824e6a01365c181 (diff)
downloadcmake-0546484e4b7856c417f30a5b8ff6af6a5a080f0d.tar.gz
cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum
Replace the boolean value that indicates whether an argument is unquoted or quoted with a generalized enumeration of possible argument types. For now "Quoted" and "Unquoted" remain the only types.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCPluginAPI.cxx5
-rw-r--r--Source/cmListFileCache.cxx19
-rw-r--r--Source/cmListFileCache.h17
-rw-r--r--Source/cmMacroCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmVariableWatchCommand.cxx15
-rw-r--r--Source/cmWhileCommand.cxx4
7 files changed, 38 insertions, 26 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 48ae50e42f..cb62f21e69 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -422,8 +422,9 @@ int CCONV cmExecuteCommand(void *arg, const char *name,
for(int i = 0; i < numArgs; ++i)
{
// Assume all arguments are quoted.
- lff.Arguments.push_back(cmListFileArgument(args[i], true,
- "[CMake-Plugin]", 0));
+ lff.Arguments.push_back(
+ cmListFileArgument(args[i], cmListFileArgument::Quoted,
+ "[CMake-Plugin]", 0));
}
cmExecutionStatus status;
return mf->ExecuteCommand(lff,status);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 36d84f3be3..7b25351cb0 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -196,7 +196,8 @@ bool cmListFile::ParseFile(const char* filename,
{
cmListFileFunction project;
project.Name = "PROJECT";
- cmListFileArgument prj("Project", false, filename, 0);
+ cmListFileArgument prj("Project", cmListFileArgument::Unquoted,
+ filename, 0);
project.Arguments.push_back(prj);
this->Functions.insert(this->Functions.begin(),project);
}
@@ -243,8 +244,8 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
if(token->type == cmListFileLexer_Token_ParenLeft)
{
parenDepth++;
- cmListFileArgument a("(",
- false, filename, token->line);
+ cmListFileArgument a("(", cmListFileArgument::Unquoted,
+ filename, token->line);
function.Arguments.push_back(a);
}
else if(token->type == cmListFileLexer_Token_ParenRight)
@@ -254,21 +255,21 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
return true;
}
parenDepth--;
- cmListFileArgument a(")",
- false, filename, token->line);
+ cmListFileArgument a(")", cmListFileArgument::Unquoted,
+ filename, token->line);
function.Arguments.push_back(a);
}
else if(token->type == cmListFileLexer_Token_Identifier ||
token->type == cmListFileLexer_Token_ArgumentUnquoted)
{
- cmListFileArgument a(token->text,
- false, filename, token->line);
+ cmListFileArgument a(token->text, cmListFileArgument::Unquoted,
+ filename, token->line);
function.Arguments.push_back(a);
}
else if(token->type == cmListFileLexer_Token_ArgumentQuoted)
{
- cmListFileArgument a(token->text,
- true, filename, token->line);
+ cmListFileArgument a(token->text, cmListFileArgument::Quoted,
+ filename, token->line);
function.Arguments.push_back(a);
}
else if(token->type != cmListFileLexer_Token_Newline)
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index fec3d07d89..7bb3b346c4 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -25,22 +25,27 @@ class cmMakefile;
struct cmListFileArgument
{
- cmListFileArgument(): Value(), Quoted(false), FilePath(0), Line(0) {}
+ enum Delimiter
+ {
+ Unquoted,
+ Quoted
+ };
+ cmListFileArgument(): Value(), Delim(Unquoted), FilePath(0), Line(0) {}
cmListFileArgument(const cmListFileArgument& r):
- Value(r.Value), Quoted(r.Quoted), FilePath(r.FilePath), Line(r.Line) {}
- cmListFileArgument(const std::string& v, bool q, const char* file,
- long line): Value(v), Quoted(q),
+ Value(r.Value), Delim(r.Delim), FilePath(r.FilePath), Line(r.Line) {}
+ cmListFileArgument(const std::string& v, Delimiter d, const char* file,
+ long line): Value(v), Delim(d),
FilePath(file), Line(line) {}
bool operator == (const cmListFileArgument& r) const
{
- return (this->Value == r.Value) && (this->Quoted == r.Quoted);
+ return (this->Value == r.Value) && (this->Delim == r.Delim);
}
bool operator != (const cmListFileArgument& r) const
{
return !(*this == r);
}
std::string Value;
- bool Quoted;
+ Delimiter Delim;
const char* FilePath;
long Line;
};
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index bd7ec004be..8ba612cc95 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -227,7 +227,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
}
arg.Value = tmps;
- arg.Quoted = k->Quoted;
+ arg.Delim = k->Delim;
arg.FilePath = k->FilePath;
arg.Line = k->Line;
newLFF.Arguments.push_back(arg);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index aae92dd898..c4859b666a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2799,7 +2799,7 @@ bool cmMakefile::ExpandArguments(
// If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments.
- if(i->Quoted)
+ if(i->Delim == cmListFileArgument::Quoted)
{
outArgs.push_back(value);
}
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 297a92b934..70c65241cf 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -86,15 +86,20 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
std::string command = *it;
newLFF.Arguments.clear();
newLFF.Arguments.push_back(
- cmListFileArgument(variable, true, "unknown", 9999));
+ cmListFileArgument(variable, cmListFileArgument::Quoted,
+ "unknown", 9999));
newLFF.Arguments.push_back(
- cmListFileArgument(accessString, true, "unknown", 9999));
+ cmListFileArgument(accessString, cmListFileArgument::Quoted,
+ "unknown", 9999));
newLFF.Arguments.push_back(
- cmListFileArgument(newValue?newValue:"", true, "unknown", 9999));
+ cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted,
+ "unknown", 9999));
newLFF.Arguments.push_back(
- cmListFileArgument(currentListFile, true, "unknown", 9999));
+ cmListFileArgument(currentListFile, cmListFileArgument::Quoted,
+ "unknown", 9999));
newLFF.Arguments.push_back(
- cmListFileArgument(stack, true, "unknown", 9999));
+ cmListFileArgument(stack, cmListFileArgument::Quoted,
+ "unknown", 9999));
newLFF.Name = command;
newLFF.FilePath = "Some weird path";
newLFF.Line = 9999;
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 400034582f..7d2eeadd66 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -49,9 +49,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
unsigned int i;
for(i =0; i < this->Args.size(); ++i)
{
- err += (this->Args[i].Quoted?"\"":"");
+ err += (this->Args[i].Delim?"\"":"");
err += this->Args[i].Value;
- err += (this->Args[i].Quoted?"\"":"");
+ err += (this->Args[i].Delim?"\"":"");
err += " ";
}
err += "(";