diff options
Diffstat (limited to 'Source/cmCacheManager.h')
-rw-r--r-- | Source/cmCacheManager.h | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 3b02fa6..8462259 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" #include "cmPropertyMap.h" +#include "cmState.h" + class cmMakefile; class cmMarkAsAdvancedCommand; class cmake; @@ -30,21 +32,22 @@ public: cmCacheManager(cmake* cm); class CacheIterator; friend class cmCacheManager::CacheIterator; - enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, - UNINITIALIZED }; private: struct CacheEntry { std::string Value; - CacheEntryType Type; + cmState::CacheEntryType Type; cmPropertyMap Properties; const char* GetProperty(const std::string&) const; void SetProperty(const std::string& property, const char* value); void AppendProperty(const std::string& property, const char* value, bool asString=false); bool Initialized; - CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false) + CacheEntry() + : Value(""), + Type(cmState::UNINITIALIZED), + Initialized(false) {} }; @@ -68,8 +71,10 @@ public: const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); - CacheEntryType GetType() const { return this->GetEntry().Type; } - void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; } + cmState::CacheEntryType GetType() const + { return this->GetEntry().Type; } + void SetType(cmState::CacheEntryType ty) + { this->GetEntry().Type = ty; } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager &Container; std::map<std::string, CacheEntry>::iterator Position; @@ -94,17 +99,6 @@ public: return CacheIterator(*this); } - /** - * Types for the cache entries. These are useful as - * hints for a cache editor program. Path should bring - * up a file chooser, BOOL a check box, and STRING a - * text entry box, FILEPATH is a full path to a file which - * can be different than just a path input - */ - static CacheEntryType StringToType(const char*); - static const char* TypeToString(CacheEntryType); - static bool IsType(const char*); - ///! 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, @@ -134,7 +128,7 @@ public: static bool ParseEntry(const std::string& entry, std::string& var, std::string& value, - CacheEntryType& type); + cmState::CacheEntryType& type); ///! Get a value from the cache given a key const char* GetInitializedCacheValue(const std::string& key) const; @@ -155,7 +149,7 @@ public: return this->GetCacheIterator(key.c_str()).GetProperty(propName); } - CacheEntryType GetCacheEntryType(std::string const& key) + cmState::CacheEntryType GetCacheEntryType(std::string const& key) { return this->GetCacheIterator(key.c_str()).GetType(); } @@ -223,7 +217,8 @@ public: protected: ///! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, CacheEntryType type); + const char* helpString, + cmState::CacheEntryType type); ///! Get a cache entry object for a key CacheEntry *GetCacheEntry(const std::string& key); @@ -248,9 +243,8 @@ private: CacheEntryMap Cache; // Only cmake and cmMakefile should be able to add cache values // the commands should never use the cmCacheManager directly - friend class cmMakefile; // allow access to add cache values + friend class cmState; // allow access to add cache values friend class cmake; // allow access to add cache values - friend class cmMarkAsAdvancedCommand; // allow access to add cache values }; #endif |