6 #ifndef SWIFT_MISC_LOGPATTERN_H
7 #define SWIFT_MISC_LOGPATTERN_H
9 #include <QDBusArgument>
13 #include <QStringList>
29 template <
class Key,
class T>
35 class CLogCategoryList;
52 static const QStringList &allHumanReadableNames();
55 static const CLogPattern &fromHumanReadableName(
const QString &name);
58 static QStringList humanReadableNamesFrom(
const CStatusMessage &message);
61 static QStringList humanOrTechnicalCategoriesFrom(
const CStatusMessage &message);
76 static CLogPattern startsWith(
const QString &prefix);
82 static CLogPattern contains(
const QString &substring);
91 CLogPattern withSeverities(
const QSet<CStatusMessage::StatusSeverity> &severities)
const;
112 bool isProperSubsetOf(
const CLogPattern &other)
const;
115 QString convertToQString(
bool i18n =
false)
const;
118 void marshallToDbus(QDBusArgument &argument)
const;
121 void unmarshallFromDbus(
const QDBusArgument &argument);
124 void marshalToDataStream(QDataStream &stream)
const;
127 void unmarshalFromDataStream(QDataStream &stream);
130 bool checkInvariants()
const;
144 CLogPattern(Strategy strategy,
const QSet<QString> &strings);
146 QSet<CStatusMessage::StatusSeverity> m_severities;
148 QSet<QString> m_strings;
150 const QString &getString()
const
152 Q_ASSERT(m_strategy == ExactMatch && m_strings.size() == 1);
153 return *m_strings.begin();
155 const QString &getPrefix()
const
157 Q_ASSERT(m_strategy == StartsWith && m_strings.size() == 1);
158 return *m_strings.begin();
160 const QString &getSuffix()
const
162 Q_ASSERT(m_strategy == EndsWith && m_strings.size() == 1);
163 return *m_strings.begin();
165 const QString &getSubstring()
const
167 Q_ASSERT(m_strategy == Contains && m_strings.size() == 1);
168 return *m_strings.begin();
A log category is an arbitrary string tag which can be attached to log messages.
A sequence of log categories.
Value class for matching log messages based on their categories.
QSet< QString > getCategoryStrings() const
Technical category names matched by this pattern.
bool matches(const CVariant &message) const
This class acts as a SharedState filter when stored in a CVariant.
Streamable status message, e.g.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
T to() const
Synonym for value().
CRTP class template which will generate marshalling operators for a derived class with its own marsha...
CRTP class template to generate non-member QDataStream streaming operators.
CRTP class template from which a derived class can inherit icon-related functions.
CRTP class template from which a derived class can inherit property indexing functions.
CRTP class template from which a derived class can inherit string streaming operations.
Free functions in swift::misc.
StatusSeverity
Status severities.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.