summaryrefslogtreecommitdiffstats
path: root/Source/cmCacheManager.h
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-05 17:50:05 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-08 16:47:00 (GMT)
commit1e2dbfce37acd1b7e7dc5bb1b45d71c5ac0c3599 (patch)
tree6f1c7fb09102ee9df8178db67019ee902eb65a45 /Source/cmCacheManager.h
parent60a62a91c4c67859d8e8f51aafcf0eb929edc036 (diff)
downloadCMake-1e2dbfce37acd1b7e7dc5bb1b45d71c5ac0c3599.zip
CMake-1e2dbfce37acd1b7e7dc5bb1b45d71c5ac0c3599.tar.gz
CMake-1e2dbfce37acd1b7e7dc5bb1b45d71c5ac0c3599.tar.bz2
cmCacheManager: Add non-iterator-based API.
The iterator pattern is an unusual one for CMake, and it hinders refactoring all configuration-time data manipulation into a single class.
Diffstat (limited to 'Source/cmCacheManager.h')
-rw-r--r--Source/cmCacheManager.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index d2712bb..3b02fa6 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -139,6 +139,81 @@ public:
///! Get a value from the cache given a key
const char* GetInitializedCacheValue(const std::string& key) const;
+ const char* GetCacheEntryValue(const std::string& key)
+ {
+ cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
+ if (it.IsAtEnd())
+ {
+ return 0;
+ }
+ return it.GetValue();
+ }
+
+ const char* GetCacheEntryProperty(std::string const& key,
+ std::string const& propName)
+ {
+ return this->GetCacheIterator(key.c_str()).GetProperty(propName);
+ }
+
+ CacheEntryType GetCacheEntryType(std::string const& key)
+ {
+ return this->GetCacheIterator(key.c_str()).GetType();
+ }
+
+ bool GetCacheEntryPropertyAsBool(std::string const& key,
+ std::string const& propName)
+ {
+ return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName);
+ }
+
+ void SetCacheEntryProperty(std::string const& key,
+ std::string const& propName,
+ std::string const& value)
+ {
+ this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str());
+ }
+
+ void SetCacheEntryBoolProperty(std::string const& key,
+ std::string const& propName,
+ bool value)
+ {
+ this->GetCacheIterator(key.c_str()).SetProperty(propName, value);
+ }
+
+ void SetCacheEntryValue(std::string const& key,
+ std::string const& value)
+ {
+ this->GetCacheIterator(key.c_str()).SetValue(value.c_str());
+ }
+
+ void RemoveCacheEntryProperty(std::string const& key,
+ std::string const& propName)
+ {
+ this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0);
+ }
+
+ void AppendCacheEntryProperty(std::string const& key,
+ std::string const& propName,
+ std::string const& value,
+ bool asString = false)
+ {
+ this->GetCacheIterator(key.c_str()).AppendProperty(propName,
+ value.c_str(),
+ asString);
+ }
+
+ std::vector<std::string> GetCacheEntryKeys()
+ {
+ std::vector<std::string> definitions;
+ definitions.reserve(this->GetSize());
+ cmCacheManager::CacheIterator cit = this->GetCacheIterator();
+ for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
+ {
+ definitions.push_back(cit.GetName());
+ }
+ return definitions;
+ }
+
/** Get the version of CMake that wrote the cache. */
unsigned int GetCacheMajorVersion() const
{ return this->CacheMajorVersion; }