6#ifndef SWIFT_MISC_LOGPATTERN_H
7#define SWIFT_MISC_LOGPATTERN_H
9#include <QDBusArgument>
29template <
class Key,
class T>
112 bool isProperSubsetOf(
const CLogPattern &other)
const;
115 QString convertToQString(
bool i18n =
false)
const;
124 void marshalToDataStream(
QDataStream &stream)
const;
130 bool checkInvariants()
const;
144 CLogPattern(Strategy strategy,
const QSet<QString> &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();
171 static const QHash<QString, CLogPattern> &allHumanReadablePatterns();
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.
static QStringList humanReadableNamesFrom(const CStatusMessage &message)
Human readable categories of message.
bool match(const CStatusMessage &message) const
Returns true if the given message matches this pattern.
QSet< QString > getCategoryStrings() const
Technical category names matched by this pattern.
static QStringList humanOrTechnicalCategoriesFrom(const CStatusMessage &message)
Human or machine readable categories of message.
static const CLogPattern & fromHumanReadableName(const QString &name)
Return a predefined CLogPattern corresponding to the given human-readable name.
CLogPattern withSeverities(const QSet< CStatusMessage::StatusSeverity > &severities) const
Returns a CLogPattern which will match the same messages as this one, but only with some given severi...
static CLogPattern endsWith(const QString &suffix)
Returns a CLogPattern which will match any message with a category which ends with the given suffix.
static CLogPattern allOf(const CLogCategoryList &categories)
Returns a CLogPattern which will match any message with all of the given categories.
static const QStringList & allHumanReadableNames()
Get a list of human-readable names of predefined log patterns.
bool matches(const CVariant &message) const
This class acts as a SharedState filter when stored in a CVariant.
static CLogPattern exactMatch(const CLogCategory &category)
Returns a CLogPattern which will match any message with the given category.
CLogPattern withSeverity(CStatusMessage::StatusSeverity severity) const
Returns a CLogPattern which will match the same messages as this one, but only with a given severity.
static CLogPattern startsWith(const QString &prefix)
Returns a CLogPattern which will match any message with a category which starts with the given prefix...
static CLogPattern contains(const QString &substring)
Returns a CLogPattern which will match any message with a category which contains the given substring...
static CLogPattern empty()
Returns a CLogPattern which will match any message without a category.
static CLogPattern anyOf(const CLogCategoryList &categories)
Returns a CLogPattern which will match any message with any of the given categories.
CLogPattern()
Default constructed CLogPattern will match any message.
CLogPattern withSeverityAtOrAbove(CStatusMessage::StatusSeverity minimumSeverity) const
Returns a CLogPattern which will match the same messages, but only with a severity at or above the gi...
Streamable status message, e.g.
swift::misc::StatusSeverity StatusSeverity
Status severities.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
T value() const
Return the value converted to the type T.
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.
QSet< T >::iterator begin()
qsizetype size() const const
#define SWIFT_MISC_EXPORT
Export a class or function from the library.