summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-12-11 23:13:33 (GMT)
committerBrad King <brad.king@kitware.com>2002-12-11 23:13:33 (GMT)
commit4888c088ae0ca829862e8b2f9568abca12dc34d1 (patch)
tree2c0fb825f1d1adff97d98373b555f00b84da14f7 /Source/cmListFileCache.h
parent5a321605bcc15c7e559c8da5168eef00796148b1 (diff)
downloadCMake-4888c088ae0ca829862e8b2f9568abca12dc34d1.zip
CMake-4888c088ae0ca829862e8b2f9568abca12dc34d1.tar.gz
CMake-4888c088ae0ca829862e8b2f9568abca12dc34d1.tar.bz2
ENH: Moved ExpandListVariables out of individual commands. Argument evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside.
Diffstat (limited to 'Source/cmListFileCache.h')
-rw-r--r--Source/cmListFileCache.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 2520eca..9dc8073 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -26,10 +26,25 @@
* cmake list files.
*/
+struct cmListFileArgument
+{
+ cmListFileArgument(): Value(), Quoted(false) {}
+ cmListFileArgument(const cmListFileArgument& r): Value(r.Value), Quoted(r.Quoted) {}
+ cmListFileArgument(const std::string& v, bool q): Value(v), Quoted(q) {}
+ bool operator == (const cmListFileArgument& r) const
+ {
+ return (this->Value == r.Value) && (this->Quoted == r.Quoted);
+ }
+ std::string Value;
+ bool Quoted;
+};
+
struct cmListFileFunction
{
std::string m_Name;
- std::vector<std::string> m_Arguments;
+ std::vector<cmListFileArgument> m_Arguments;
+ std::string m_FilePath;
+ long m_Line;
};
struct cmListFile
@@ -60,7 +75,25 @@ public:
//! Flush cache file out of cache.
void FlushCache(const char* path);
+
+ /**
+ * Read a CMake command (or function) from an input file. This
+ * returns the name of the function and a list of its
+ * arguments. The last argument is the name of the file that
+ * the ifstream points to, and is used for debug info only.
+ */
+ static bool ParseFunction(std::ifstream&, cmListFileFunction& function,
+ const char* filename, bool& parseError,
+ long* line = 0);
+ /**
+ * Extract white-space separated arguments from a string.
+ * Double quoted strings are accepted with spaces.
+ * This is called by ParseFunction.
+ */
+ static void GetArguments(std::string& line,
+ std::vector<cmListFileArgument>& arguments);
+
private:
// Cache the file
bool CacheFile(const char* path, bool requireProjectCommand);