cmake: Simplify RemoveUnscriptableCommands algorithm.
Remove obsolete RemoveCommand method.
This commit is contained in:
parent
62854e9966
commit
1e738bcf9c
|
@ -261,17 +261,6 @@ void cmake::RenameCommand(const std::string& oldName,
|
||||||
this->Commands.erase(pos);
|
this->Commands.erase(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake::RemoveCommand(const std::string& name)
|
|
||||||
{
|
|
||||||
std::string sName = cmSystemTools::LowerCase(name);
|
|
||||||
RegisteredCommandsMap::iterator pos = this->Commands.find(sName);
|
|
||||||
if ( pos != this->Commands.end() )
|
|
||||||
{
|
|
||||||
delete pos->second;
|
|
||||||
this->Commands.erase(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmake::AddCommand(cmCommand* command)
|
void cmake::AddCommand(cmCommand* command)
|
||||||
{
|
{
|
||||||
std::string name = cmSystemTools::LowerCase(command->GetName());
|
std::string name = cmSystemTools::LowerCase(command->GetName());
|
||||||
|
@ -289,22 +278,19 @@ void cmake::AddCommand(cmCommand* command)
|
||||||
void cmake::RemoveUnscriptableCommands()
|
void cmake::RemoveUnscriptableCommands()
|
||||||
{
|
{
|
||||||
std::vector<std::string> unscriptableCommands;
|
std::vector<std::string> unscriptableCommands;
|
||||||
for (cmake::RegisteredCommandsMap::const_iterator
|
for (cmake::RegisteredCommandsMap::iterator
|
||||||
pos = this->Commands.begin();
|
pos = this->Commands.begin();
|
||||||
pos != this->Commands.end();
|
pos != this->Commands.end(); )
|
||||||
++pos)
|
|
||||||
{
|
{
|
||||||
if (!pos->second->IsScriptable())
|
if (!pos->second->IsScriptable())
|
||||||
{
|
{
|
||||||
unscriptableCommands.push_back(pos->first);
|
delete pos->second;
|
||||||
|
this->Commands.erase(pos++);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator it=unscriptableCommands.begin();
|
|
||||||
it != unscriptableCommands.end();
|
|
||||||
++it)
|
|
||||||
{
|
|
||||||
this->RemoveCommand(*it);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,6 @@ class cmake
|
||||||
*/
|
*/
|
||||||
void AddCommand(cmCommand* );
|
void AddCommand(cmCommand* );
|
||||||
void RenameCommand(const std::string& oldName, const std::string& newName);
|
void RenameCommand(const std::string& oldName, const std::string& newName);
|
||||||
void RemoveCommand(const std::string& name);
|
|
||||||
void RemoveUnscriptableCommands();
|
void RemoveUnscriptableCommands();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue