Public Member Functions | Private Member Functions | Private Attributes | List of all members
grpc::testing::ProtoFileParser Class Reference

#include <proto_file_parser.h>

Public Member Functions

std::string GetFormattedMethodName (const std::string &method)
 
std::string GetFormattedStringFromMessageType (const std::string &message_type_name, const std::string &serialized_proto, bool is_json_format)
 
std::string GetFormattedStringFromMethod (const std::string &method, const std::string &serialized_proto, bool is_request, bool is_json_format)
 
std::string GetFullMethodName (const std::string &method)
 
std::string GetSerializedProtoFromMessageType (const std::string &message_type_name, const std::string &formatted_proto, bool is_json_format)
 
std::string GetSerializedProtoFromMethod (const std::string &method, const std::string &formatted_proto, bool is_request, bool is_json_format)
 
bool HasError () const
 
bool IsStreaming (const std::string &method, bool is_request)
 
void LogError (const std::string &error_msg)
 
 ProtoFileParser (const std::shared_ptr< grpc::Channel > &channel, const std::string &proto_path, const std::string &protofiles)
 
 ~ProtoFileParser ()
 

Private Member Functions

std::string GetMessageTypeFromMethod (const std::string &method, bool is_request)
 

Private Attributes

std::unique_ptr< protobuf::DescriptorDatabasedesc_db_
 
std::unique_ptr< protobuf::DescriptorPooldesc_pool_
 
std::unique_ptr< protobuf::DynamicMessageFactorydynamic_factory_
 
std::unique_ptr< ErrorPrintererror_printer_
 
std::unique_ptr< protobuf::DescriptorPoolDatabasefile_db_
 
bool has_error_
 
std::unique_ptr< protobuf::compiler::Importerimporter_
 
std::unordered_map< std::string, std::string > known_methods_
 
std::unique_ptr< grpc::ProtoReflectionDescriptorDatabasereflection_db_
 
std::unique_ptr< grpc::protobuf::Messagerequest_prototype_
 
std::string request_text_
 
std::unique_ptr< grpc::protobuf::Messageresponse_prototype_
 
std::vector< const protobuf::ServiceDescriptor * > service_desc_list_
 
protobuf::compiler::DiskSourceTree source_tree_
 

Detailed Description

Definition at line 40 of file proto_file_parser.h.

Constructor & Destructor Documentation

◆ ProtoFileParser()

grpc::testing::ProtoFileParser::ProtoFileParser ( const std::shared_ptr< grpc::Channel > &  channel,
const std::string &  proto_path,
const std::string &  protofiles 
)

Definition at line 69 of file proto_file_parser.cc.

◆ ~ProtoFileParser()

grpc::testing::ProtoFileParser::~ProtoFileParser ( )

Definition at line 136 of file proto_file_parser.cc.

Member Function Documentation

◆ GetFormattedMethodName()

std::string grpc::testing::ProtoFileParser::GetFormattedMethodName ( const std::string &  method)

Definition at line 175 of file proto_file_parser.cc.

◆ GetFormattedStringFromMessageType()

std::string grpc::testing::ProtoFileParser::GetFormattedStringFromMessageType ( const std::string &  message_type_name,
const std::string &  serialized_proto,
bool  is_json_format 
)

Converts a binary proto string to its text or json string representation for the given message type.

Parameters
theserialised binary proto representation of type message_type_name
Returns
the text- or json-formatted proto string of serialized_proto

Definition at line 288 of file proto_file_parser.cc.

◆ GetFormattedStringFromMethod()

std::string grpc::testing::ProtoFileParser::GetFormattedStringFromMethod ( const std::string &  method,
const std::string &  serialized_proto,
bool  is_request,
bool  is_json_format 
)

Converts a binary proto string to its text or json string representation for the given method's input or return type.

Parameters
methodthe name of the method (does not need to be a fully qualified name)
theserialised binary proto representation of type message_type_name
Returns
the text- or json-formatted proto string of serialized_proto

Definition at line 238 of file proto_file_parser.cc.

◆ GetFullMethodName()

std::string grpc::testing::ProtoFileParser::GetFullMethodName ( const std::string &  method)

Definition at line 138 of file proto_file_parser.cc.

◆ GetMessageTypeFromMethod()

std::string grpc::testing::ProtoFileParser::GetMessageTypeFromMethod ( const std::string &  method,
bool  is_request 
)
private

