summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-07 21:14:41 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-07 21:15:04 (GMT)
commit3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94 (patch)
treed0372265c5b1f07f9b1a8a6cc9bedf96bed2dbcb /Source/CursesDialog/cmCursesCacheEntryComposite.cxx
parent9410e24a4ad3a21b2c27d057798f723e88d14d45 (diff)
downloadCMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.zip
CMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.tar.gz
CMake-3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94.tar.bz2
Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits. The GetCacheEntryValue API returns a pointer to memory freed on return. It will have to be revised along with the rest of the original topic.
Diffstat (limited to 'Source/CursesDialog/cmCursesCacheEntryComposite.cxx')
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx35
1 files changed, 15 insertions, 20 deletions
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 4f028c4..682f95f 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -18,9 +18,6 @@
#include "cmCursesFilePathWidget.h"
#include "cmCursesDummyWidget.h"
#include "../cmSystemTools.h"
-#include "../cmake.h"
-
-#include <assert.h>
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
const std::string& key,
@@ -35,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
- const std::string& key, cmake *cm, bool isNew,
+ const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew,
int labelwidth, int entrywidth)
: Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
{
@@ -50,13 +47,11 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
this->Entry = 0;
- const char* value = cm->GetCacheManager()->GetCacheEntryValue(key);
- assert(value);
- switch (cm->GetCacheManager()->GetCacheEntryType(key))
+ switch ( it.GetType() )
{
- case cmCacheManager::BOOL:
+ case cmCacheManager::BOOL:
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
- if (cmSystemTools::IsOn(value))
+ if (cmSystemTools::IsOn(it.GetValue().c_str()))
{
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
}
@@ -67,40 +62,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
break;
case cmCacheManager::PATH:
this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
+ static_cast<cmCursesPathWidget*>(this->Entry)->SetString(
+ it.GetValue());
break;
case cmCacheManager::FILEPATH:
this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
+ static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(
+ it.GetValue());
break;
case cmCacheManager::STRING:
- {
- const char* stringsProp = cm->GetCacheManager()
- ->GetCacheEntryProperty(key, "STRINGS");
- if(stringsProp)
+ if(it.PropertyExists("STRINGS"))
{
cmCursesOptionsWidget* ow =
new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
this->Entry = ow;
std::vector<std::string> options;
- cmSystemTools::ExpandListArgument(stringsProp, options);
+ cmSystemTools::ExpandListArgument(
+ std::string(it.GetProperty("STRINGS")), options);
for(std::vector<std::string>::iterator
si = options.begin(); si != options.end(); ++si)
{
ow->AddOption(*si);
}
- ow->SetOption(value);
+ ow->SetOption(it.GetValue());
}
else
{
this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesStringWidget*>(this->Entry)->SetString(value);
+ static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
+ it.GetValue());
}
break;
- }
case cmCacheManager::UNINITIALIZED:
cmSystemTools::Error("Found an undefined variable: ",
- key.c_str());
+ it.GetName().c_str());
break;
default:
// TODO : put warning message here