config.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef SRC_COMPILER_CONFIG_H
  19. #define SRC_COMPILER_CONFIG_H
  20. #include <util/generic/string.h>
  21. #include <util/string/cast.h>
  22. #include "src/compiler/config_protobuf.h"
  23. #ifdef GRPC_CUSTOM_STRING
  24. #warning GRPC_CUSTOM_STRING is no longer supported. Please use TString.
  25. #endif
  26. namespace grpc {
  27. // Using grpc::string and grpc::to_string is discouraged in favor of
  28. // TString and ::ToString. This is only for legacy code using
  29. // them explictly.
  30. typedef TString string;
  31. namespace protobuf {
  32. namespace compiler {
  33. typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator;
  34. typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext;
  35. static inline int PluginMain(int argc, char* argv[],
  36. const CodeGenerator* generator) {
  37. return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator);
  38. }
  39. static inline void ParseGeneratorParameter(
  40. const string& parameter, std::vector<std::pair<string, string> >* options) {
  41. GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options);
  42. }
  43. } // namespace compiler
  44. namespace io {
  45. typedef GRPC_CUSTOM_PRINTER Printer;
  46. typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream;
  47. typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
  48. } // namespace io
  49. } // namespace protobuf
  50. } // namespace grpc
  51. namespace grpc_cpp_generator {
  52. static const char* const kCppGeneratorMessageHeaderExt = ".pb.h";
  53. static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h";
  54. } // namespace grpc_cpp_generator
  55. #endif // SRC_COMPILER_CONFIG_H