qTbot 0.89.ee6949a
qTbot is base back end library for your c++ Qt projects.
ijsonbasedupdate.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2024 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8
9#include "ijsonbasedupdate.h"
10#include "qjsondocument.h"
11
12namespace qTbot {
13
17
19 return !rawJson().empty();
20}
21
22void IJsonBasedUpdate::setRawData(const QByteArray &newRawData) {
23 iUpdate::setRawData(newRawData);
24
25 auto doc = QJsonDocument::fromJson(newRawData);
26 if (!doc.isObject()) {
27 return;
28 }
29 setRawJson(doc.object());
30
31}
32}
const QJsonObject & rawJson() const
rawJson Telegram use rest api with json objects. So all received messages will be parsed in to jsobje...
virtual void setRawJson(const QJsonObject &newRawJson)
setRawJson this method convert jsobject into telegram message.
void setRawData(const QByteArray &newRawData) override
setRawData This method sets new raw data value.
bool isValid() const override
isValid return true if the message is valid else false.
virtual void setRawData(const QByteArray &newRawData)
setRawData This method sets new raw data value.
Definition iupdate.cpp:20