murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2015, Google Inc. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
| 34 | #include <map> |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 35 | #include <sstream> |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 36 | |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 37 | #include "src/compiler/config.h" |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 38 | #include "src/compiler/objective_c_generator.h" |
| 39 | #include "src/compiler/objective_c_generator_helpers.h" |
| 40 | |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 41 | #include <google/protobuf/compiler/objectivec/objectivec_helpers.h> |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 42 | |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 43 | using ::google::protobuf::compiler::objectivec::ClassName; |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 44 | using ::grpc::protobuf::io::Printer; |
| 45 | using ::grpc::protobuf::MethodDescriptor; |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 46 | using ::grpc::protobuf::ServiceDescriptor; |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 47 | using ::std::map; |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 48 | |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 49 | namespace grpc_objective_c_generator { |
| 50 | namespace { |
| 51 | |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 52 | void PrintProtoRpcDeclarationAsPragma(Printer *printer, |
| 53 | const MethodDescriptor *method, |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 54 | map< ::grpc::string, ::grpc::string> vars) { |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 55 | vars["client_stream"] = method->client_streaming() ? "stream " : ""; |
| 56 | vars["server_stream"] = method->server_streaming() ? "stream " : ""; |
| 57 | |
| 58 | printer->Print(vars, |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 59 | "#pragma mark $method_name$($client_stream$$request_type$)" |
| 60 | " returns ($server_stream$$response_type$)\n\n"); |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 63 | void PrintMethodSignature(Printer *printer, const MethodDescriptor *method, |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 64 | const map< ::grpc::string, ::grpc::string> &vars) { |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 65 | // TODO(jcanizales): Print method comments. |
| 66 | |
| 67 | printer->Print(vars, "- ($return_type$)$method_name$With"); |
| 68 | if (method->client_streaming()) { |
Jorge Canizales | 739c998 | 2015-07-16 22:07:54 -0700 | [diff] [blame] | 69 | printer->Print("RequestsWriter:(GRXWriter *)requestWriter"); |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 70 | } else { |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 71 | printer->Print(vars, "Request:($request_class$ *)request"); |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 72 | } |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 73 | |
| 74 | // TODO(jcanizales): Put this on a new line and align colons. |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 75 | if (method->server_streaming()) { |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 76 | printer->Print(vars, |
| 77 | " eventHandler:(void(^)(BOOL done, " |
| 78 | "$response_class$ *response, NSError *error))eventHandler"); |
murgatroid99 | 25a2661 | 2015-06-25 11:22:23 -0700 | [diff] [blame] | 79 | } else { |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 80 | printer->Print(vars, |
| 81 | " handler:(void(^)($response_class$ *response, " |
| 82 | "NSError *error))handler"); |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 83 | } |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 84 | } |
| 85 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 86 | void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method, |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 87 | map< ::grpc::string, ::grpc::string> vars) { |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 88 | vars["method_name"] = |
| 89 | grpc_generator::LowercaseFirstLetter(vars["method_name"]); |
| 90 | vars["return_type"] = "void"; |
| 91 | PrintMethodSignature(printer, method, vars); |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 94 | void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method, |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 95 | map< ::grpc::string, ::grpc::string> vars) { |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 96 | vars["method_name"] = "RPCTo" + vars["method_name"]; |
| 97 | vars["return_type"] = "ProtoRPC *"; |
| 98 | PrintMethodSignature(printer, method, vars); |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 101 | inline map< ::grpc::string, ::grpc::string> GetMethodVars(const MethodDescriptor *method) { |
| 102 | map< ::grpc::string, ::grpc::string> res; |
vjpai | c7eed74 | 2015-07-14 10:47:28 -0700 | [diff] [blame] | 103 | res["method_name"] = method->name(); |
| 104 | res["request_type"] = method->input_type()->name(); |
| 105 | res["response_type"] = method->output_type()->name(); |
| 106 | res["request_class"] = ClassName(method->input_type()); |
| 107 | res["response_class"] = ClassName(method->output_type()); |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 108 | return res; |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 109 | } |
| 110 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 111 | void PrintMethodDeclarations(Printer *printer, const MethodDescriptor *method) { |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 112 | map< ::grpc::string, ::grpc::string> vars = GetMethodVars(method); |
murgatroid99 | ac0002a | 2015-04-07 12:49:14 -0700 | [diff] [blame] | 113 | |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 114 | PrintProtoRpcDeclarationAsPragma(printer, method, vars); |
| 115 | |
| 116 | PrintSimpleSignature(printer, method, vars); |
| 117 | printer->Print(";\n\n"); |
| 118 | PrintAdvancedSignature(printer, method, vars); |
| 119 | printer->Print(";\n\n\n"); |
| 120 | } |
| 121 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 122 | void PrintSimpleImplementation(Printer *printer, const MethodDescriptor *method, |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 123 | map< ::grpc::string, ::grpc::string> vars) { |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 124 | printer->Print("{\n"); |
Jorge Canizales | 1900dfc | 2015-05-15 09:44:04 -0700 | [diff] [blame] | 125 | printer->Print(vars, " [[self RPCTo$method_name$With"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 126 | if (method->client_streaming()) { |
murgatroid99 | 25a2661 | 2015-06-25 11:22:23 -0700 | [diff] [blame] | 127 | printer->Print("RequestsWriter:requestWriter"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 128 | } else { |
| 129 | printer->Print("Request:request"); |
| 130 | } |
murgatroid99 | 25a2661 | 2015-06-25 11:22:23 -0700 | [diff] [blame] | 131 | if (method->server_streaming()) { |
| 132 | printer->Print(" eventHandler:eventHandler] start];\n"); |
| 133 | } else { |
| 134 | printer->Print(" handler:handler] start];\n"); |
| 135 | } |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 136 | printer->Print("}\n"); |
| 137 | } |
| 138 | |
| 139 | void PrintAdvancedImplementation(Printer *printer, |
| 140 | const MethodDescriptor *method, |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 141 | map< ::grpc::string, ::grpc::string> vars) { |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 142 | printer->Print("{\n"); |
| 143 | printer->Print(vars, " return [self RPCToMethod:@\"$method_name$\"\n"); |
| 144 | |
| 145 | printer->Print(" requestsWriter:"); |
| 146 | if (method->client_streaming()) { |
murgatroid99 | 25a2661 | 2015-06-25 11:22:23 -0700 | [diff] [blame] | 147 | printer->Print("requestWriter\n"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 148 | } else { |
| 149 | printer->Print("[GRXWriter writerWithValue:request]\n"); |
| 150 | } |
| 151 | |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 152 | printer->Print(vars, " responseClass:[$response_class$ class]\n"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 153 | |
| 154 | printer->Print(" responsesWriteable:[GRXWriteable "); |
| 155 | if (method->server_streaming()) { |
Jorge Canizales | f95ddba | 2015-08-12 10:51:56 -0700 | [diff] [blame] | 156 | printer->Print("writeableWithEventHandler:eventHandler]];\n"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 157 | } else { |
Jorge Canizales | f95ddba | 2015-08-12 10:51:56 -0700 | [diff] [blame] | 158 | printer->Print("writeableWithSingleHandler:handler]];\n"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | printer->Print("}\n"); |
| 162 | } |
| 163 | |
| 164 | void PrintMethodImplementations(Printer *printer, |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 165 | const MethodDescriptor *method) { |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 166 | map< ::grpc::string, ::grpc::string> vars = GetMethodVars(method); |
murgatroid99 | ac0002a | 2015-04-07 12:49:14 -0700 | [diff] [blame] | 167 | |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 168 | PrintProtoRpcDeclarationAsPragma(printer, method, vars); |
| 169 | |
| 170 | // TODO(jcanizales): Print documentation from the method. |
| 171 | PrintSimpleSignature(printer, method, vars); |
| 172 | PrintSimpleImplementation(printer, method, vars); |
| 173 | |
| 174 | printer->Print("// Returns a not-yet-started RPC object.\n"); |
murgatroid99 | ac0002a | 2015-04-07 12:49:14 -0700 | [diff] [blame] | 175 | PrintAdvancedSignature(printer, method, vars); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 176 | PrintAdvancedImplementation(printer, method, vars); |
murgatroid99 | ac0002a | 2015-04-07 12:49:14 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 179 | } // namespace |
murgatroid99 | ac0002a | 2015-04-07 12:49:14 -0700 | [diff] [blame] | 180 | |
Jorge Canizales | b015dfb | 2015-08-13 18:41:29 -0700 | [diff] [blame] | 181 | ::grpc::string GetHeader(const ServiceDescriptor *service) { |
| 182 | ::grpc::string output; |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 183 | { |
| 184 | // Scope the output stream so it closes and finalizes output to the string. |
| 185 | grpc::protobuf::io::StringOutputStream output_stream(&output); |
| 186 | Printer printer(&output_stream, '$'); |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 187 | |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 188 | map< ::grpc::string, ::grpc::string> vars = {{"service_class", ServiceClassName(service)}}; |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 189 | |
| 190 | printer.Print(vars, "@protocol $service_class$ <NSObject>\n\n"); |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 191 | |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 192 | for (int i = 0; i < service->method_count(); i++) { |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 193 | PrintMethodDeclarations(&printer, service->method(i)); |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 194 | } |
| 195 | printer.Print("@end\n\n"); |
| 196 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 197 | printer.Print( |
| 198 | "// Basic service implementation, over gRPC, that only does" |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 199 | " marshalling and parsing.\n"); |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 200 | printer.Print(vars, |
| 201 | "@interface $service_class$ :" |
| 202 | " ProtoService<$service_class$>\n"); |
| 203 | printer.Print( |
| 204 | "- (instancetype)initWithHost:(NSString *)host" |
| 205 | " NS_DESIGNATED_INITIALIZER;\n"); |
Nate Kibler | 6d19724 | 2015-09-25 10:02:20 -0700 | [diff] [blame] | 206 | printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 207 | printer.Print("@end\n"); |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 208 | } |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 209 | return output; |
| 210 | } |
| 211 | |
Jorge Canizales | b015dfb | 2015-08-13 18:41:29 -0700 | [diff] [blame] | 212 | ::grpc::string GetSource(const ServiceDescriptor *service) { |
| 213 | ::grpc::string output; |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 214 | { |
| 215 | // Scope the output stream so it closes and finalizes output to the string. |
| 216 | grpc::protobuf::io::StringOutputStream output_stream(&output); |
| 217 | Printer printer(&output_stream, '$'); |
Jorge Canizales | 9a065d2 | 2015-04-27 00:05:01 -0700 | [diff] [blame] | 218 | |
Jorge Canizales | 637c365 | 2015-08-13 19:04:22 -0700 | [diff] [blame] | 219 | map< ::grpc::string,::grpc::string> vars = {{"service_name", service->name()}, |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 220 | {"service_class", ServiceClassName(service)}, |
| 221 | {"package", service->file()->package()}}; |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 222 | |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 223 | printer.Print(vars, |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 224 | "static NSString *const kPackageName = @\"$package$\";\n"); |
| 225 | printer.Print( |
| 226 | vars, "static NSString *const kServiceName = @\"$service_name$\";\n\n"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 227 | |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 228 | printer.Print(vars, "@implementation $service_class$\n\n"); |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 229 | |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 230 | printer.Print("// Designated initializer\n"); |
| 231 | printer.Print("- (instancetype)initWithHost:(NSString *)host {\n"); |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 232 | printer.Print( |
| 233 | " return (self = [super initWithHost:host" |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 234 | " packageName:kPackageName serviceName:kServiceName]);\n"); |
| 235 | printer.Print("}\n\n"); |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 236 | printer.Print( |
| 237 | "// Override superclass initializer to disallow different" |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 238 | " package and service names.\n"); |
| 239 | printer.Print("- (instancetype)initWithHost:(NSString *)host\n"); |
| 240 | printer.Print(" packageName:(NSString *)packageName\n"); |
| 241 | printer.Print(" serviceName:(NSString *)serviceName {\n"); |
| 242 | printer.Print(" return [self initWithHost:host];\n"); |
Nate Kibler | 6d19724 | 2015-09-25 10:02:20 -0700 | [diff] [blame] | 243 | printer.Print("}\n\n"); |
Nate Kibler | 6d19724 | 2015-09-25 10:02:20 -0700 | [diff] [blame] | 244 | printer.Print("+ (instancetype)serviceWithHost:(NSString *)host {\n"); |
| 245 | printer.Print(" return [[self alloc] initWithHost:host];\n"); |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 246 | printer.Print("}\n\n\n"); |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 247 | |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 248 | for (int i = 0; i < service->method_count(); i++) { |
Jorge Canizales | 52592fc | 2015-05-26 11:53:31 -0700 | [diff] [blame] | 249 | PrintMethodImplementations(&printer, service->method(i)); |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 250 | } |
Jorge Canizales | 472f0b0 | 2015-05-12 22:56:04 -0700 | [diff] [blame] | 251 | |
Jan Tattermusch | 5dcebd9 | 2015-05-27 15:30:59 -0700 | [diff] [blame] | 252 | printer.Print("@end\n"); |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 253 | } |
murgatroid99 | d3efd0a | 2015-04-07 11:40:29 -0700 | [diff] [blame] | 254 | return output; |
| 255 | } |
| 256 | |
Vijay Pai | 181ef45 | 2015-07-14 13:52:48 -0700 | [diff] [blame] | 257 | } // namespace grpc_objective_c_generator |