summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-06 10:14:40 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-08 16:47:00 (GMT)
commitf3922a9a5b463420db5f7fae08efdf1b4abdfe5e (patch)
tree4da75bbbfc1277bf6ff5a98d16b047c865895c4b /Source/QtDialog
parent3e6a76e48b93b2756cd3e1f28941c79c5a8f9709 (diff)
downloadCMake-f3922a9a5b463420db5f7fae08efdf1b4abdfe5e.zip
CMake-f3922a9a5b463420db5f7fae08efdf1b4abdfe5e.tar.gz
CMake-f3922a9a5b463420db5f7fae08efdf1b4abdfe5e.tar.bz2
Port QtDialog to non-iterator cache API.
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/QCMake.cxx72
1 files changed, 40 insertions, 32 deletions
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 009d06e..08d53ce 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -110,17 +110,18 @@ void QCMake::setBinaryDirectory(const QString& _dir)
QCMakePropertyList props = this->properties();
emit this->propertiesChanged(props);
- cmCacheManager::CacheIterator itm = cachem->NewIterator();
- if ( itm.Find("CMAKE_HOME_DIRECTORY"))
+ const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
+ if (homeDir)
{
- setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str()));
+ setSourceDirectory(QString::fromLocal8Bit(homeDir));
}
- if ( itm.Find("CMAKE_GENERATOR"))
+ const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR");
+ if (gen)
{
const char* extraGen = cachem
->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string curGen = cmExternalMakefileProjectGenerator::
- CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
+ CreateFullGeneratorName(gen, extraGen? extraGen : "");
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
}
}
@@ -195,33 +196,35 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
// set the value of properties
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
- for(cmCacheManager::CacheIterator i = cachem->NewIterator();
- !i.IsAtEnd(); i.Next())
+ std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
+ for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it)
{
-
- if(i.GetType() == cmCacheManager::INTERNAL ||
- i.GetType() == cmCacheManager::STATIC)
+ cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it);
+ if(t == cmCacheManager::INTERNAL ||
+ t == cmCacheManager::STATIC)
{
continue;
}
QCMakeProperty prop;
- prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
+ prop.Key = QString::fromLocal8Bit(it->c_str());
int idx = props.indexOf(prop);
if(idx == -1)
{
- toremove.append(QString::fromLocal8Bit(i.GetName().c_str()));
+ toremove.append(QString::fromLocal8Bit(it->c_str()));
}
else
{
prop = props[idx];
if(prop.Value.type() == QVariant::Bool)
{
- i.SetValue(prop.Value.toBool() ? "ON" : "OFF");
+ cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
}
else
{
- i.SetValue(prop.Value.toString().toLocal8Bit().data());
+ cachem->SetCacheEntryValue(*it,
+ prop.Value.toString().toLocal8Bit().data());
}
props.removeAt(idx);
}
@@ -279,42 +282,47 @@ QCMakePropertyList QCMake::properties() const
QCMakePropertyList ret;
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
- for(cmCacheManager::CacheIterator i = cachem->NewIterator();
- !i.IsAtEnd(); i.Next())
+ std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
+ for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
+ i != cacheKeys.end(); ++i)
{
-
- if(i.GetType() == cmCacheManager::INTERNAL ||
- i.GetType() == cmCacheManager::STATIC ||
- i.GetType() == cmCacheManager::UNINITIALIZED)
+ cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i);
+ if(t == cmCacheManager::INTERNAL ||
+ t == cmCacheManager::STATIC ||
+ t == cmCacheManager::UNINITIALIZED)
{
continue;
}
- QCMakeProperty prop;
- prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
- prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING"));
- prop.Value = QString::fromLocal8Bit(i.GetValue().c_str());
- prop.Advanced = i.GetPropertyAsBool("ADVANCED");
+ const char* cachedValue = cachem->GetCacheEntryValue(*i);
- if(i.GetType() == cmCacheManager::BOOL)
+ QCMakeProperty prop;
+ prop.Key = QString::fromLocal8Bit(i->c_str());
+ prop.Help = QString::fromLocal8Bit(
+ cachem->GetCacheEntryProperty(*i, "HELPSTRING"));
+ prop.Value = QString::fromLocal8Bit(cachedValue);
+ prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
+ if(t == cmCacheManager::BOOL)
{
prop.Type = QCMakeProperty::BOOL;
- prop.Value = cmSystemTools::IsOn(i.GetValue().c_str());
+ prop.Value = cmSystemTools::IsOn(cachedValue);
}
- else if(i.GetType() == cmCacheManager::PATH)
+ else if(t == cmCacheManager::PATH)
{
prop.Type = QCMakeProperty::PATH;
}
- else if(i.GetType() == cmCacheManager::FILEPATH)
+ else if(t == cmCacheManager::FILEPATH)
{
prop.Type = QCMakeProperty::FILEPATH;
}
- else if(i.GetType() == cmCacheManager::STRING)
+ else if(t == cmCacheManager::STRING)
{
prop.Type = QCMakeProperty::STRING;
- if (i.PropertyExists("STRINGS"))
+ const char* stringsProperty =
+ cachem->GetCacheEntryProperty(*i, "STRINGS");
+ if (stringsProperty)
{
- prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";");
+ prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
}
}