Logging: Remove PatternFlag::Invalid from QLoggingRule
The flag is not orthogonal to the rest, and e.g. checking with flags & Invalid will fail. Rather make it explicit by comparing with 0. Change-Id: I428d5e71f5ecd05f61d543aaa78532548ef93d5a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>bb10
parent
07fef5f3ff
commit
ba4d154737
|
|
@ -62,7 +62,6 @@ Q_GLOBAL_STATIC(QLoggingRegistry, qtLoggingRegistry)
|
|||
Constructs a logging rule with default values.
|
||||
*/
|
||||
QLoggingRule::QLoggingRule() :
|
||||
flags(Invalid),
|
||||
enabled(false)
|
||||
{
|
||||
}
|
||||
|
|
@ -73,7 +72,6 @@ QLoggingRule::QLoggingRule() :
|
|||
*/
|
||||
QLoggingRule::QLoggingRule(const QStringRef &pattern, bool enabled) :
|
||||
messageType(-1),
|
||||
flags(Invalid),
|
||||
enabled(enabled)
|
||||
{
|
||||
parse(pattern);
|
||||
|
|
@ -147,7 +145,6 @@ void QLoggingRule::parse(const QStringRef &pattern)
|
|||
p = pattern;
|
||||
}
|
||||
|
||||
flags = Invalid;
|
||||
if (!p.contains(QLatin1Char('*'))) {
|
||||
flags = FullText;
|
||||
} else {
|
||||
|
|
@ -160,7 +157,7 @@ void QLoggingRule::parse(const QStringRef &pattern)
|
|||
p = QStringRef(p.string(), p.position() + 1, p.length() - 1);
|
||||
}
|
||||
if (p.contains(QLatin1Char('*'))) // '*' only supported at start/end
|
||||
flags = Invalid;
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
category = p.toString();
|
||||
|
|
@ -225,7 +222,7 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
|
|||
bool enabled = (value.compare(QLatin1String("true"),
|
||||
Qt::CaseInsensitive) == 0);
|
||||
QLoggingRule rule(pattern, enabled);
|
||||
if (rule.flags != QLoggingRule::Invalid)
|
||||
if (rule.flags != 0)
|
||||
_rules.append(rule);
|
||||
else
|
||||
warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public:
|
|||
int pass(const QString &categoryName, QtMsgType type) const;
|
||||
|
||||
enum PatternFlag {
|
||||
Invalid = 0x0,
|
||||
FullText = 0x1,
|
||||
LeftFilter = 0x2,
|
||||
RightFilter = 0x4,
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ private slots:
|
|||
|
||||
QLoggingRule rule(QStringRef(&pattern), true);
|
||||
LoggingRuleState state = Invalid;
|
||||
if (rule.flags != QLoggingRule::Invalid) {
|
||||
if (rule.flags != 0) {
|
||||
switch (rule.pass(category, msgType)) {
|
||||
case -1: QFAIL("Shoudn't happen, we set pattern to true"); break;
|
||||
case 0: state = NoMatch; break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue