QGrpcOperation Class

The QGrpcOperation class implements common logic to handle the gRPC communication from the client side. More...

Header: #include <QGrpcOperation>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
Inherits: QObject
Inherited By:

QGrpcBidirStream, QGrpcCallReply, QGrpcClientStream, and QGrpcServerStream

Status: Technical Preview

Public Functions

void cancel()
bool isFinished() const
QGrpcMetadata metadata() const
QLatin1StringView method() const
T read() const


void errorOccurred(const QGrpcStatus &status) const
void finished()

Detailed Description

Member Function Documentation

void QGrpcOperation::cancel()

Attempts to cancel the operation in a channel and immediately emits QGrpcOperation::errorOccurred with the QGrpcStatus::Cancelled status code.

Any manipulation of the operation after this call has no effect.

[signal] void QGrpcOperation::errorOccurred(const QGrpcStatus &status) const

This signal indicates the error occurred during serialization.

This signal is emitted when error with status occurs in channel or during serialization.

See also QAbstractGrpcClient::errorOccurred.

[signal] void QGrpcOperation::finished()

This signal indicates the end of communication for this call.

If this signal is emitted by the stream then this stream is successfully closed either by client or server.

[noexcept] bool QGrpcOperation::isFinished() const

Returns true when QGrpcOperation finished its workflow, meaning it was finished, canceled, or error occurred, otherwise returns false.

[noexcept] QGrpcMetadata QGrpcOperation::metadata() const

Getter of the metadata received from the channel. For the HTTP2 channels it usually contains the HTTP headers received from the server.

[noexcept] QLatin1StringView QGrpcOperation::method() const

Getter of the method that this operation was intialized with.

template <typename T> T QGrpcOperation::read() const

Reads message from raw byte array stored in QGrpcOperation.

Returns a deserialized message or, on failure, a default-constructed message. If deserialization is not successful the QGrpcOperation::errorOccurred signal is emitted.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.