diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-10 15:08:15 +0200 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-10 15:36:59 +0200 |
commit | e2eecae20517daa2bb292f85e161d5cebbc1f216 (patch) | |
tree | 50a14e5929938c0716b4031e84b7bde66adbbf83 /Source/cmCacheManager.cxx | |
parent | b5212c68def0395642fc51dcfd499557eb9481d9 (diff) | |
download | cmake-e2eecae20517daa2bb292f85e161d5cebbc1f216.tar.gz |
cmState: Move ParseCacheEntry from cmCacheManager.
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index bfa60b387a..ce8af55db3 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -27,90 +27,6 @@ cmCacheManager::cmCacheManager() this->CacheMinorVersion = 0; } -static bool ParseEntryWithoutType(const std::string& entry, - std::string& var, - std::string& value) -{ - // input line is: key=value - static cmsys::RegularExpression reg( - "^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - // input line is: "key"=value - static cmsys::RegularExpression regQuoted( - "^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - bool flag = false; - if(regQuoted.find(entry)) - { - var = regQuoted.match(1); - value = regQuoted.match(2); - flag = true; - } - else if (reg.find(entry)) - { - var = reg.match(1); - value = reg.match(2); - 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; -} - -bool cmCacheManager::ParseEntry(const std::string& entry, - std::string& var, - std::string& value, - cmState::CacheEntryType& type) -{ - // input line is: key:type=value - static cmsys::RegularExpression reg( - "^([^=:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - // input line is: "key":type=value - static cmsys::RegularExpression regQuoted( - "^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - bool flag = false; - if(regQuoted.find(entry)) - { - var = regQuoted.match(1); - type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str()); - value = regQuoted.match(3); - flag = true; - } - else if (reg.find(entry)) - { - var = reg.match(1); - type = cmState::StringToCacheEntryType(reg.match(2).c_str()); - 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); - } - - if (!flag) - { - return ParseEntryWithoutType(entry, var, value); - } - - return flag; -} - void cmCacheManager::CleanCMakeFiles(const std::string& path) { std::string glob = path; @@ -187,7 +103,7 @@ bool cmCacheManager::LoadCache(const std::string& path, } } e.SetProperty("HELPSTRING", helpString.c_str()); - if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value, e.Type)) + if(cmState::ParseCacheEntry(realbuffer, entryKey, e.Value, e.Type)) { if ( excludes.find(entryKey) == excludes.end() ) { |