swift
|
Streamable status message, e.g. More...
Public Types | |
enum | ColumnIndex { IndexCategoriesAsString = CPropertyIndexRef::GlobalIndexCStatusMessage , IndexSeverity , IndexSeverityAsString , IndexSeverityAsIcon , IndexMessage , IndexMessageNoLineBreaks , IndexMessageAsHtml } |
Properties by index. | |
![]() | |
using | base_type = CEmpty |
Base class. | |
![]() | |
using | base_type = CEmpty |
Base class is alias of itself. | |
![]() | |
enum | ColumnIndex { IndexPixmap = 10 , IndexIcon , IndexString } |
Base class enums. | |
![]() | |
enum | ColumnIndex { IndexUtcTimestamp = CPropertyIndexRef::GlobalIndexITimestampBased , IndexUtcTimestampFormattedYmdhms , IndexUtcTimestampFormattedYmdhmsz , IndexUtcTimestampFormattedMdhms , IndexUtcTimestampFormattedMdhmsz , IndexUtcTimestampFormattedDhms , IndexUtcTimestampFormattedHms , IndexUtcTimestampFormattedHm , IndexMSecsSinceEpoch } |
Properties by index. | |
![]() | |
enum | ColumnIndex { IndexOrder = CPropertyIndexRef::GlobalIndexIOrderable , IndexOrderString } |
Properties by index. | |
Public Member Functions | |
CStatusMessage (const CLogCategory &category) | |
Construct a message with some specific category. | |
CStatusMessage (const CLogCategoryList &categories) | |
Construct a message with some specific categories. | |
CStatusMessage (const CLogCategoryList &categories, const CLogCategory &extra) | |
Construct a message with some specific categories. | |
CStatusMessage (const CLogCategoryList &categories, const CLogCategoryList &extra) | |
Construct a message with some specific categories. | |
CStatusMessage () | |
Constructor. | |
CStatusMessage (const CStatusMessage &other) | |
Copy constructor (because of mutex) | |
CStatusMessage & | operator= (const CStatusMessage &other) |
Copy assignment (because of mutex) | |
~CStatusMessage ()=default | |
Destructor. | |
CStatusMessage (QtMsgType type, const QMessageLogContext &context, const QString &message) | |
Construct from a Qt logging triple. More... | |
void | toQtLogTriple (QtMsgType *o_type, QString *o_category, QString *o_message) const |
Convert to a Qt logging triple. More... | |
const CLogCategoryList & | getCategories () const |
Message categories. | |
QString | getCategoriesAsString () const |
Message categories as string. | |
QString | getHumanOrTechnicalCategoriesAsString () const |
The human or technical categories. | |
StatusSeverity | getSeverity () const |
Message severity. | |
bool | clampSeverity (StatusSeverity severity) |
Clip/reduce severity if higher (more critical) | |
bool | isSeverityInfoOrLess () const |
Info or debug, no warning or error. | |
bool | isSeverityHigherOrEqual (CStatusMessage::StatusSeverity severity) const |
Is this message's severity higher or equal. | |
bool | isWarningOrAbove () const |
Warning or above. | |
bool | isSuccess () const |
Operation considered successful. | |
bool | isFailure () const |
Operation considered unsuccessful. | |
QString | getMessage () const |
Message. | |
QString | getMessageNoLineBreaks () const |
Message without line breaks. | |
void | prependMessage (const QString &msg) |
Prepend message. | |
void | appendMessage (const QString &msg) |
Append message. | |
template<class T > | |
bool | isFromClass (const T *pointer=nullptr) const |
Returns true if this message was sent by an instance of class T. | |
void | markAsHandledBy (const QObject *object) const |
Mark the message as having been handled by the given object. | |
bool | wasHandledBy (const QObject *object) const |
Returns true if the message was marked as having been handled by the given object. | |
void | setSeverity (StatusSeverity severity) |
Severity. | |
void | addCategory (const CLogCategory &category) |
Add category, avoids duplicates. | |
void | addValidationCategory () |
Adds validation as category. | |
void | addCategories (const CLogCategoryList &categories) |
Add categories, avoids duplicates. | |
void | setCategory (const CLogCategory &category) |
Reset category. | |
void | setCategories (const CLogCategoryList &categories) |
Reset categories. | |
CIcons::IconIndex | toIcon () const |
Representing icon. | |
const QString & | getSeverityAsString () const |
Severity as string. | |
const CIcon & | getSeverityAsIcon () const |
Severity as icon. | |
QVariant | propertyByIndex (swift::misc::CPropertyIndexRef index) const |
Property by index. More... | |
void | setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant) |
Set property by index. More... | |
int | comparePropertyByIndex (CPropertyIndexRef index, const CStatusMessage &compareValue) const |
Compare for index. More... | |
QString | convertToQString (bool i18n=false) const |
Cast as QString. More... | |
QString | toHtml (bool withIcon, bool withColors) const |
To HTML. | |
template<size_t N> | |
CStatusMessage (const char16_t(&message)[N]) | |
Constructor. | |
CStatusMessage (const QString &message) | |
Constructor. | |
template<size_t N> | |
CStatusMessage (StatusSeverity severity, const char16_t(&message)[N]) | |
Constructor. | |
CStatusMessage (StatusSeverity severity, const QString &message) | |
Constructor. | |
template<size_t N> | |
CStatusMessage (const CLogCategoryList &categories, StatusSeverity severity, const char16_t(&message)[N], bool validation=false) | |
Constructor, also a validation messsage can be directly created. | |
CStatusMessage (const CLogCategoryList &categories, StatusSeverity severity, const QString &message, bool validation=false) | |
Constructor, also a validation messsage can be directly created. | |
CStatusMessage (const char *message)=delete | |
Deleted constructor, to prevent inefficient construction from byte string literal. Explicit so as to avoid ambiguities with functions overloaded on QString and CStatusMessage. | |
CStatusMessage (StatusSeverity severity, const char *message)=delete | |
Deleted constructor, to prevent inefficient construction from byte string literal. Explicit so as to avoid ambiguities with functions overloaded on QString and CStatusMessage. | |
CStatusMessage (const CLogCategoryList &categories, StatusSeverity severity, const char *message, bool validation=false)=delete | |
Deleted constructor, to prevent inefficient construction from byte string literal. Explicit so as to avoid ambiguities with functions overloaded on QString and CStatusMessage. | |
![]() | |
int | getMetaTypeId () const |
Returns the Qt meta type ID of this object. More... | |
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. | |
![]() | |
void | marshallToDbus (QDBusArgument &arg, Tags...) const |
Marshall without begin/endStructure, for when composed within another object. | |
void | unmarshallFromDbus (const QDBusArgument &arg, Tags...) |
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. | |
![]() | |
QJsonObject | toJson () const |
Cast to JSON object. | |
QString | toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented) const |
Convenience function JSON as string. | |
void | convertFromJson (const QJsonObject &json) |
Assign from JSON object. | |
void | convertFromJson (const QString &jsonString, bool acceptCacheFormat=false) |
Assign from JSON object string. | |
![]() | |
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. | |
![]() | |
CPropertyIndexList | apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false) |
Update by variant map. More... | |
void | setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant) |
Set property by index. | |
QVariant | propertyByIndex (CPropertyIndexRef index) const |
Property by index. | |
int | comparePropertyByIndex (CPropertyIndexRef index, const Derived &compareValue) const |
Compare for index. | |
bool | equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const |
Is given variant equal to value of property index? | |
![]() | |
CIcons::IconIndex | toIcon () const |
As icon, not implemented by all classes. | |
![]() | |
QDateTime | getUtcTimestamp () const |
Get timestamp. | |
qint64 | getMSecsSinceEpoch () const |
Timestamp as ms value. | |
qint64 | getTimeDifferenceMs (qint64 compareTime) const |
Time difference in ms. | |
qint64 | getTimeDifferenceAbsMs (qint64 compareTime) const |
Time difference in ms. | |
qint64 | getTimeDifferenceToNowMs () const |
Time difference to now. | |
qint64 | getTimeDifferenceMs (const ITimestampBased &compare) const |
Time difference in ms. | |
qint64 | getAbsTimeDifferenceMs (qint64 compareTime) const |
Time difference in ms. | |
qint64 | getAbsTimeDifferenceMs (const ITimestampBased &compare) const |
Time difference in ms. | |
void | setTimestampToNull () |
Set to null. | |
void | setMSecsSinceEpoch (qint64 mSecsSinceEpoch) |
Timestamp as ms value. | |
void | setByYearMonthDayHourMinute (const QString &yyyyMMddhhmmss) |
Set by value such as "20141003231045". | |
void | setUtcTimestamp (const QDateTime ×tamp) |
Set timestamp. | |
bool | isNewerThan (const ITimestampBased &otherTimestampObj) const |
Is this newer than other? | |
bool | isNewerThan (qint64 mSecsSinceEpoch) const |
Is newer than epoch value? | |
bool | isOlderThan (const ITimestampBased &otherTimestampObj) const |
Is this older than other? | |
bool | isOlderThan (qint64 mSecsSinceEpoch) const |
Is this older than other? | |
bool | isOlderThanNowMinusOffset (int offsetMs) const |
Older than now-offset. | |
bool | isSame (const ITimestampBased &otherTimestampObj) const |
Same timestamp. | |
qint64 | msecsTo (const ITimestampBased &otherTimestampObj) const |
Time difference. | |
qint64 | absMsecsTo (const ITimestampBased &otherTimestampObj) const |
Time difference. | |
qint64 | msecsToNow () const |
Milliseconds to now. | |
void | setCurrentUtcTime () |
Set the current time as timestamp. | |
void | addMsecs (qint64 ms) |
Add the given number of milliseconds to the timestamp. | |
QString | getFormattedUtcTimestampHms () const |
As hh:mm:ss. | |
QString | getFormattedUtcTimestampHmsz () const |
As hh:mm:ss.zzz. | |
QString | getFormattedUtcTimestampHm () const |
As hh:mm. | |
QString | getFormattedUtcTimestampDhms () const |
As dd HH mm ss. | |
QString | getFormattedUtcTimestampMdhms () const |
As MM dd HH mm ss. | |
QString | getFormattedUtcTimestampMdhmsz () const |
As MM dd HH mm ss.zzz. | |
QString | getFormattedUtcTimestampYmdhms () const |
As yyyy MM dd HH mm ss. | |
QString | getFormattedUtcTimestampYmdhmsz () const |
As yyyy MM dd HH mm ss.zzz. | |
bool | hasValidTimestamp () const |
Valid timestamp? | |
![]() | |
int | getOrder () const |
Order. | |
QString | getOrderAsString () const |
Order as string. | |
void | setOrder (int order) |
Set order. | |
bool | hasValidOrder () const |
Valid order set? | |
Static Public Member Functions | |
static const QString & | severityToString (StatusSeverity severity) |
Severity as string. | |
static QString | severitiesToString (const QSet< StatusSeverity > &severities) |
Severity set as string. | |
static StatusSeverity | stringToSeverity (const QString &severity) |
Severity as string, if not possible to convert. More... | |
static const QStringList & | allSeverityStrings () |
Severities as strings. | |
static const CIcon & | convertToIcon (const CStatusMessage &statusMessage) |
Representing icon. | |
static const CIcon & | convertToIcon (CStatusMessage::StatusSeverity severity) |
Representing icon. | |
static const QString & | convertToIconResource (CStatusMessage::StatusSeverity severity) |
Representing icon. | |
static CStatusMessage | fromDatabaseJson (const QJsonObject &json) |
Object from JSON. | |
static CStatusMessage | fromJsonException (const CJsonException &ex, const CLogCategoryList &categories, const QString &prefix) |
Object from JSON exception message. | |
static void | registerMetadata () |
Register metadata. More... | |
![]() | |
static void | registerMetadata () |
Register metadata. | |
![]() | |
template<class DerivedObj = Derived> | |
static DerivedObj | fromJson (const QJsonObject &json) |
Get object from QJsonObject. | |
template<class DerivedObj = Derived> | |
static DerivedObj | fromJson (const QString &jsonString, bool acceptCacheJson=false) |
Get object from JSON string. | |
template<class DerivedObj = Derived> | |
static DerivedObj | fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg) |
Get object from JSON string. | |
![]() | |
static bool | isAnyTimestampIndex (int index) |
Any of the timestamp indexes. | |
static bool | canHandleIndex (CPropertyIndexRef index) |
Can given index be handled. | |
![]() | |
static bool | isAnyOrderIndex (int index) |
Any order index. | |
using | StatusSeverity = swift::misc::StatusSeverity |
Status severities. More... | |
constexpr static auto | SeverityDebug = swift::misc::SeverityDebug |
Status severities. More... | |
constexpr static auto | SeverityInfo = swift::misc::SeverityInfo |
Status severities. More... | |
constexpr static auto | SeverityWarning = swift::misc::SeverityWarning |
Status severities. More... | |
constexpr static auto | SeverityError = swift::misc::SeverityError |
Status severities. More... | |
Additional Inherited Members | |
![]() | |
CValueObject ()=default | |
Default constructor. | |
CValueObject (const CValueObject &)=default | |
Copy constructor. | |
CValueObject & | operator= (const CValueObject &)=default |
Copy assignment operator. | |
~CValueObject ()=default | |
Destructor. | |
CEmpty ()=default | |
Inheriting constructors. | |
CEmpty (const CEmpty &)=default | |
Inheriting constructors. | |
![]() | |
CEmpty ()=default | |
Protected default constructor. | |
CEmpty (const CEmpty &)=default | |
Protected copy constructor. | |
CEmpty & | operator= (const CEmpty &)=default |
Protected copy assignment operator. | |
~CEmpty ()=default | |
Non-virtual protected destructor. | |
![]() | |
ITimestampBased () | |
Constructor. | |
ITimestampBased (qint64 msSincePoch) | |
Constructor. | |
ITimestampBased (const QDateTime ×tamp) | |
Constructor. | |
QVariant | propertyByIndex (CPropertyIndexRef index) const |
Property by index. More... | |
void | setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant) |
Set property by index. More... | |
int | comparePropertyByIndex (CPropertyIndexRef index, const ITimestampBased &compareValue) const |
Compare for index. More... | |
void | updateMissingParts (const ITimestampBased &other) |
Update missing parts. | |
![]() | |
IOrderable () | |
Constructor. | |
IOrderable (int order) | |
Constructor. | |
QVariant | propertyByIndex (CPropertyIndexRef index) const |
Property by index. More... | |
void | setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant) |
Set property by index. More... | |
int | comparePropertyByIndex (CPropertyIndexRef index, const IOrderable &compareValue) const |
Compare for index. More... | |
![]() | |
static bool | canHandleIndex (CPropertyIndexRef index) |
Can given index be handled. | |
![]() | |
qint64 | m_timestampMSecsSinceEpoch = -1 |
timestamp value | |
![]() | |
int | m_order = -1 |
order number | |
Status severities.
Definition at line 398 of file statusmessage.h.
swift::misc::CStatusMessage::CStatusMessage | ( | QtMsgType | type, |
const QMessageLogContext & | context, | ||
const QString & | message | ||
) |
Construct from a Qt logging triple.
Definition at line 156 of file statusmessage.cpp.
int swift::misc::CStatusMessage::comparePropertyByIndex | ( | CPropertyIndexRef | index, |
const CStatusMessage & | compareValue | ||
) | const |
Compare for index.
Definition at line 443 of file statusmessage.cpp.
QString swift::misc::CStatusMessage::convertToQString | ( | bool | i18n = false | ) | const |
QVariant swift::misc::CStatusMessage::propertyByIndex | ( | swift::misc::CPropertyIndexRef | index | ) | const |
Property by index.
Definition at line 395 of file statusmessage.cpp.
|
static |
Register metadata.
Definition at line 299 of file statusmessage.cpp.
void swift::misc::CStatusMessage::setPropertyByIndex | ( | swift::misc::CPropertyIndexRef | index, |
const QVariant & | variant | ||
) |
Set property by index.
Definition at line 413 of file statusmessage.cpp.
|
static |
Severity as string, if not possible to convert.
Definition at line 306 of file statusmessage.cpp.
void swift::misc::CStatusMessage::toQtLogTriple | ( | QtMsgType * | o_type, |
QString * | o_category, | ||
QString * | o_message | ||
) | const |
Convert to a Qt logging triple.
Definition at line 172 of file statusmessage.cpp.
|
staticconstexpr |
Status severities.
Definition at line 399 of file statusmessage.h.
|
staticconstexpr |
Status severities.
Definition at line 402 of file statusmessage.h.
|
staticconstexpr |
Status severities.
Definition at line 400 of file statusmessage.h.
|
staticconstexpr |
Status severities.
Definition at line 401 of file statusmessage.h.