diff options
author | Ken Martin <ken.martin@kitware.com> | 2001-04-24 20:49:12 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2001-04-24 20:49:12 (GMT) |
commit | 73f04d1409ec4dfcb3b8db3e104da2a894d019a2 (patch) | |
tree | e1578688252c8a50fb307d60045379a53a02d646 /Source/cmCacheManager.cxx | |
parent | b5746484e4c396489b707e0f8b4d1f539e62a965 (diff) | |
download | CMake-73f04d1409ec4dfcb3b8db3e104da2a894d019a2.zip CMake-73f04d1409ec4dfcb3b8db3e104da2a894d019a2.tar.gz CMake-73f04d1409ec4dfcb3b8db3e104da2a894d019a2.tar.bz2 |
many fixes and cleanup and features
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index fb84d74..6529973 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -96,7 +96,7 @@ bool cmCacheManager::LoadCache(cmMakefile* mf) return true; } -bool cmCacheManager::SaveCache(cmMakefile* mf) +bool cmCacheManager::SaveCache(cmMakefile* mf) const { std::string cacheFile = mf->GetHomeOutputDirectory(); cacheFile += "/CMakeCache.txt"; @@ -119,7 +119,7 @@ bool cmCacheManager::SaveCache(cmMakefile* mf) << "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.\n" << "# VALUE is the current value for the KEY.\n\n"; - for( std::map<std::string, CacheEntry>::iterator i = m_Cache.begin(); + for( std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin(); i != m_Cache.end(); ++i) { CacheEntryType t = (*i).second.m_Type; @@ -151,34 +151,43 @@ void cmCacheManager::AddCacheEntry(const char* key, m_Cache[key] = e; } -const char* cmCacheManager::GetCacheValue(const char* key) +cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key) { if(m_Cache.count(key)) { - return m_Cache[key].m_Value.c_str(); + return &(m_Cache.find(key)->second); + } + return 0; +} + +const char* cmCacheManager::GetCacheValue(const char* key) const +{ + if(m_Cache.count(key)) + { + return m_Cache.find(key)->second.m_Value.c_str(); } return 0; } -bool cmCacheManager::IsOn(const char* key) +bool cmCacheManager::IsOn(const char* key) const { if(!m_Cache.count(key)) { return false; } - std::string &v = m_Cache[key].m_Value; + const std::string &v = m_Cache.find(key)->second.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) +void cmCacheManager::PrintCache(std::ostream& out) const { out << "=================================================" << std::endl; out << "CMakeCache Contents:" << std::endl; - for(std::map<std::string, CacheEntry>::iterator i = m_Cache.begin(); + for(std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin(); i != m_Cache.end(); ++i) { out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str() << std::endl; |