stringapi: Use strings for cache iterator values
This commit is contained in:
parent
85fc9f26a7
commit
94fc63e2d5
|
@ -51,7 +51,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
|||
{
|
||||
case cmCacheManager::BOOL:
|
||||
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
|
||||
if (cmSystemTools::IsOn(it.GetValue()))
|
||||
if (cmSystemTools::IsOn(it.GetValue().c_str()))
|
||||
{
|
||||
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
|||
}
|
||||
break;
|
||||
case cmCacheManager::UNINITIALIZED:
|
||||
cmSystemTools::Error("Found an undefined variable: ", it.GetName());
|
||||
cmSystemTools::Error("Found an undefined variable: ",
|
||||
it.GetName().c_str());
|
||||
break;
|
||||
default:
|
||||
// TODO : put warning message here
|
||||
|
|
|
@ -111,7 +111,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
|
|||
cmCacheManager::CacheIterator itm = cachem->NewIterator();
|
||||
if ( itm.Find("CMAKE_HOME_DIRECTORY"))
|
||||
{
|
||||
setSourceDirectory(QString::fromLocal8Bit(itm.GetValue()));
|
||||
setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str()));
|
||||
}
|
||||
if ( itm.Find("CMAKE_GENERATOR"))
|
||||
{
|
||||
|
@ -201,11 +201,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
|
|||
}
|
||||
|
||||
QCMakeProperty prop;
|
||||
prop.Key = QString::fromLocal8Bit(i.GetName());
|
||||
prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
|
||||
int idx = props.indexOf(prop);
|
||||
if(idx == -1)
|
||||
{
|
||||
toremove.append(QString::fromLocal8Bit(i.GetName()));
|
||||
toremove.append(QString::fromLocal8Bit(i.GetName().c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -286,15 +286,15 @@ QCMakePropertyList QCMake::properties() const
|
|||
}
|
||||
|
||||
QCMakeProperty prop;
|
||||
prop.Key = QString::fromLocal8Bit(i.GetName());
|
||||
prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
|
||||
prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING"));
|
||||
prop.Value = QString::fromLocal8Bit(i.GetValue());
|
||||
prop.Value = QString::fromLocal8Bit(i.GetValue().c_str());
|
||||
prop.Advanced = i.GetPropertyAsBool("ADVANCED");
|
||||
|
||||
if(i.GetType() == cmCacheManager::BOOL)
|
||||
{
|
||||
prop.Type = QCMakeProperty::BOOL;
|
||||
prop.Value = cmSystemTools::IsOn(i.GetValue());
|
||||
prop.Value = cmSystemTools::IsOn(i.GetValue().c_str());
|
||||
}
|
||||
else if(i.GetType() == cmCacheManager::PATH)
|
||||
{
|
||||
|
|
|
@ -56,8 +56,8 @@ public:
|
|||
bool Find(const std::string&);
|
||||
bool IsAtEnd() const;
|
||||
void Next();
|
||||
const char *GetName() const {
|
||||
return this->Position->first.c_str(); }
|
||||
std::string GetName() const {
|
||||
return this->Position->first; }
|
||||
const char* GetProperty(const std::string&) const ;
|
||||
bool GetPropertyAsBool(const std::string&) const ;
|
||||
bool PropertyExists(const std::string&) const;
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
void AppendProperty(const std::string& property, const char* value,
|
||||
bool asString=false);
|
||||
void SetProperty(const std::string& property, bool value);
|
||||
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
|
||||
std::string GetValue() const { return this->GetEntry().Value; }
|
||||
bool GetValueAsBool() const;
|
||||
void SetValue(const char*);
|
||||
CacheEntryType GetType() const { return this->GetEntry().Type; }
|
||||
|
|
|
@ -1796,7 +1796,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
|||
cmCacheManager::CacheEntryType type,
|
||||
bool force)
|
||||
{
|
||||
const char* val = value;
|
||||
bool haveVal = value ? true : false;
|
||||
std::string val = haveVal ? value : "";
|
||||
cmCacheManager::CacheIterator it =
|
||||
this->GetCacheManager()->GetCacheIterator(name.c_str());
|
||||
if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
|
||||
|
@ -1807,6 +1808,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
|||
if(!force)
|
||||
{
|
||||
val = it.GetValue();
|
||||
haveVal = true;
|
||||
}
|
||||
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
|
||||
{
|
||||
|
@ -1829,10 +1831,12 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
|||
|
||||
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
|
||||
val = it.GetValue();
|
||||
haveVal = true;
|
||||
}
|
||||
|
||||
}
|
||||
this->GetCacheManager()->AddCacheEntry(name, val, doc, type);
|
||||
this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc,
|
||||
type);
|
||||
// if there was a definition then remove it
|
||||
this->Internal->VarStack.top().Set(name, 0);
|
||||
}
|
||||
|
|
|
@ -55,11 +55,8 @@ bool cmOptionCommand
|
|||
it.SetProperty("HELPSTRING", args[1].c_str());
|
||||
return true;
|
||||
}
|
||||
if ( it.GetValue() )
|
||||
{
|
||||
initialValue = it.GetValue();
|
||||
}
|
||||
}
|
||||
if(args.size() == 3)
|
||||
{
|
||||
initialValue = args[2];
|
||||
|
|
Loading…
Reference in New Issue