swift
Loading...
Searching...
No Matches
swift::misc::CLogPattern Class Reference

Value class for matching log messages based on their categories. More...

#include <logpattern.h>

Inheritance diagram for swift::misc::CLogPattern:
[legend]

Public Member Functions

 CLogPattern ()
 Default constructed CLogPattern will match any message.
CLogPattern withSeverity (CStatusMessage::StatusSeverity severity) const
 Returns a CLogPattern which will match the same messages as this one, but only with a given severity.
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 severities.
CLogPattern withSeverityAtOrAbove (CStatusMessage::StatusSeverity minimumSeverity) const
 Returns a CLogPattern which will match the same messages, but only with a severity at or above the given severity.
bool match (const CStatusMessage &message) const
 Returns true if the given message matches this pattern.
bool matches (const CVariant &message) const
 This class acts as a SharedState filter when stored in a CVariant.
QSet< QString > getCategoryStrings () const
 Technical category names matched by this pattern.
bool isProperSubsetOf (const CLogPattern &other) const
 Returns true if this pattern is a proper subset of the other pattern.
QString convertToQString (bool i18n=false) const
 Cast as QString.
void marshallToDbus (QDBusArgument &argument) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &argument)
 Unmarshall without begin/endStructure, for when composed within another object.
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
Public Member Functions inherited from swift::misc::mixin::MetaType< CLogPattern >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object.
QString getClassName () const
 Class name.
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
Public Member Functions inherited from swift::misc::mixin::Index< CLogPattern >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const CLogPattern &compareValue) const
 Compare for index.
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?
Public Member Functions inherited from swift::misc::mixin::String< CLogPattern >
QString toQString (bool i18n=false) const
 Cast as QString.
std::string toStdString (bool i18n=false) const
 To std string.
QString stringForStreaming () const
 String for streaming operators.
Public Member Functions inherited from swift::misc::mixin::Icon< CLogPattern >
CIcons::CIcons::StandardIconUnknown16 toIcon () const
 As icon, not implemented by all classes.

Static Public Member Functions

static const QStringList & allHumanReadableNames ()
 Get a list of human-readable names of predefined log patterns.
static const CLogPattern & fromHumanReadableName (const QString &name)
 Return a predefined CLogPattern corresponding to the given human-readable name.
static QStringList humanReadableNamesFrom (const CStatusMessage &message)
 Human readable categories of message.
static QStringList humanOrTechnicalCategoriesFrom (const CStatusMessage &message)
 Human or machine readable categories of message.
static CLogPattern exactMatch (const CLogCategory &category)
 Returns a CLogPattern which will match any message with the given category.
static CLogPattern anyOf (const CLogCategoryList &categories)
 Returns a CLogPattern which will match any message with any of the given categories.
static CLogPattern allOf (const CLogCategoryList &categories)
 Returns a CLogPattern which will match any message with all of the given categories.
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 endsWith (const QString &suffix)
 Returns a CLogPattern which will match any message with a category which ends with the given suffix.
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 Public Member Functions inherited from swift::misc::mixin::MetaType< CLogPattern >
static void registerMetadata ()
 Register metadata.

Additional Inherited Members

Public Types inherited from swift::misc::mixin::Index< CLogPattern >
enum  ColumnIndex
 Base class enums. More...

Detailed Description

Value class for matching log messages based on their categories.

Definition at line 40 of file logpattern.h.

Constructor & Destructor Documentation

◆ CLogPattern()

swift::misc::CLogPattern::CLogPattern ( )

Default constructed CLogPattern will match any message.

Definition at line 105 of file logpattern.cpp.

Member Function Documentation

◆ allHumanReadableNames()

const QStringList & swift::misc::CLogPattern::allHumanReadableNames ( )
static

Get a list of human-readable names of predefined log patterns.

Definition at line 62 of file logpattern.cpp.

◆ allOf()

CLogPattern swift::misc::CLogPattern::allOf ( const CLogCategoryList & categories)
static

Returns a CLogPattern which will match any message with all of the given categories.

Definition at line 126 of file logpattern.cpp.

◆ anyOf()

CLogPattern swift::misc::CLogPattern::anyOf ( const CLogCategoryList & categories)
static

Returns a CLogPattern which will match any message with any of the given categories.

Definition at line 112 of file logpattern.cpp.

◆ contains()

CLogPattern swift::misc::CLogPattern::contains ( const QString & substring)
static

Returns a CLogPattern which will match any message with a category which contains the given substring.

Definition at line 144 of file logpattern.cpp.

◆ convertToQString()

