cmIDEOptions: Factor FlagMap update out to separate method
This will allow it to be re-used in other code paths.
This commit is contained in:
parent
358be9b320
commit
f2a3dd9d1a
|
@ -99,33 +99,7 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
|
||||||
(!(entry->special & cmIDEFlagTable::UserRequired) ||
|
(!(entry->special & cmIDEFlagTable::UserRequired) ||
|
||||||
static_cast<int>(strlen(flag+1)) > n))
|
static_cast<int>(strlen(flag+1)) > n))
|
||||||
{
|
{
|
||||||
if(entry->special & cmIDEFlagTable::UserIgnored)
|
this->FlagMapUpdate(entry, flag+n+1);
|
||||||
{
|
|
||||||
// Ignore the user-specified value.
|
|
||||||
this->FlagMap[entry->IDEName] = entry->value;
|
|
||||||
}
|
|
||||||
else if(entry->special & cmIDEFlagTable::SemicolonAppendable)
|
|
||||||
{
|
|
||||||
const char *new_value = flag+1+n;
|
|
||||||
|
|
||||||
std::map<std::string,std::string>::iterator itr;
|
|
||||||
itr = this->FlagMap.find(entry->IDEName);
|
|
||||||
if(itr != this->FlagMap.end())
|
|
||||||
{
|
|
||||||
// Append to old value (if present) with semicolons;
|
|
||||||
itr->second += ";";
|
|
||||||
itr->second += new_value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->FlagMap[entry->IDEName] = new_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Use the user-specified value.
|
|
||||||
this->FlagMap[entry->IDEName] = flag+1+n;
|
|
||||||
}
|
|
||||||
entry_found = true;
|
entry_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +124,37 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry,
|
||||||
|
const char* new_value)
|
||||||
|
{
|
||||||
|
if(entry->special & cmIDEFlagTable::UserIgnored)
|
||||||
|
{
|
||||||
|
// Ignore the user-specified value.
|
||||||
|
this->FlagMap[entry->IDEName] = entry->value;
|
||||||
|
}
|
||||||
|
else if(entry->special & cmIDEFlagTable::SemicolonAppendable)
|
||||||
|
{
|
||||||
|
std::map<std::string,std::string>::iterator itr;
|
||||||
|
itr = this->FlagMap.find(entry->IDEName);
|
||||||
|
if(itr != this->FlagMap.end())
|
||||||
|
{
|
||||||
|
// Append to old value (if present) with semicolons;
|
||||||
|
itr->second += ";";
|
||||||
|
itr->second += new_value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->FlagMap[entry->IDEName] = new_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use the user-specified value.
|
||||||
|
this->FlagMap[entry->IDEName] = new_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmIDEOptions::AddDefine(const std::string& def)
|
void cmIDEOptions::AddDefine(const std::string& def)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,7 @@ protected:
|
||||||
void HandleFlag(const char* flag);
|
void HandleFlag(const char* flag);
|
||||||
bool CheckFlagTable(cmIDEFlagTable const* table, const char* flag,
|
bool CheckFlagTable(cmIDEFlagTable const* table, const char* flag,
|
||||||
bool& flag_handled);
|
bool& flag_handled);
|
||||||
|
void FlagMapUpdate(cmIDEFlagTable const* entry, const char* new_value);
|
||||||
virtual void StoreUnknownFlag(const char* flag) = 0;
|
virtual void StoreUnknownFlag(const char* flag) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue