You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

100 lines
2.9 KiB

#ifndef ESEVERITYLEVEL_H
#define ESEVERITYLEVEL_H
#include <QtCore>
/**
* @class ESeverityLevel ESeverityLevel.h "include/ESeverityLevel.h"
* @brief The ESeverity enumeration class
* @date 07 Aug 2019
*
* Contains the reference enumerator for
* severity of log messages.
*/
class ESeverityLevel : public QObject
{
Q_OBJECT
private:
// Private constructor prevent the enumeration class from being instantiated
explicit ESeverityLevel(QObject* parent = nullptr);
public:
/**
* @brief The eSeverityLevel enum
* Contains the reference enumerator for
* severity levels. The severity of message
* are defined to the syslog standard
* severity levels as follows (from High to Low):
* 0-Emergency
* 1-Alert
* 2-Critical
* 3-Error
* 4-Warning
* 5-Notice
* 6-Informational
* 7-Debug
*
* For more information refer to https://en.wikipedia.org/wiki/Syslog
*/
enum eSeverityLevel : quint8
{
/// 0-System is unusable
/// A panic condition.
Emergency,
/// 1-Action must be taken immediately
/// A condition tha should be corrected immediately,
/// such as corrupted system databases.
Alert,
/// 2-Critical conditions
/// Hard device errors.
Critical,
/// 3-Error conditions
Error,
/// 4-Warning conditions
Warning,
/// 5-Normal but significant conditions
/// Conditions that are not error conditinos,
/// but that may require special handling.
Notice,
/// 6-Informational messages
Informational,
/// 7-Debug-level messages
/// Messages that contain information normally of
/// use only when debugging a program.
Debug,
/// 8-Invalid Severity
InvalidSeverity
};
Q_ENUM(eSeverityLevel)
/**
* @brief enum to string converter
* @param qtEnum Enumerator to be converted to the relevant string
* @return String relevant to the input eLogId enumerator
* @date 07 Aug 2019
*
* Converts the eEseverityLevel enumerator to the relevant string
*/
static QString qtEnumToQString(const eSeverityLevel qtEnum)
{
return QString(QMetaEnum::fromType<eSeverityLevel>().valueToKey(qtEnum));
}
/**
* @brief string to enum converter
* @param QString String to be converted to the relevane enum
* @return Enum relevant to the input string
* @date 26 Oct 2019
*
* Converts the string to the relevant eEseverityLevel enumerator
*/
static quint8 QStringToQTEnum(const QString key)
{
return static_cast<quint8> (QMetaEnum::fromType<eSeverityLevel>().keyToValue(key.toStdString().c_str()));
}
};
#endif // ESEVERITYLEVEL_H