OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // http://code.google.com/p/protobuf/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 sub_vars["type"] = ClassName(type, true); | 294 sub_vars["type"] = ClassName(type, true); |
295 | 295 |
296 printer->Print(sub_vars, | 296 printer->Print(sub_vars, |
297 " case $index$:\n" | 297 " case $index$:\n" |
298 " return $type$::default_instance();\n"); | 298 " return $type$::default_instance();\n"); |
299 } | 299 } |
300 | 300 |
301 printer->Print(vars_, | 301 printer->Print(vars_, |
302 " default:\n" | 302 " default:\n" |
303 " GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";
\n" | 303 " GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";
\n" |
304 " return *reinterpret_cast< ::google::protobuf::Message*>(NULL);\n" | 304 " return *static_cast< ::google::protobuf::Message*>(NULL);\n" |
305 " }\n" | 305 " }\n" |
306 "}\n" | 306 "}\n" |
307 "\n"); | 307 "\n"); |
308 } | 308 } |
309 | 309 |
310 void ServiceGenerator::GenerateStubMethods(io::Printer* printer) { | 310 void ServiceGenerator::GenerateStubMethods(io::Printer* printer) { |
311 for (int i = 0; i < descriptor_->method_count(); i++) { | 311 for (int i = 0; i < descriptor_->method_count(); i++) { |
312 const MethodDescriptor* method = descriptor_->method(i); | 312 const MethodDescriptor* method = descriptor_->method(i); |
313 map<string, string> sub_vars; | 313 map<string, string> sub_vars; |
314 sub_vars["classname"] = descriptor_->name(); | 314 sub_vars["classname"] = descriptor_->name(); |
(...skipping 10 matching lines...) Expand all Loading... |
325 " channel_->CallMethod(descriptor()->method($index$),\n" | 325 " channel_->CallMethod(descriptor()->method($index$),\n" |
326 " controller, request, response, done);\n" | 326 " controller, request, response, done);\n" |
327 "}\n"); | 327 "}\n"); |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 } // namespace cpp | 331 } // namespace cpp |
332 } // namespace compiler | 332 } // namespace compiler |
333 } // namespace protobuf | 333 } // namespace protobuf |
334 } // namespace google | 334 } // namespace google |
OLD | NEW |