aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/objective_c_generator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/objective_c_generator.cc')
-rw-r--r--src/compiler/objective_c_generator.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc
index c05d15375b..33b5fedd5c 100644
--- a/src/compiler/objective_c_generator.cc
+++ b/src/compiler/objective_c_generator.cc
@@ -17,6 +17,7 @@
*/
#include <map>
+#include <set>
#include <sstream>
#include "src/compiler/config.h"
@@ -29,7 +30,9 @@ using ::google::protobuf::compiler::objectivec::ClassName;
using ::grpc::protobuf::io::Printer;
using ::grpc::protobuf::MethodDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
+using ::grpc::protobuf::FileDescriptor;
using ::std::map;
+using ::std::set;
namespace grpc_objective_c_generator {
namespace {
@@ -190,6 +193,24 @@ void PrintMethodImplementations(Printer *printer,
} // namespace
+::grpc::string GetAllMessageClasses(const FileDescriptor *file) {
+ ::grpc::string output;
+ set< ::grpc::string> classes;
+ for (int i = 0; i < file->service_count(); i++) {
+ const auto service = file->service(i);
+ for (int i = 0; i < service->method_count(); i++) {
+ const auto method = service->method(i);
+ classes.insert(ClassName(method->input_type()));
+ classes.insert(ClassName(method->output_type()));
+ }
+ }
+ for (auto one_class : classes) {
+ output += " @class " + one_class + ";\n";
+ }
+
+ return output;
+}
+
::grpc::string GetHeader(const ServiceDescriptor *service) {
::grpc::string output;
{