Definition at line 189 of file proto_file_parser.cc.

◆ GetSerializedProtoFromMessageType()

std::string grpc::testing::ProtoFileParser::GetSerializedProtoFromMessageType ( const std::string &  message_type_name,
const std::string &  formatted_proto,
bool  is_json_format 
)

Converts a text or json string to its proto representation for the given message type.

Parameters
formatted_protothe text- or json-formatted proto string
Returns
the serialised binary proto representation of formatted_proto

Definition at line 250 of file proto_file_parser.cc.

◆ GetSerializedProtoFromMethod()

std::string grpc::testing::ProtoFileParser::GetSerializedProtoFromMethod ( const std::string &  method,
const std::string &  formatted_proto,
bool  is_request,
bool  is_json_format 
)

Converts a text or json string to its binary proto representation for the given method's input or return type.

Parameters
methodthe name of the method (does not need to be fully qualified name)
formatted_protothe text- or json-formatted proto string
is_requestif true the resolved type is that of the input parameter of the method, otherwise it is the output type
is_json_formatif true the formatted_proto is treated as a json-formatted proto, otherwise it is treated as a text-formatted proto
Returns
the serialised binary proto representation of formatted_proto

Definition at line 226 of file proto_file_parser.cc.

◆ HasError()

bool grpc::testing::ProtoFileParser::HasError ( ) const
inline

Definition at line 108 of file proto_file_parser.h.

◆ IsStreaming()

bool grpc::testing::ProtoFileParser::IsStreaming ( const std::string &  method,
bool  is_request 
)

Definition at line 207 of file proto_file_parser.cc.

◆ LogError()

void grpc::testing::ProtoFileParser::LogError ( const std::string &  error_msg)

Definition at line 324 of file proto_file_parser.cc.

Member Data Documentation

◆ desc_db_

std::unique_ptr<protobuf::DescriptorDatabase> grpc::testing::ProtoFileParser::desc_db_
private

Definition at line 123 of file proto_file_parser.h.

◆ desc_pool_

std::unique_ptr<protobuf::DescriptorPool> grpc::testing::ProtoFileParser::desc_pool_
private

Definition at line 124 of file proto_file_parser.h.

◆ dynamic_factory_

std::unique_ptr<protobuf::DynamicMessageFactory> grpc::testing::ProtoFileParser::dynamic_factory_
private

Definition at line 125 of file proto_file_parser.h.

◆ error_printer_

std::unique_ptr<ErrorPrinter> grpc::testing::ProtoFileParser::error_printer_
private

Definition at line 119 of file proto_file_parser.h.

◆ file_db_

std::unique_ptr<protobuf::DescriptorPoolDatabase> grpc::testing::ProtoFileParser::file_db_
private

Definition at line 122 of file proto_file_parser.h.

◆ has_error_

bool grpc::testing::ProtoFileParser::has_error_
private

Definition at line 116 of file proto_file_parser.h.

◆ importer_

std::unique_ptr<protobuf::compiler::Importer> grpc::testing::ProtoFileParser::importer_
private

Definition at line 120 of file proto_file_parser.h.

◆ known_methods_

std::unordered_map<std::string, std::string> grpc::testing::ProtoFileParser::known_methods_
private

Definition at line 128 of file proto_file_parser.h.

◆ reflection_db_

std::unique_ptr<grpc::ProtoReflectionDescriptorDatabase> grpc::testing::ProtoFileParser::reflection_db_
private

Definition at line 121 of file proto_file_parser.h.

◆ request_prototype_

std::unique_ptr<grpc::protobuf::Message> grpc::testing::ProtoFileParser::request_prototype_
private

Definition at line 126 of file proto_file_parser.h.

◆ request_text_

std::string grpc::testing::ProtoFileParser::request_text_
private

Definition at line 117 of file proto_file_parser.h.

◆ response_prototype_

std::unique_ptr<grpc::protobuf::Message> grpc::testing::ProtoFileParser::response_prototype_
private

Definition at line 127 of file proto_file_parser.h.

◆ service_desc_list_

std::vector<const protobuf::ServiceDescriptor*> grpc::testing::ProtoFileParser::service_desc_list_
private

Definition at line 129 of file proto_file_parser.h.

◆ source_tree_

protobuf::compiler::DiskSourceTree grpc::testing::ProtoFileParser::source_tree_
private

Definition at line 118 of file proto_file_parser.h.


The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:34