aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/util/proto_file_parser.h
diff options
context:
space:
mode:
authorGravatar Feso <gabor.fecher@gmail.com>2018-10-13 19:17:26 +0100
committerGravatar Feso <gabor.fecher@gmail.com>2018-10-13 19:17:26 +0100
commit29c131f79036fc73a9bd909754d1b35aac7c59ac (patch)
tree465339d705496b85c4767ed8e482cfa8d45b8fe1 /test/cpp/util/proto_file_parser.h
parentd74162f83acae2121cb2e47d562c0b963e20aac5 (diff)
Refactored based on code review
Diffstat (limited to 'test/cpp/util/proto_file_parser.h')
-rw-r--r--test/cpp/util/proto_file_parser.h64
1 files changed, 36 insertions, 28 deletions
diff --git a/test/cpp/util/proto_file_parser.h b/test/cpp/util/proto_file_parser.h
index d2b2bd753e..0758d2f9f3 100644
--- a/test/cpp/util/proto_file_parser.h
+++ b/test/cpp/util/proto_file_parser.h
@@ -53,37 +53,45 @@ class ProtoFileParser {
// used as the argument of Stub::Call()
grpc::string GetFormattedMethodName(const grpc::string& method);
- grpc::string GetSerializedProtoFromMethodTextFormat(
- const grpc::string& method, const grpc::string& text_format_proto,
- bool is_request);
-
- grpc::string GetSerializedProtoFromMethodJsonFormat(
- const grpc::string& method, const grpc::string& json_format_proto,
- bool is_request);
-
- grpc::string GetTextFormatFromMethod(const grpc::string& method,
- const grpc::string& serialized_proto,
- bool is_request);
-
- grpc::string GetJsonFormatFromMethod(const grpc::string& method,
- const grpc::string& serialized_proto,
- bool is_request);
-
- grpc::string GetSerializedProtoFromMessageTypeTextFormat(
+ /// Converts a text or json string to its binary proto representation for the
+ /// given method's input or return type.
+ /// \param method the name of the method (does not need to be fully qualified name)
+ /// \param formatted_proto the text- or json-formatted proto string
+ /// \param is_request if \c true the resolved type is that of the input parameter of
+ /// the method, otherwise it is the output type
+ /// \param is_json_format if \c true the \c formatted_proto is treated as a
+ /// json-formatted proto, otherwise it is treated as a text-formatted proto
+ /// \return the serialised binary proto represenation of \c formatted_proto
+ grpc::string GetSerializedProtoFromMethod(
+ const grpc::string& method, const grpc::string& formatted_proto,
+ bool is_request, bool is_json_format);
+
+ /// Converts a text or json string to its proto representation for the given
+ /// message type.
+ /// \param formatted_proto the text- or json-formatted proto string
+ /// \return the serialised binary proto represenation of \c formatted_proto
+ grpc::string GetSerializedProtoFromMessageType(
const grpc::string& message_type_name,
- const grpc::string& text_format_proto);
-
- grpc::string GetSerializedProtoFromMessageTypeJsonFormat(
- const grpc::string& message_type_name,
- const grpc::string& json_format_proto);
-
- grpc::string GetTextFormatFromMessageType(
- const grpc::string& message_type_name,
- const grpc::string& serialized_proto);
+ const grpc::string& formatted_proto,
+ 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.
+ /// \param method the name of the method (does not need to be a fully qualified name)
+ /// \param the serialised binary proto representation of type \c message_type_name
+ /// \return the text- or json-formatted proto string of \c serialized_proto
+ grpc::string GetFormattedStringFromMethod(const grpc::string& method,
+ const grpc::string& serialized_proto,
+ bool is_request, bool is_json_format);
- grpc::string GetJsonFormatFromMessageType(
+ /// Converts a binary proto string to its text or json string representation
+ /// for the given message type.
+ /// \param the serialised binary proto representation of type \c message_type_name
+ /// \return the text- or json-formatted proto string of \c serialized_proto
+ grpc::string GetFormattedStringFromMessageType(
const grpc::string& message_type_name,
- const grpc::string& serialized_proto);
+ const grpc::string& serialized_proto,
+ bool is_json_format);
bool IsStreaming(const grpc::string& method, bool is_request);