diff options
Diffstat (limited to 'Source/cmCacheManager.h')
-rw-r--r-- | Source/cmCacheManager.h | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index d9a9112..3b02fa6 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -65,7 +65,7 @@ public: void AppendProperty(const std::string& property, const char* value, bool asString=false); void SetProperty(const std::string& property, bool value); - std::string GetValue() const { return this->GetEntry().Value; } + const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); CacheEntryType GetType() const { return this->GetEntry().Type; } @@ -105,17 +105,12 @@ public: static const char* TypeToString(CacheEntryType); static bool IsType(const char*); - ///! Load a cache for given makefile. Loads from ouput home. - bool LoadCache(cmMakefile*); ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path); - bool LoadCache(const std::string& path, bool internal); bool LoadCache(const std::string& path, bool internal, std::set<std::string>& excludes, std::set<std::string>& includes); - ///! Save cache for given makefile. Saves to ouput home CMakeCache.txt. - bool SaveCache(cmMakefile*) ; ///! Save cache for given makefile. Saves to ouput path/CMakeCache.txt bool SaveCache(const std::string& path) ; @@ -142,14 +137,88 @@ public: CacheEntryType& type); ///! Get a value from the cache given a key - const char* GetCacheValue(const std::string& key) const; + 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; } unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; } - bool NeedCacheCompatibility(int major, int minor); protected: ///! Add an entry into the cache |