Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+70
@@ -0,0 +1,70 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWebSocket/ltswebsocketcommon_export.h>
|
||||
#include "reply_message.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QJsonValue>
|
||||
|
||||
namespace LtsWebSocket
|
||||
{
|
||||
|
||||
|
||||
|
||||
class LTSWEBSOCKETCOMMON_EXPORT AbstractClientMessage
|
||||
{
|
||||
public:
|
||||
AbstractClientMessage(ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data = QJsonValue())
|
||||
: m_type(type)
|
||||
, m_typeId(typeId)
|
||||
, m_uuid(uuid)
|
||||
, m_data(data)
|
||||
, m_client(client)
|
||||
{}
|
||||
|
||||
virtual ~AbstractClientMessage() = default;
|
||||
|
||||
|
||||
|
||||
virtual void process() = 0;
|
||||
|
||||
|
||||
|
||||
virtual bool hasValidData() const = 0;
|
||||
|
||||
|
||||
|
||||
void reply(ReplyMessage *reply)
|
||||
{
|
||||
m_client->addReply(reply);
|
||||
}
|
||||
|
||||
protected:
|
||||
const QString m_type;
|
||||
const int m_typeId;
|
||||
const QString m_uuid;
|
||||
const QJsonValue m_data;
|
||||
ReplyHandler *m_client;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class LTSWEBSOCKETCOMMON_EXPORT InvalidMessage final : public AbstractClientMessage
|
||||
{
|
||||
public:
|
||||
explicit InvalidMessage(ReplyHandler *client, const QString &uuid, const QString &errorText);
|
||||
|
||||
void process() override;
|
||||
bool hasValidData() const override;
|
||||
|
||||
private:
|
||||
QString m_errorText;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user