QGrpcChannel Class

The QGrpcChannel class is a gRPC-cpp native api implementation of QAbstractGrpcChannel 接口。 更多...

头: #include <QGrpcChannel>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
继承: QAbstractGrpcChannel

公共函数

QGrpcChannel (const QUrl & url , QGrpcChannel::NativeGrpcChannelCredentials credentialsType , const QStringList & credentialsList )
QGrpcChannel (const QUrl & url , QGrpcChannel::NativeGrpcChannelCredentials credentialsType )
virtual ~QGrpcChannel () override

重实现公共函数

virtual QGrpcStatus call (QLatin1StringView method , QLatin1StringView service , QByteArrayView args , QByteArray & ret ) override
virtual std::shared_ptr<QGrpcCallReply> call (QAbstractGrpcClient * client , QLatin1StringView method , QLatin1StringView service , QByteArrayView args ) override
virtual std::shared_ptr<QAbstractProtobufSerializer> serializer () const override
virtual void startStream (QGrpcStream * stream , QLatin1StringView service ) override

详细描述

QGrpcChannel accepts the same grpc::ChannelCredentials type that is required by native-api grpc::CreateChannel.

另请参阅 gRPC ChannelCredentials .

成员函数文档编制

[explicit] QGrpcChannel:: QGrpcChannel (const QUrl & url , QGrpcChannel::NativeGrpcChannelCredentials credentialsType , const QStringList & credentialsList )

Constructs a gRPC channel, with url , credentialsType ,和 credentialsList 对象。

[explicit] QGrpcChannel:: QGrpcChannel (const QUrl & url , QGrpcChannel::NativeGrpcChannelCredentials credentialsType )

Constructs a gRPC channel, with url , credentialsType and an empty credentials list.

[override virtual] QGrpcChannel:: ~QGrpcChannel ()

销毁 QGrpcChannel 对象。

[override virtual] QGrpcStatus QGrpcChannel:: call ( QLatin1StringView method , QLatin1StringView service , QByteArrayView args , QByteArray & ret )

重实现: QAbstractGrpcChannel::call (QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret).

Synchronously calls the RPC method and writes the result to the output parameter ret .

The RPC method name is concatenated from the method and service parameters with the given args .

[override virtual] std::shared_ptr < QGrpcCallReply > QGrpcChannel:: call ( QAbstractGrpcClient * client , QLatin1StringView method , QLatin1StringView service , QByteArrayView args )

重实现: QAbstractGrpcChannel::call (QAbstractGrpcClient *client, QLatin1StringView method, QLatin1StringView service, QByteArrayView args).

Asynchronously calls the RPC method.

The RPC method name is concatenated from the method and service parameters with the given args . The method can emit QGrpcCallReply::finished () 和 QGrpcCallReply::errorOccurred () signals on a QGrpcCallReply returned object.

[override virtual] std::shared_ptr < QAbstractProtobufSerializer > QGrpcChannel:: serializer () const

重实现: QAbstractGrpcChannel::serializer() const .

返回新近创建的 QProtobufSerializer shared pointer.

[override virtual] void QGrpcChannel:: startStream ( QGrpcStream * stream , QLatin1StringView service )

重实现: QAbstractGrpcChannel::startStream (QGrpcStream *stream, QLatin1StringView service).

Starts a stream on a stream 使用 QGrpcStream::method () 和 service to get the name of the RPC method.

调用 QGrpcStream::handler () when the stream receives data from the server. The method may emit QGrpcStream::errorOccurred () when the stream has terminated with an error.