summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2010-11-22 20:14:21 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2010-11-22 20:14:21 (GMT)
commit90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb (patch)
tree040ab8b45cf1d17df40d4c76fbcba0d2adb3cdd9
parent6fe8624b7ff39f8511f4f4d7ebcbc5681932a6a5 (diff)
downloadCMake-90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb.zip
CMake-90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb.tar.gz
CMake-90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb.tar.bz2
Use cmCacheManager to load entries from the cache
-rw-r--r--Source/cmLoadCacheCommand.cxx39
-rw-r--r--Source/cmLoadCacheCommand.h1
2 files changed, 3 insertions, 37 deletions
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index d2a07dc..b06e2f9 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -174,7 +174,9 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// Check one line of the cache file.
std::string var;
std::string value;
- if(this->ParseEntry(line, var, value))
+ cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+ if(cmCacheManager::ParseEntry(line, var, value, type) ||
+ cmCacheManager::ParseEntry(line, var, value))
{
// Found a real entry. See if this one was requested.
if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
@@ -193,38 +195,3 @@ void cmLoadCacheCommand::CheckLine(const char* line)
}
}
}
-
-//----------------------------------------------------------------------------
-bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var,
- std::string& value)
-{
- // input line is: key:type=value
- cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
- // input line is: "key":type=value
- cmsys::RegularExpression
- regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
- bool flag = false;
- if(regQuoted.find(entry))
- {
- var = regQuoted.match(1);
- value = regQuoted.match(3);
- flag = true;
- }
- else if (reg.find(entry))
- {
- var = reg.match(1);
- value = reg.match(3);
- flag = true;
- }
-
- // if value is enclosed in single quotes ('foo') then remove them
- // it is used to enclose trailing space or tab
- if (flag &&
- value.size() >= 2 &&
- value[0] == '\'' &&
- value[value.size() - 1] == '\'')
- {
- value = value.substr(1, value.size() - 2);
- }
- return flag;
-}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index b06d94d..8ecee4a 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -83,7 +83,6 @@ protected:
bool ReadWithPrefix(std::vector<std::string> const& args);
void CheckLine(const char* line);
- bool ParseEntry(const char* entry, std::string& var, std::string& value);
};