3 * Copyright 2015 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef SRC_COMPILER_CONFIG_H
20 #define SRC_COMPILER_CONFIG_H
22 #include <grpcpp/impl/codegen/config_protobuf.h>
24 #ifndef GRPC_CUSTOM_CODEGENERATOR
25 #include <google/protobuf/compiler/code_generator.h>
26 #define GRPC_CUSTOM_CODEGENERATOR ::google::protobuf::compiler::CodeGenerator
27 #define GRPC_CUSTOM_GENERATORCONTEXT \
28 ::google::protobuf::compiler::GeneratorContext
31 #ifndef GRPC_CUSTOM_PRINTER
32 #include <google/protobuf/io/coded_stream.h>
33 #include <google/protobuf/io/printer.h>
34 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
35 #define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer
36 #define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream
37 #define GRPC_CUSTOM_STRINGOUTPUTSTREAM \
38 ::google::protobuf::io::StringOutputStream
41 #ifndef GRPC_CUSTOM_PLUGINMAIN
42 #include <google/protobuf/compiler/plugin.h>
43 #define GRPC_CUSTOM_PLUGINMAIN ::google::protobuf::compiler::PluginMain
46 #ifndef GRPC_CUSTOM_PARSEGENERATORPARAMETER
47 #include <google/protobuf/compiler/code_generator.h>
48 #define GRPC_CUSTOM_PARSEGENERATORPARAMETER \
49 ::google::protobuf::compiler::ParseGeneratorParameter
52 #ifndef GRPC_CUSTOM_STRING
54 #define GRPC_CUSTOM_STRING std::string
59 typedef GRPC_CUSTOM_STRING string;
64 typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator;
65 typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext;
66 static inline int PluginMain(int argc, char* argv[],
67 const CodeGenerator* generator) {
68 return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator);
70 static inline void ParseGeneratorParameter(
71 const string& parameter, std::vector<std::pair<string, string> >* options) {
72 GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options);
75 } // namespace compiler
77 typedef GRPC_CUSTOM_PRINTER Printer;
78 typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream;
79 typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
81 } // namespace protobuf
84 namespace grpc_cpp_generator {
86 static const char* const kCppGeneratorMessageHeaderExt = ".pb.h";
87 static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h";
89 } // namespace grpc_cpp_generator
91 #endif // SRC_COMPILER_CONFIG_H