Commit d8948a3f authored by Artur Grunau's avatar Artur Grunau
Browse files

LogHighlighter: fix compilation errors with GCC

Due to its language extensions, MSVC is more permissive than GCC with
respect to C++ code that doesn't fully comply with the language
standard. LogHighlighter relied on 2 such extensions: non-const rvalue
references, and closing nested template argument lists with '>>'
(instead of '> >'). Its code has now been fixed to conform to the
standard, and compiles fine with GCC 4.7 as a result.
parent 4f72e6fd
......@@ -47,7 +47,7 @@ namespace campvis {
_filterMatchFormat.setForeground(fgBrush);
// Rules for highlighting date stamps, time stamps, and categories
std::list<std::pair<QRegExp, QTextCharFormat>>::iterator it = _rules.begin();
std::list< std::pair<QRegExp, QTextCharFormat> >::iterator it = _rules.begin();
std::pair<QRegExp, QTextCharFormat>& dateStampRule = *it++;
dateStampRule.first.setPattern("\\[(\\d{2}\\.){2}\\d{4}\\]");
......@@ -63,7 +63,7 @@ namespace campvis {
// Rules for highlighting log levels
_logLevelRegExp = new QRegExp("\\((Debug|Info|Warning|Error|Fatal)\\)");
std::list<std::pair<QString, QTextCharFormat>>::iterator logLevelIt = _logLevelRules.begin();
std::list< std::pair<QString, QTextCharFormat> >::iterator logLevelIt = _logLevelRules.begin();
std::pair<QString, QTextCharFormat>& debugRule = *logLevelIt++;
debugRule.first = "Debug";
......@@ -101,7 +101,7 @@ namespace campvis {
void LogHighlighter::highlightBlock(const QString& text)
{
int offset = 0;
std::list<std::pair<QRegExp, QTextCharFormat>>::iterator it = _rules.begin();
std::list< std::pair<QRegExp, QTextCharFormat> >::iterator it = _rules.begin();
do {
std::pair<QRegExp, QTextCharFormat>& rule = *it++;
......@@ -149,8 +149,8 @@ namespace campvis {
int pos = _logLevelRegExp->indexIn(text, offset);
if (pos != -1) {
QString& logLevel = _logLevelRegExp->cap(1);
std::list<std::pair<QString, QTextCharFormat>>::iterator it = _logLevelRules.begin();
const QString& logLevel = _logLevelRegExp->cap(1);
std::list< std::pair<QString, QTextCharFormat> >::iterator it = _logLevelRules.begin();
do {
std::pair<QString, QTextCharFormat>& rule = *it++;
......
......@@ -101,11 +101,11 @@ namespace campvis {
*/
int highlightRegExp(const QString& text, int offset, const QRegExp& regExp, const QTextCharFormat& format);
const QRegExp* _filterRegExp; ///< Current filter regexp
const QRegExp* _logLevelRegExp; ///< Regexp matching log level strings
QTextCharFormat _filterMatchFormat; ///< Format for highlighting filter matches
std::list<std::pair<QRegExp, QTextCharFormat>> _rules; ///< Set of general highlighting rules
std::list<std::pair<QString, QTextCharFormat>> _logLevelRules; ///< Highlighting rules for log levels
const QRegExp* _filterRegExp; ///< Current filter regexp
const QRegExp* _logLevelRegExp; ///< Regexp matching log level strings
QTextCharFormat _filterMatchFormat; ///< Format for highlighting filter matches
std::list< std::pair<QRegExp, QTextCharFormat> > _rules; ///< Set of general highlighting rules
std::list< std::pair<QString, QTextCharFormat> > _logLevelRules; ///< Highlighting rules for log levels
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment