tools/errmsg: code correction

This commit is contained in:
Daniel Marjamäki 2009-01-06 17:20:19 +00:00
parent 934b251ec6
commit a62d3da857
1 changed files with 7 additions and 3 deletions

View File

@ -19,16 +19,20 @@ public:
static const unsigned int ALL = 1; static const unsigned int ALL = 1;
static const unsigned int STYLE = 2; static const unsigned int STYLE = 2;
std::string msg(const char str[]) const std::string msg(bool code) const
{ {
std::string ret(str + _msg + str); const char *str = code ? "\"" : "";
std::string ret( str + _msg + str );
if (! _par1.empty()) if (! _par1.empty())
{ {
std::string::size_type pos = 0; std::string::size_type pos = 0;
while ((pos = ret.find("%1", pos)) != std::string::npos) while ((pos = ret.find("%1", pos)) != std::string::npos)
{ {
ret.erase(pos, 2); ret.erase(pos, 2);
ret.insert(pos, str + _par1 + str); if ( code )
ret.insert(pos, "\" + " + _par1 + " + \"");
else
ret.insert(pos, _par1);
} }
} }
return ret; return ret;