From 126c8cf90f2978f4a60ede8e2bd0018a5a9b0aa5 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 5 Nov 2018 17:40:27 +0100 Subject: Contrib/Protobuf generator: Updated to new proto format --- contrib/protoc-bnet/BnetServiceGenerator.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'contrib/protoc-bnet/BnetServiceGenerator.cpp') diff --git a/contrib/protoc-bnet/BnetServiceGenerator.cpp b/contrib/protoc-bnet/BnetServiceGenerator.cpp index 4dadfda1e78..41088fbf5c2 100644 --- a/contrib/protoc-bnet/BnetServiceGenerator.cpp +++ b/contrib/protoc-bnet/BnetServiceGenerator.cpp @@ -20,7 +20,8 @@ BnetServiceGenerator::BnetServiceGenerator(pb::ServiceDescriptor const* descript else vars_["dllexport"] = options.dllexport_decl + " "; - vars_["original_hash"] = " typedef std::integral_constantoptions().GetExtension(Battlenet::original_fully_qualified_descriptor_name)))) + "u> OriginalHash;\n"; + if (descriptor_->options().HasExtension(Battlenet::service_options)) + vars_["original_hash"] = " typedef std::integral_constantoptions().GetExtension(Battlenet::service_options).descriptor_name()))) + "u> OriginalHash;\n"; vars_["name_hash"] = " typedef std::integral_constantfull_name()))) + "u> NameHash;\n"; } @@ -85,13 +86,13 @@ void BnetServiceGenerator::GenerateClientMethodSignatures(pb::io::Printer* print for (int i = 0; i < descriptor_->method_count(); i++) { pb::MethodDescriptor const* method = descriptor_->method(i); - if (!method->options().HasExtension(Battlenet::method_id)) + if (!method->options().HasExtension(Battlenet::method_options)) continue; std::map sub_vars; sub_vars["name"] = method->name(); sub_vars["full_name"] = descriptor_->name() + "." + method->name(); - sub_vars["method_id"] = pb::SimpleItoa(method->options().GetExtension(Battlenet::method_id)); + sub_vars["method_id"] = pb::SimpleItoa(method->options().GetExtension(Battlenet::method_options).id()); sub_vars["input_type"] = pbcpp::ClassName(method->input_type(), true); sub_vars["output_type"] = pbcpp::ClassName(method->output_type(), true); sub_vars["input_type_name"] = method->input_type()->full_name(); @@ -108,7 +109,7 @@ void BnetServiceGenerator::GenerateServerMethodSignatures(pb::io::Printer* print for (int i = 0; i < descriptor_->method_count(); i++) { pb::MethodDescriptor const* method = descriptor_->method(i); - if (!method->options().HasExtension(Battlenet::method_id)) + if (!method->options().HasExtension(Battlenet::method_options)) continue; std::map sub_vars; @@ -161,14 +162,14 @@ void BnetServiceGenerator::GenerateClientMethodImplementations(pb::io::Printer* for (int i = 0; i < descriptor_->method_count(); i++) { pb::MethodDescriptor const* method = descriptor_->method(i); - if (!method->options().HasExtension(Battlenet::method_id)) + if (!method->options().HasExtension(Battlenet::method_options)) continue; std::map sub_vars; sub_vars["classname"] = vars_["classname"]; sub_vars["name"] = method->name(); sub_vars["full_name"] = descriptor_->name() + "." + method->name(); - sub_vars["method_id"] = pb::SimpleItoa(method->options().GetExtension(Battlenet::method_id)); + sub_vars["method_id"] = pb::SimpleItoa(method->options().GetExtension(Battlenet::method_options).id()); sub_vars["input_type"] = pbcpp::ClassName(method->input_type(), true); sub_vars["output_type"] = pbcpp::ClassName(method->output_type(), true); sub_vars["input_type_name"] = method->input_type()->full_name(); @@ -210,14 +211,14 @@ void BnetServiceGenerator::GenerateServerCallMethod(pb::io::Printer* printer) for (int i = 0; i < descriptor_->method_count(); i++) { pb::MethodDescriptor const* method = descriptor_->method(i); - if (!method->options().HasExtension(Battlenet::method_id)) + if (!method->options().HasExtension(Battlenet::method_options)) continue; std::map sub_vars; sub_vars["classname"] = vars_["classname"]; sub_vars["name"] = method->name(); sub_vars["full_name"] = descriptor_->name() + "." + method->name(); - sub_vars["method_id"] = pb::SimpleItoa(method->options().GetExtension(Battlenet::method_id)); + sub_vars["method_id"] = pb::SimpleItoa(method->options().GetExtension(Battlenet::method_options).id()); sub_vars["input_type"] = pbcpp::ClassName(method->input_type(), true); sub_vars["output_type"] = pbcpp::ClassName(method->output_type(), true); sub_vars["input_type_name"] = method->input_type()->full_name(); @@ -285,7 +286,7 @@ void BnetServiceGenerator::GenerateServerImplementations(pb::io::Printer* printe for (int i = 0; i < descriptor_->method_count(); i++) { pb::MethodDescriptor const* method = descriptor_->method(i); - if (!method->options().HasExtension(Battlenet::method_id)) + if (!method->options().HasExtension(Battlenet::method_options)) continue; std::map sub_vars; -- cgit v1.2.3