QGrpcClientInterceptorManager Class

Manages QGrpcClientInterceptor interceptors. 更多...

头: #include <QGrpcClientInterceptorManager>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.7
状态: 技术预览

公共函数

QGrpcClientInterceptorManager ()
~QGrpcClientInterceptorManager ()
void registerInterceptor (std::shared_ptr<QGrpcClientInterceptor> next )
void registerInterceptors (std::vector<std::shared_ptr<QGrpcClientInterceptor>> nextInterceptors )
void run (QGrpcInterceptorContinuation<T> & finalCall , typename QGrpcInterceptorContinuation<T>::ReplyType response , std::shared_ptr<QGrpcChannelOperation> operation , size_t pos = 0)

详细描述

The QGrpcClientInterceptorManager class provides methods for registering and executing QGrpcClientInterceptor interceptors.

另请参阅 Qt GRPC Client Interceptors .

成员函数文档编制

QGrpcClientInterceptorManager:: QGrpcClientInterceptorManager ()

The default constructor, creates QGrpcClientInterceptorManager object.

[noexcept] QGrpcClientInterceptorManager:: ~QGrpcClientInterceptorManager ()

The default destructor, destroyes QGrpcClientInterceptorManager 对象。

void QGrpcClientInterceptorManager:: registerInterceptor ( std::shared_ptr < QGrpcClientInterceptor > next )

注册 QGrpcClientInterceptor interceptor.

放置 next interceptor at the beginning of the interceptor chain. Interceptors are executed in reverse order of registration. For instance,

manager.registerInterceptor(myInterceptor1);
manager.registerInterceptor(myInterceptor2);
					

will result in:

myInterceptor2 -> myInterceptor1 -> Qt GRPC operation
					

order of execution.

void QGrpcClientInterceptorManager:: registerInterceptors ( std::vector < std::shared_ptr < QGrpcClientInterceptor >> nextInterceptors )

Registers multiple QGrpcClientInterceptor interceptors.

Adds the given interceptors to the start of the interceptor chain. While execution occurs in the reverse order of registration, the original order in the nextInterceptors vector is maintained, for example:

manager.registerInterceptor(myInterceptor1);
manager.registerInterceptors({myInterceptor2, myInterceptor3});
					

will result in:

myInterceptor2 -> myInterceptor3 -> myInterceptor1 -> Qt GRPC operation
					

order of execution.

template <typename T> void QGrpcClientInterceptorManager:: run ( QGrpcInterceptorContinuation < T > & finalCall , typename QGrpcInterceptorContinuation < T > ::ReplyType response , std::shared_ptr < QGrpcChannelOperation > operation , size_t pos = 0)

Executes the Qt GRPC interceptors in the chain for a specific QGrpcOperation 类型。

The process initiates with the interceptor located at position pos QGrpcClientInterceptor chain. Both response and operation parameters are relayed to the QGrpcClientInterceptor::intercept () method. Upon reaching the end of the interceptor chain, the finalCall is invoked.