19 #ifndef GRPC_INTERNAL_COMPILER_CPP_PLUGIN_H
20 #define GRPC_INTERNAL_COMPILER_CPP_PLUGIN_H
37 return FEATURE_PROTO3_OPTIONAL;
44 if (
file->options().cc_generic_services()) {
46 "cpp grpc proto compiler plugin does not work with generic "
47 "services. To generate cpp grpc APIs, please set \""
48 "cc_generic_service = false\".";
59 if (!parameter.empty()) {
60 std::vector<std::string> parameters_list =
62 for (
auto parameter_string = parameters_list.begin();
63 parameter_string != parameters_list.end(); parameter_string++) {
64 std::vector<std::string> param =
66 if (param[0] ==
"services_namespace") {
68 }
else if (param[0] ==
"use_system_headers") {
69 if (param[1] ==
"true") {
71 }
else if (param[1] ==
"false") {
77 }
else if (param[0] ==
"grpc_search_path") {
79 }
else if (param[0] ==
"generate_mock_code") {
80 if (param[1] ==
"true") {
82 }
else if (param[1] !=
"false") {
86 }
else if (param[0] ==
"gmock_search_path") {
88 }
else if (param[0] ==
"additional_header_includes") {
91 }
else if (param[0] ==
"message_header_extension") {
93 }
else if (param[0] ==
"include_import_headers") {
94 if (param[1] ==
"true") {
96 }
else if (param[1] !=
"false") {
114 std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> header_output(
115 context->Open(file_name +
".grpc.pb.h"));
117 header_coded_out.WriteRaw(header_code.data(), header_code.size());
124 std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> source_output(
125 context->Open(file_name +
".grpc.pb.cc"));
127 source_coded_out.WriteRaw(source_code.data(), source_code.size());
137 std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> mock_output(
138 context->Open(file_name +
"_mock.grpc.pb.h"));
140 mock_coded_out.WriteRaw(mock_code.data(), mock_code.size());
150 std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream>
output(
153 coded_out.WriteRaw(
code.data(),
code.size());
157 #endif // GRPC_INTERNAL_COMPILER_CPP_PLUGIN_H