main.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2016 gRPC authors.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include <string>
  15. #include <utility>
  16. #include <vector>
  17. namespace grpc_tools {
  18. // We declare `protoc_main` here since we want access to it from Cython as an
  19. // extern but *without* triggering a dllimport declspec when on Windows.
  20. int protoc_main(int argc, char* argv[]);
  21. struct ProtocError {
  22. std::string filename;
  23. int line;
  24. int column;
  25. std::string message;
  26. ProtocError() {}
  27. ProtocError(std::string filename, int line, int column, std::string message)
  28. : filename(filename), line(line), column(column), message(message) {}
  29. };
  30. typedef ProtocError ProtocWarning;
  31. int protoc_get_protos(
  32. char* protobuf_path, const std::vector<std::string>* include_paths,
  33. std::vector<std::pair<std::string, std::string>>* files_out,
  34. std::vector<ProtocError>* errors, std::vector<ProtocWarning>* warnings);
  35. int protoc_get_services(
  36. char* protobuf_path, const std::vector<std::string>* include_paths,
  37. std::vector<std::pair<std::string, std::string>>* files_out,
  38. std::vector<ProtocError>* errors, std::vector<ProtocWarning>* warnings);
  39. } // end namespace grpc_tools