diff options
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 90cfd3d..fb84d74 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -151,7 +151,7 @@ void cmCacheManager::AddCacheEntry(const char* key, m_Cache[key] = e; } -const char* cmCacheManager::GetCacheValue(const char* key) +const char* cmCacheManager::GetCacheValue(const char* key) { if(m_Cache.count(key)) { @@ -161,6 +161,19 @@ const char* cmCacheManager::GetCacheValue(const char* key) } +bool cmCacheManager::IsOn(const char* key) +{ + if(!m_Cache.count(key)) + { + return false; + } + std::string &v = m_Cache[key].m_Value; + return (v == "ON" || v == "on" || v == "1" || v == "true" || v == "yev" + || v == "TRUE" || v == "True" || v == "y" || v == "Y"); +} + + + void cmCacheManager::PrintCache(std::ostream& out) { out << "=================================================" << std::endl; @@ -176,3 +189,15 @@ void cmCacheManager::PrintCache(std::ostream& out) } +void cmCacheManager::AddCacheEntry(const char* key, bool v) +{ + if(v) + { + this->AddCacheEntry(key, "ON", cmCacheManager::BOOL); + } + else + { + this->AddCacheEntry(key, "OFF", cmCacheManager::BOOL); + } +} + |