minor fixes for new cache api

This commit is contained in:
Ken Martin 2002-08-21 15:37:49 -04:00
parent 9f870d3efb
commit 2353f5e787
1 changed files with 15 additions and 18 deletions

View File

@ -93,23 +93,19 @@ bool cmCursesMainForm::LookForCacheEntry(const char* key)
// Create new cmCursesCacheEntryComposite entries from the cache // Create new cmCursesCacheEntryComposite entries from the cache
void cmCursesMainForm::InitializeUI() void cmCursesMainForm::InitializeUI()
{ {
// Get the cache entries.
const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap();
// Create a vector of cmCursesCacheEntryComposite's // Create a vector of cmCursesCacheEntryComposite's
// which contain labels, entries and new entry markers // which contain labels, entries and new entry markers
std::vector<cmCursesCacheEntryComposite*>* newEntries = std::vector<cmCursesCacheEntryComposite*>* newEntries =
new std::vector<cmCursesCacheEntryComposite*>; new std::vector<cmCursesCacheEntryComposite*>;
newEntries->reserve(cache.size()); newEntries->reserve(cmCacheManager::GetInstance()->GetSize());
// Count non-internal and non-static entries // Count non-internal and non-static entries
int count=0; int count=0;
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); for(cmCacheManager::CacheIterator i =
i != cache.end(); ++i) cmCacheManager::GetInstance()->NewIterator();
!i.IsAtEnd(); i.Next())
{ {
const cmCacheManager::CacheEntry& value = i->second; const cmCacheManager::CacheEntry& value = i.GetEntry();
if ( value.m_Type != cmCacheManager::INTERNAL && if ( value.m_Type != cmCacheManager::INTERNAL &&
value.m_Type != cmCacheManager::STATIC ) value.m_Type != cmCacheManager::STATIC )
{ {
@ -133,11 +129,12 @@ void cmCursesMainForm::InitializeUI()
// Create the composites. // Create the composites.
// First add entries which are new // First add entries which are new
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); for(cmCacheManager::CacheIterator i =
i != cache.end(); ++i) cmCacheManager::GetInstance()->NewIterator();
!i.IsAtEnd(); i.Next())
{ {
const char* key = i->first.c_str(); const char* key = i.GetName();
const cmCacheManager::CacheEntry& value = i->second; const cmCacheManager::CacheEntry& value = i.GetEntry();
if ( value.m_Type == cmCacheManager::INTERNAL || if ( value.m_Type == cmCacheManager::INTERNAL ||
value.m_Type == cmCacheManager::STATIC ) value.m_Type == cmCacheManager::STATIC )
{ {
@ -154,11 +151,12 @@ void cmCursesMainForm::InitializeUI()
} }
// then add entries which are old // then add entries which are old
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); for(cmCacheManager::CacheIterator i =
i != cache.end(); ++i) cmCacheManager::GetInstance()->NewIterator();
!i.IsAtEnd(); i.Next())
{ {
const char* key = i->first.c_str(); const char* key = i.GetName();
const cmCacheManager::CacheEntry& value = i->second; const cmCacheManager::CacheEntry& value = i.GetEntry();
if ( value.m_Type == cmCacheManager::INTERNAL || if ( value.m_Type == cmCacheManager::INTERNAL ||
value.m_Type == cmCacheManager::STATIC ) value.m_Type == cmCacheManager::STATIC )
{ {
@ -615,7 +613,6 @@ void cmCursesMainForm::FillCacheManagerFromUI()
{ {
std::string tmpString; std::string tmpString;
cmCacheManager::GetInstance()->GetCacheMap();
int size = m_Entries->size(); int size = m_Entries->size();
for(int i=0; i < size; i++) for(int i=0; i < size; i++)
{ {