| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright 2015 gRPC authors. |
| 4 |
* |
| 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 |
| 8 |
* |
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
* |
| 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. |
| 16 |
* |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef SRC_COMPILER_CONFIG_H |
| 20 |
#define SRC_COMPILER_CONFIG_H |
| 21 |
|
| 22 |
#include <string> |
| 23 |
|
| 24 |
#include "src/compiler/config_protobuf.h" |
| 25 |
|
| 26 |
#ifdef GRPC_CUSTOM_STRING |
| 27 |
#warning GRPC_CUSTOM_STRING is no longer supported. Please use std::string. |
| 28 |
#endif |
| 29 |
|
| 30 |
namespace grpc { |
| 31 |
|
| 32 |
// Using grpc::string and grpc::to_string is discouraged in favor of |
| 33 |
// std::string and std::to_string. This is only for legacy code using |
| 34 |
// them explictly. |
| 35 |
using std::string; // deprecated |
| 36 |
using std::to_string; // deprecated |
| 37 |
|
| 38 |
namespace protobuf { |
| 39 |
|
| 40 |
namespace compiler { |
| 41 |
typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator; |
| 42 |
typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext; |
| 43 |
static inline int PluginMain(int argc, char* argv[], |
| 44 |
const CodeGenerator* generator) { |
| 45 |
return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator); |
| 46 |
} |
| 47 |
static inline void ParseGeneratorParameter( |
| 48 |
const string& parameter, std::vector<std::pair<string, string> >* options) { |
| 49 |
GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options); |
| 50 |
} |
| 51 |
|
| 52 |
} // namespace compiler |
| 53 |
namespace io { |
| 54 |
typedef GRPC_CUSTOM_PRINTER Printer; |
| 55 |
typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream; |
| 56 |
typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream; |
| 57 |
} // namespace io |
| 58 |
} // namespace protobuf |
| 59 |
} // namespace grpc |
| 60 |
|
| 61 |
namespace grpc_cpp_generator { |
| 62 |
|
| 63 |
static const char* const kCppGeneratorMessageHeaderExt = ".pb.h"; |
| 64 |
static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h"; |
| 65 |
|
| 66 |
} // namespace grpc_cpp_generator |
| 67 |
|
| 68 |
#endif // SRC_COMPILER_CONFIG_H |