factor out addSuppressionLine from file reading function

This commit is contained in:
Greg Hewgill 2011-02-16 22:26:16 +13:00
parent 8a85b18283
commit 331788246b
2 changed files with 56 additions and 40 deletions

View File

@ -70,6 +70,16 @@ std::string Settings::Suppressions::parseFile(std::istream &istr)
if (line.length() >= 2 && line[0] == '/' && line[1] == '/')
continue;
const std::string errmsg(addSuppressionLine(line));
if (!errmsg.empty())
return errmsg;
}
return "";
}
std::string Settings::Suppressions::addSuppressionLine(const std::string &line)
{
std::istringstream lineStream(line);
std::string id;
std::string file;
@ -112,7 +122,6 @@ std::string Settings::Suppressions::parseFile(std::istream &istr)
const std::string errmsg(addSuppression(id, file, lineNumber));
if (!errmsg.empty())
return errmsg;
}
return "";
}

View File

@ -180,6 +180,13 @@ public:
*/
std::string parseFile(std::istream &istr);
/**
* @brief Don't show the given error.
* @param str Description of error to suppress (in id:file:line format).
* @return error message. empty upon success
*/
std::string addSuppressionLine(const std::string &line);
/**
* @brief Don't show this error. If file and/or line are optional. In which case
* the errorId alone is used for filtering.