summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-06 10:14:40 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-06 15:58:55 (GMT)
commit7b7ae3b1a1d1c664eeef48392759883aa4040657 (patch)
tree00e85d72780ab8a5252065be30a474a6ff21dce7
parent228c629c18d6b5e820376ac87babca0771205b6f (diff)
downloadCMake-7b7ae3b1a1d1c664eeef48392759883aa4040657.zip
CMake-7b7ae3b1a1d1c664eeef48392759883aa4040657.tar.gz
CMake-7b7ae3b1a1d1c664eeef48392759883aa4040657.tar.bz2
Port QtDialog to non-iterator cache API.
-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(";");
}
}