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 15 #include <string> 16 #include <utility> 17 #include <vector> 18 19 namespace grpc_tools { 20 // We declare `protoc_main` here since we want access to it from Cython as an 21 // extern but *without* triggering a dllimport declspec when on Windows. 22 int protoc_main(int argc, char* argv[], char* version); 23 24 struct ProtocError { 25 std::string filename; 26 int line; 27 int column; 28 std::string message; 29 ProtocErrorProtocError30 ProtocError() {} ProtocErrorProtocError31 ProtocError(std::string filename, int line, int column, std::string message) 32 : filename(filename), line(line), column(column), message(message) {} 33 }; 34 35 typedef ProtocError ProtocWarning; 36 37 int protoc_get_protos( 38 char* protobuf_path, const std::vector<std::string>* include_paths, 39 std::vector<std::pair<std::string, std::string>>* files_out, 40 std::vector<ProtocError>* errors, std::vector<ProtocWarning>* warnings); 41 42 int protoc_get_services( 43 char* protobuf_path, char* version, 44 const std::vector<std::string>* include_paths, 45 std::vector<std::pair<std::string, std::string>>* files_out, 46 std::vector<ProtocError>* errors, std::vector<ProtocWarning>* warnings); 47 } // end namespace grpc_tools 48