Move NameDispenser into its own file.

This commit is contained in:
chriseth
2018-05-02 17:39:42 +02:00
parent 78945e81e4
commit d3c11a49e5
4 changed files with 76 additions and 20 deletions
-13
View File
@@ -252,16 +252,3 @@ string BodyCopier::translateIdentifier(string const& _name)
else
return _name;
}
string NameDispenser::newName(string const& _prefix)
{
string name = _prefix;
size_t suffix = 0;
while (name.empty() || m_usedNames.count(name))
{
suffix++;
name = _prefix + "_" + std::to_string(suffix);
}
m_usedNames.insert(name);
return name;
}