aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/objective_c_plugin.cc
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2015-04-27 00:05:01 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2015-05-15 09:55:45 -0700
commit9a065d2e2f91df6ff836771a2105d2368a72b3b8 (patch)
tree3675c533cd40cfa90503c0d690e7377770720832 /src/compiler/objective_c_plugin.cc
parent55e04e4e055794d400f8736c1c9a921f581a6589 (diff)
Adjusts generated header to new runtime and surface.
Diffstat (limited to 'src/compiler/objective_c_plugin.cc')
-rw-r--r--src/compiler/objective_c_plugin.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc
index eebce0cd20..ef32dcc056 100644
--- a/src/compiler/objective_c_plugin.cc
+++ b/src/compiler/objective_c_plugin.cc
@@ -54,27 +54,29 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
return true;
}
+ grpc::string file_name = grpc_generator::FileNameInUpperCamel(file);
+ grpc::string prefix = "RMT"; // TODO
+
for (int i = 0; i < file->service_count(); i++) {
const grpc::protobuf::ServiceDescriptor *service = file->service(i);
- grpc::string file_name = grpc_objective_c_generator::StubFileName(
- service->name());
// Generate .pb.h
- grpc::string header_code = grpc_objective_c_generator::GetHeader(
- service, grpc_objective_c_generator::MessageHeaderName(file));
- std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> header_output(
- context->Open(file_name + ".pb.h"));
- grpc::protobuf::io::CodedOutputStream header_coded_out(
- header_output.get());
- header_coded_out.WriteRaw(header_code.data(), header_code.size());
+
+ Insert(context, file_name + ".pb.h", "imports",
+ "#import <gRPC/ProtoService.h>\n");
+
+ Insert(context, file_name + ".pb.h", "global_scope",
+ grpc_objective_c_generator::GetHeader(service, prefix));
// Generate .pb.m
- grpc::string source_code = grpc_objective_c_generator::GetSource(service);
- std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> source_output(
- context->Open(file_name + ".pb.m"));
- grpc::protobuf::io::CodedOutputStream source_coded_out(
- source_output.get());
- source_coded_out.WriteRaw(source_code.data(), source_code.size());
+
+ Insert(context, file_name + ".pb.m", "imports",
+ "#import <gRPC/GRXWriteable.h>\n"
+ "#import <gRPC/GRXWriter+Immediate.h>\n"
+ "#import <gRPC/ProtoRPC.h>\n");
+
+ Insert(context, file_name + ".pb.m", "global_scope",
+ grpc_objective_c_generator::GetSource(service, prefix));
}
return true;