diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-09-11 18:05:45 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-09-11 18:05:45 (GMT) |
commit | bef93dc5c1cd7985013c9df096efbaa9b79dd7ac (patch) | |
tree | 4c028cecff3e8b237edf794b93852e42fefa2e1b /Source/CursesDialog/cmCursesMainForm.cxx | |
parent | bfdf8f7dcdbefe408adecd903fd669f62ad4815b (diff) | |
download | CMake-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/CursesDialog/cmCursesMainForm.cxx')
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index cd4aff2..c004cba 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -117,9 +117,9 @@ void cmCursesMainForm::InitializeUI() this->m_CMakeInstance->GetCacheManager()->NewIterator(); !i.IsAtEnd(); i.Next()) { - const cmCacheManager::CacheEntry& value = i.GetEntry(); - if ( value.m_Type != cmCacheManager::INTERNAL && - value.m_Type != cmCacheManager::STATIC ) + if ( i.GetType() != cmCacheManager::INTERNAL && + i.GetType() != cmCacheManager::STATIC && + i.GetType() != cmCacheManager::UNINITIALIZED) { ++count; } @@ -146,16 +146,16 @@ void cmCursesMainForm::InitializeUI() !i.IsAtEnd(); i.Next()) { const char* key = i.GetName(); - const cmCacheManager::CacheEntry& value = i.GetEntry(); - if ( value.m_Type == cmCacheManager::INTERNAL || - value.m_Type == cmCacheManager::STATIC ) + if ( i.GetType() == cmCacheManager::INTERNAL || + i.GetType() == cmCacheManager::STATIC || + i.GetType() == cmCacheManager::UNINITIALIZED ) { continue; } if (!this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, value, + newEntries->push_back(new cmCursesCacheEntryComposite(key, i, true, 30, entrywidth)); m_OkToGenerate = false; @@ -168,16 +168,16 @@ void cmCursesMainForm::InitializeUI() !i.IsAtEnd(); i.Next()) { const char* key = i.GetName(); - const cmCacheManager::CacheEntry& value = i.GetEntry(); - if ( value.m_Type == cmCacheManager::INTERNAL || - value.m_Type == cmCacheManager::STATIC ) + if ( i.GetType() == cmCacheManager::INTERNAL || + i.GetType() == cmCacheManager::STATIC || + i.GetType() == cmCacheManager::UNINITIALIZED ) { continue; } if (this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, value, + newEntries->push_back(new cmCursesCacheEntryComposite(key, i, false, 30, entrywidth)); } @@ -224,9 +224,9 @@ void cmCursesMainForm::RePost() std::vector<cmCursesCacheEntryComposite*>::iterator it; for (it = m_Entries->begin(); it != m_Entries->end(); ++it) { - if (!m_AdvancedMode && - this->m_CMakeInstance->GetCacheManager()->IsAdvanced( - (*it)->GetValue())) + cmCacheManager::CacheIterator mit = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) { continue; } @@ -243,8 +243,9 @@ void cmCursesMainForm::RePost() std::vector<cmCursesCacheEntryComposite*>::iterator it; for (it = m_Entries->begin(); it != m_Entries->end(); ++it) { - if (!m_AdvancedMode && - this->m_CMakeInstance->GetCacheManager()->IsAdvanced((*it)->GetValue())) + cmCacheManager::CacheIterator mit = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) { continue; } @@ -302,9 +303,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector<cmCursesCacheEntryComposite*>::iterator it; for (it = m_Entries->begin(); it != m_Entries->end(); ++it) { - if (!m_AdvancedMode && this->m_CMakeInstance->GetCacheManager()->IsAdvanced( - (*it)->GetValue())) - { + cmCacheManager::CacheIterator mit = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) + { continue; } m_NumberOfVisibleEntries++; @@ -318,8 +320,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector<cmCursesCacheEntryComposite*>::iterator it; for (it = m_Entries->begin(); it != m_Entries->end(); ++it) { - if (!m_AdvancedMode && this->m_CMakeInstance->GetCacheManager()->IsAdvanced( - (*it)->GetValue())) + cmCacheManager::CacheIterator mit = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) { continue; } @@ -453,14 +456,20 @@ void cmCursesMainForm::UpdateStatusBar() // Get the help string of the current entry // and add it to the help string char help[128]; - const char* helpString; - cmCacheManager::CacheEntry *entry = - this->m_CMakeInstance->GetCacheManager()->GetCacheEntry(curField); - if (entry) + cmCacheManager::CacheIterator it = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField); + if (!it.IsAtEnd()) { - helpString = entry->m_HelpString.c_str(); - strncpy(help, helpString, 127); - help[127] = '\0'; + const char* hs = it.GetProperty("HELPSTRING"); + if ( hs ) + { + strncpy(help, hs, 127); + help[127] = '\0'; + } + else + { + help[0] = 0; + } } else { @@ -686,23 +695,22 @@ void cmCursesMainForm::FillCacheManagerFromUI() int size = m_Entries->size(); for(int i=0; i < size; i++) { - cmCacheManager::CacheEntry *entry = - this->m_CMakeInstance->GetCacheManager()->GetCacheEntry( + cmCacheManager::CacheIterator it = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator( (*m_Entries)[i]->m_Key.c_str()); - if (entry) + if (!it.IsAtEnd()) { tmpString = (*m_Entries)[i]->m_Entry->GetValue(); // Remove trailing spaces, convert path to unix slashes std::string tmpSubString = tmpString.substr(0,tmpString.find_last_not_of(" ")+1); - if ( entry->m_Type == cmCacheManager::PATH || - entry->m_Type == cmCacheManager::FILEPATH ) + if ( it.GetType() == cmCacheManager::PATH || + it.GetType() == cmCacheManager::FILEPATH ) { cmSystemTools::ConvertToUnixSlashes(tmpSubString); } - entry->m_Value = tmpSubString; - + it.SetValue(tmpSubString.c_str()); } } } @@ -842,11 +850,11 @@ void cmCursesMainForm::HandleInput() m_Fields[index-2])); const char* curField = lbl->GetValue(); const char* helpString=0; - cmCacheManager::CacheEntry *entry = - this->m_CMakeInstance->GetCacheManager()->GetCacheEntry(curField); - if (entry) + cmCacheManager::CacheIterator it = + this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField); + if (!it.IsAtEnd()) { - helpString = entry->m_HelpString.c_str(); + helpString = it.GetProperty("HELPSTRING"); } if (helpString) { |