diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-06 10:01:35 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-04-06 15:58:55 (GMT) |
commit | 228c629c18d6b5e820376ac87babca0771205b6f (patch) | |
tree | 6d7afe15afe0c3854dc15a1f5debad8f9843c353 /Source/CursesDialog/cmCursesCacheEntryComposite.cxx | |
parent | 2e50f5e7d9269ee1e2e3587a7a4b806df48510d3 (diff) | |
download | CMake-228c629c18d6b5e820376ac87babca0771205b6f.zip CMake-228c629c18d6b5e820376ac87babca0771205b6f.tar.gz CMake-228c629c18d6b5e820376ac87babca0771205b6f.tar.bz2 |
Port CursesDialog to non-iterator cache API.
Diffstat (limited to 'Source/CursesDialog/cmCursesCacheEntryComposite.cxx')
-rw-r--r-- | Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 682f95f..4f028c4 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -18,6 +18,9 @@ #include "cmCursesFilePathWidget.h" #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" +#include "../cmake.h" + +#include <assert.h> cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( const std::string& key, @@ -32,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, + const std::string& key, cmake *cm, bool isNew, int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { @@ -47,11 +50,13 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } this->Entry = 0; - switch ( it.GetType() ) + const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); + assert(value); + switch (cm->GetCacheManager()->GetCacheEntryType(key)) { - case cmCacheManager::BOOL: + case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); - if (cmSystemTools::IsOn(it.GetValue().c_str())) + if (cmSystemTools::IsOn(value)) { static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true); } @@ -62,40 +67,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( break; case cmCacheManager::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); - static_cast<cmCursesPathWidget*>(this->Entry)->SetString( - it.GetValue()); + static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value); break; case cmCacheManager::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); - static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString( - it.GetValue()); + static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value); break; case cmCacheManager::STRING: - if(it.PropertyExists("STRINGS")) + { + const char* stringsProp = cm->GetCacheManager() + ->GetCacheEntryProperty(key, "STRINGS"); + if(stringsProp) { cmCursesOptionsWidget* ow = new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1); this->Entry = ow; std::vector<std::string> options; - cmSystemTools::ExpandListArgument( - std::string(it.GetProperty("STRINGS")), options); + cmSystemTools::ExpandListArgument(stringsProp, options); for(std::vector<std::string>::iterator si = options.begin(); si != options.end(); ++si) { ow->AddOption(*si); } - ow->SetOption(it.GetValue()); + ow->SetOption(value); } else { this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); - static_cast<cmCursesStringWidget*>(this->Entry)->SetString( - it.GetValue()); + static_cast<cmCursesStringWidget*>(this->Entry)->SetString(value); } break; + } case cmCacheManager::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", - it.GetName().c_str()); + key.c_str()); break; default: // TODO : put warning message here |