summaryrefslogtreecommitdiffstats
path: root/Source/cmCacheManager.h
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-11 18:05:45 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-11 18:05:45 (GMT)
commitbef93dc5c1cd7985013c9df096efbaa9b79dd7ac (patch)
tree4c028cecff3e8b237edf794b93852e42fefa2e1b /Source/cmCacheManager.h
parentbfdf8f7dcdbefe408adecd903fd669f62ad4815b (diff)
downloadCMake-bef93dc5c1cd7985013c9df096efbaa9b79dd7ac.zip
CMake-bef93dc5c1cd7985013c9df096efbaa9b79dd7ac.tar.gz
CMake-bef93dc5c1cd7985013c9df096efbaa9b79dd7ac.tar.bz2
Couple of changes: cache variables now have a map of properties. ADVANCED and HELPSTRING are now properties of cache variable, IsAdvanced is gone, so is GetCacheEntry, since cache entries are now all private. To access them, you use the iterator. -ADVANCED cache entries are gone and are replaced by the property of cache variables. The cache file still looks the same, but the -ADVANCED cache entries are created when writing file. MarkAsAdvanced and VariableRequires are fixed. So are curses gui and wizard
Diffstat (limited to 'Source/cmCacheManager.h')
-rw-r--r--Source/cmCacheManager.h45
1 files changed, 31 insertions, 14 deletions
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 243506e..bdf7760 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -29,28 +29,44 @@ class cmMakefile;
class cmCacheManager
{
public:
- enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC };
+ enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,UNINITIALIZED };
+
+private:
struct CacheEntry
{
std::string m_Value;
- std::string m_HelpString;
CacheEntryType m_Type;
+ std::map<cmStdString,cmStdString> m_Properties;
};
+
+public:
class CacheIterator
{
public:
void Begin();
+ bool Find(const char*);
bool IsAtEnd();
void Next();
- const char *GetName() {
- return position->first.c_str(); }
- CacheEntry const &GetEntry() {
- return position->second; }
- cmCacheManager const &m_Container;
- std::map<cmStdString, CacheEntry>::const_iterator position;
- CacheIterator(cmCacheManager const &foo) : m_Container(foo) {
+ const char *GetName() const {
+ return m_Position->first.c_str(); }
+ const char* GetProperty(const char*) const ;
+ bool GetPropertyAsBool(const char*) const ;
+ void SetProperty(const char* property, const char* value);
+ void SetProperty(const char* property, bool value);
+ const char* GetValue() const { return this->GetEntry().m_Value.c_str(); }
+ void SetValue(const char*);
+ CacheEntryType GetType() const { return this->GetEntry().m_Type; }
+ cmCacheManager &m_Container;
+ std::map<cmStdString, CacheEntry>::iterator m_Position;
+ CacheIterator(cmCacheManager &foo) : m_Container(foo) {
this->Begin();
}
+ CacheIterator(cmCacheManager &foo, const char* key) : m_Container(foo) {
+ this->Find(key);
+ }
+ private:
+ CacheEntry const& GetEntry() const { return m_Position->second; }
+ CacheEntry& GetEntry() { return m_Position->second; }
};
friend class cmCacheManager::CacheIterator;
@@ -60,7 +76,6 @@ public:
return CacheIterator(*this);
}
- typedef std::map<cmStdString, CacheEntry> CacheEntryMap;
/**
* Types for the cache entries. These are useful as
* hints for a cache editor program. Path should bring
@@ -87,10 +102,8 @@ public:
///! Print the cache to a stream
void PrintCache(std::ostream&) const;
- ///! Get a cache entry object for a key
- CacheEntry *GetCacheEntry(const char *key);
-
- bool IsAdvanced(const char* key);
+ ///! Get the iterator for an entry with a given key.
+ cmCacheManager::CacheIterator GetCacheIterator(const char *key);
///! Remove an entry from the cache
void RemoveCacheEntry(const char* key);
@@ -116,7 +129,11 @@ protected:
///! Add a BOOL entry into the cache
void AddCacheEntry(const char* key, bool, const char* helpString);
+ ///! Get a cache entry object for a key
+ CacheEntry *GetCacheEntry(const char *key);
+
private:
+ typedef std::map<cmStdString, CacheEntry> CacheEntryMap;
static void OutputHelpString(std::ofstream& fout,
const std::string& helpString);
CacheEntryMap m_Cache;