2022-10-20 11:49:27 +00:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
|
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
|
|
|
|
|
|
|
|
|
#include <qtgrpcglobal_p.h>
|
|
|
|
|
|
2022-12-16 08:55:22 +00:00
|
|
|
#include "qgrpcoperation.h"
|
2022-10-20 11:49:27 +00:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
|
|
/*!
|
2022-12-16 08:55:22 +00:00
|
|
|
\class QGrpcOperation
|
2022-10-20 11:49:27 +00:00
|
|
|
\inmodule QtGrpc
|
2022-12-16 08:55:22 +00:00
|
|
|
\brief The QGrpcOperation class implements common logic to
|
2022-10-20 11:49:27 +00:00
|
|
|
handle communication in Grpc channel.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn template <typename T> T read();
|
|
|
|
|
|
|
|
|
|
Reads message from raw byte array stored in QGrpcCallReply. Returns copy of deserialized
|
|
|
|
|
message or non-initialized message in case of exceptional situation.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void finished();
|
|
|
|
|
The signal indicates the end of communication for this call.
|
|
|
|
|
If signal emitted by stream this means that stream is successfully closed either by client
|
|
|
|
|
or server.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void errorOccurred(const QGrpcStatus &status);
|
|
|
|
|
|
|
|
|
|
The signal is emitted when error with \a status occurs in channel or during serialization.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-12-16 08:55:22 +00:00
|
|
|
QGrpcOperation::QGrpcOperation(QAbstractGrpcClient *parent) : QObject(parent)
|
2022-10-20 11:49:27 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-16 08:55:22 +00:00
|
|
|
QGrpcOperation::~QGrpcOperation()
|
2022-10-20 11:49:27 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Interface for implementation of QAbstractGrpcChannel. Should be used to write raw data from
|
|
|
|
|
channel to reply \a data Raw data received from channel.
|
|
|
|
|
*/
|
2022-12-16 08:55:22 +00:00
|
|
|
void QGrpcOperation::setData(const QByteArray &data)
|
2022-10-20 11:49:27 +00:00
|
|
|
{
|
|
|
|
|
m_data = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|