QString swift::misc::CLogPattern::convertToQString ( bool i18n = false) const

Cast as QString.

Definition at line 357 of file logpattern.cpp.

◆ empty()

CLogPattern swift::misc::CLogPattern::empty ( )
static

Returns a CLogPattern which will match any message without a category.

Definition at line 146 of file logpattern.cpp.

◆ endsWith()

CLogPattern swift::misc::CLogPattern::endsWith ( const QString & suffix)
static

Returns a CLogPattern which will match any message with a category which ends with the given suffix.

Definition at line 142 of file logpattern.cpp.

◆ exactMatch()

CLogPattern swift::misc::CLogPattern::exactMatch ( const CLogCategory & category)
static

Returns a CLogPattern which will match any message with the given category.

Definition at line 107 of file logpattern.cpp.

◆ fromHumanReadableName()

const CLogPattern & swift::misc::CLogPattern::fromHumanReadableName ( const QString & name)
static

Return a predefined CLogPattern corresponding to the given human-readable name.

Definition at line 91 of file logpattern.cpp.

◆ getCategoryStrings()

QSet< QString > swift::misc::CLogPattern::getCategoryStrings ( ) const
inline

Technical category names matched by this pattern.

Definition at line 104 of file logpattern.h.

◆ humanOrTechnicalCategoriesFrom()

QStringList swift::misc::CLogPattern::humanOrTechnicalCategoriesFrom ( const CStatusMessage & message)
static

Human or machine readable categories of message.

Definition at line 81 of file logpattern.cpp.

◆ humanReadableNamesFrom()

QStringList swift::misc::CLogPattern::humanReadableNamesFrom ( const CStatusMessage & message)
static

Human readable categories of message.

Definition at line 68 of file logpattern.cpp.

◆ isProperSubsetOf()

bool swift::misc::CLogPattern::isProperSubsetOf ( const CLogPattern & other) const

Returns true if this pattern is a proper subset of the other pattern.

See also
https://en.wikipedia.org/wiki/Proper_subset

Pattern A is a proper subset of pattern B iff pattern B would match every category which pattern A matches, plus at least one other category. This induces a partial ordering which can be used as the comparator in a topological sorting algorithm, to sort patterns by their generality.

Definition at line 232 of file logpattern.cpp.

◆ marshallToDbus()

void swift::misc::CLogPattern::marshallToDbus ( QDBusArgument & argument) const

Marshall without begin/endStructure, for when composed within another object.

Definition at line 377 of file logpattern.cpp.

◆ marshalToDataStream()

void swift::misc::CLogPattern::marshalToDataStream ( QDataStream & stream) const

Marshal a value to a QDataStream.

Definition at line 406 of file logpattern.cpp.

◆ match()

bool swift::misc::CLogPattern::match ( const CStatusMessage & message) const

Returns true if the given message matches this pattern.

Definition at line 195 of file logpattern.cpp.

◆ matches()

bool swift::misc::CLogPattern::matches ( const CVariant & message) const
inline

This class acts as a SharedState filter when stored in a CVariant.

Definition at line 101 of file logpattern.h.

◆ startsWith()

CLogPattern swift::misc::CLogPattern::startsWith ( const QString & prefix)
static

Returns a CLogPattern which will match any message with a category which starts with the given prefix.

Definition at line 140 of file logpattern.cpp.

◆ unmarshalFromDataStream()

void swift::misc::CLogPattern::unmarshalFromDataStream ( QDataStream & stream)

Unmarshal a value from a QDataStream.

Definition at line 417 of file logpattern.cpp.

◆ unmarshallFromDbus()

void swift::misc::CLogPattern::unmarshallFromDbus ( const QDBusArgument & argument)

Unmarshall without begin/endStructure, for when composed within another object.

Definition at line 389 of file logpattern.cpp.

◆ withSeverities()

CLogPattern swift::misc::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 severities.

Definition at line 155 of file logpattern.cpp.

◆ withSeverity()

CLogPattern swift::misc::CLogPattern::withSeverity ( CStatusMessage::StatusSeverity severity) const

Returns a CLogPattern which will match the same messages as this one, but only with a given severity.

Definition at line 148 of file logpattern.cpp.

◆ withSeverityAtOrAbove()

CLogPattern swift::misc::CLogPattern::withSeverityAtOrAbove ( CStatusMessage::StatusSeverity minimumSeverity) const

Returns a CLogPattern which will match the same messages, but only with a severity at or above the given severity.

Definition at line 162 of file logpattern.cpp.


The documentation for this class was generated from the following files: