--enable: readded code so that parameters can be comma separated

This commit is contained in:
Daniel Marjamäki 2009-12-04 21:31:14 +01:00
parent 737844d652
commit 052ce15176
1 changed files with 20 additions and 1 deletions

View File

@ -116,10 +116,29 @@ bool Settings::isSuppressed(const std::string &errorId, const std::string &file,
void Settings::addEnabled(const std::string &str)
{
// Enable parameters may be comma separated...
if (str.find(",") != std::string::npos)
{
std::string::size_type prevPos = 0;
std::string::size_type pos = 0;
while ((pos = str.find(",", pos)) != std::string::npos)
{
if (pos == prevPos)
throw std::runtime_error("wrong --enable argument ''");
addEnabled(str.substr(prevPos, pos - prevPos));
++pos;
prevPos = pos;
}
if (prevPos >= str.length())
throw std::runtime_error("wrong --enable argument ''");
addEnabled(str.substr(prevPos));
return;
}
bool handled = false;
if (str == "all")
handled = _checkCodingStyle = _showAll = _force = true;
handled = _checkCodingStyle = _showAll = true;
else if (str == "style")
handled = _checkCodingStyle = true;
else if (str == "possibleError")