Lines Matching +full:out +full:- +full:file
6 * you may not use this file except in compliance with the License.
9 * http://www.apache.org/licenses/LICENSE-2.0
25 #include "src/compiler/ruby_generator_helpers-inl.h"
26 #include "src/compiler/ruby_generator_map-inl.h"
27 #include "src/compiler/ruby_generator_string-inl.h"
40 // Prints out the method using the ruby gRPC DSL.
42 Printer* out) { in PrintMethod() argument
44 RubyTypeOf(method->input_type()->full_name(), package); in PrintMethod()
45 if (method->client_streaming()) { in PrintMethod()
49 RubyTypeOf(method->output_type()->full_name(), package); in PrintMethod()
50 if (method->server_streaming()) { in PrintMethod()
55 method->name(), in PrintMethod()
61 out->Print(GetRubyComments(method, true).c_str()); in PrintMethod()
62 out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n"); in PrintMethod()
63 out->Print(GetRubyComments(method, false).c_str()); in PrintMethod()
66 // Prints out the service using the ruby gRPC DSL.
68 Printer* out) { in PrintService() argument
69 if (service->method_count() == 0) { in PrintService()
76 Modularize(service->name()), in PrintService()
78 out->Print(module_vars, "module $module.name$\n"); in PrintService()
79 out->Indent(); in PrintService()
81 out->Print(GetRubyComments(service, true).c_str()); in PrintService()
82 out->Print("class Service\n"); in PrintService()
85 out->Indent(); in PrintService()
86 out->Print("\n"); in PrintService()
87 out->Print("include GRPC::GenericService\n"); in PrintService()
88 out->Print("\n"); in PrintService()
89 out->Print("self.marshal_class_method = :encode\n"); in PrintService()
90 out->Print("self.unmarshal_class_method = :decode\n"); in PrintService()
92 ListToDict({"service_full_name", service->full_name()}); in PrintService()
93 out->Print(pkg_vars, "self.service_name = '$service_full_name$'\n"); in PrintService()
94 out->Print("\n"); in PrintService()
95 for (int i = 0; i < service->method_count(); ++i) { in PrintService()
96 PrintMethod(service->method(i), package, out); in PrintService()
98 out->Outdent(); in PrintService()
100 out->Print("end\n"); in PrintService()
101 out->Print("\n"); in PrintService()
102 out->Print("Stub = Service.rpc_stub_class\n"); in PrintService()
105 out->Outdent(); in PrintService()
106 out->Print("end\n"); in PrintService()
107 out->Print(GetRubyComments(service, false).c_str()); in PrintService()
121 char ToUpper(char ch) { return IsLower(ch) ? (ch - 'a' + 'A') : ch; } in ToUpper()
126 // foo_bar_baz -> FooBarBaz
149 grpc::string GetServices(const FileDescriptor* file) { in GetServices() argument
155 Printer out(&output_stream, '$'); in GetServices() local
157 // Don't write out any output if there no services, to avoid empty service in GetServices()
159 if (file->service_count() == 0) { in GetServices()
165 if (file->options().has_ruby_package()) { in GetServices()
166 package_name = file->options().ruby_package(); in GetServices()
168 package_name = file->package(); in GetServices()
171 // Write out a file header. in GetServices()
173 "file.name", in GetServices()
174 file->name(), in GetServices()
175 "file.package", in GetServices()
178 out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n"); in GetServices()
179 out.Print(header_comment_vars, in GetServices()
180 "# Source: $file.name$ for package '$file.package$'\n"); in GetServices()
182 grpc::string leading_comments = GetRubyComments(file, true); in GetServices()
184 out.Print("# Original file comments:\n"); in GetServices()
185 out.PrintRaw(leading_comments.c_str()); in GetServices()
188 out.Print("\n"); in GetServices()
189 out.Print("require 'grpc'\n"); in GetServices()
190 // Write out require statemment to import the separately generated file in GetServices()
195 MessagesRequireName(file), in GetServices()
197 out.Print(dep_vars, "require '$dep.name$'\n"); in GetServices()
199 // Write out services within the modules in GetServices()
200 out.Print("\n"); in GetServices()
207 out.Print(module_vars, "module $module.name$\n"); in GetServices()
208 out.Indent(); in GetServices()
210 for (int i = 0; i < file->service_count(); ++i) { in GetServices()
211 auto service = file->service(i); in GetServices()
212 PrintService(service, file->package(), &out); in GetServices()
215 out.Outdent(); in GetServices()
216 out.Print("end\n"); in GetServices()
219 out.Print(GetRubyComments(file, false).c_str()); in GetServices()