Fixed #4622 (Patch: Improve formatting for custom templates)
This commit is contained in:
parent
30bdab5d8d
commit
0dca6e51a0
|
@ -298,10 +298,16 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
|
||||||
// template is given. Reformat the output according to it
|
// template is given. Reformat the output according to it
|
||||||
else {
|
else {
|
||||||
std::string result = outputFormat;
|
std::string result = outputFormat;
|
||||||
|
// Support a few special characters to allow to specific formatting, see http://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=4&t=494&sid=21715d362c0dbafd3791da4d9522f814
|
||||||
|
// Substitution should be done first so messages from cppcheck never get translated.
|
||||||
|
findAndReplace(result, "\\b", "\b");
|
||||||
|
findAndReplace(result, "\\n", "\n");
|
||||||
|
findAndReplace(result, "\\r", "\r");
|
||||||
|
findAndReplace(result, "\\t", "\t");
|
||||||
|
|
||||||
findAndReplace(result, "{id}", _id);
|
findAndReplace(result, "{id}", _id);
|
||||||
findAndReplace(result, "{severity}", Severity::toString(_severity));
|
findAndReplace(result, "{severity}", Severity::toString(_severity));
|
||||||
findAndReplace(result, "{message}", verbose ? _verboseMessage : _shortMessage);
|
findAndReplace(result, "{message}", verbose ? _verboseMessage : _shortMessage);
|
||||||
|
|
||||||
if (!_callStack.empty()) {
|
if (!_callStack.empty()) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << _callStack.back().line;
|
oss << _callStack.back().line;
|
||||||
|
|
|
@ -448,6 +448,8 @@ gui/test.cpp:16: error: Mismatching allocation and deallocation: k</programlisti
|
||||||
<programlisting>Checking gui/test.cpp...
|
<programlisting>Checking gui/test.cpp...
|
||||||
gui/test.cpp,31,error,memleak,Memory leak: b
|
gui/test.cpp,31,error,memleak,Memory leak: b
|
||||||
gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocation: k</programlisting>
|
gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocation: k</programlisting>
|
||||||
|
|
||||||
|
<para>The escape sequences \b (backspace), \n (newline), \r (formfeed) and \t (horizontal tab) are supported.</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter>
|
<chapter>
|
||||||
|
|
Loading…
Reference in New Issue