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.
27 lines
898 B
27 lines
898 B
6 months ago
|
#ifndef JSONPARSER
|
||
|
#define JSONPARSER
|
||
|
|
||
|
#include "include/parser/IParser.h"
|
||
|
#include <QJsonValue>
|
||
|
|
||
|
class JsonParser : public IParser
|
||
|
{
|
||
|
public:
|
||
|
Log parse(const QString& input) const override;
|
||
|
|
||
|
private:
|
||
|
QJsonObject parseJson(const QString& input) const;
|
||
|
|
||
|
std::optional<QString> extractId(const QJsonValue& value) const;
|
||
|
std::optional<ELogLevel> extractLevel(const QJsonValue& value) const;
|
||
|
std::optional<SourceLocationDto> extractSource(const QJsonValue& value) const;
|
||
|
std::optional<QList<MessagePart> > extractMessages(const QJsonValue& value) const;
|
||
|
std::optional<QString> extractScope(const QJsonValue& value) const;
|
||
|
std::optional<qint64> extractThreadId(const QJsonValue& value) const;
|
||
|
std::optional<QDateTime> extractTimestamp(const QJsonValue& value) const;
|
||
|
|
||
|
std::optional<MessagePart> parseMessage(const QJsonValue& value) const;
|
||
|
};
|
||
|
|
||
|
#endif //JSONPARSER
|