| 78 | } |
| 79 | |
| 80 | int ProtoUtils::LoadNormal(const char *file_name, SyntaxTree *stree, map<string, bool> *parsed_file_map, |
| 81 | DiskSourceTree &tree) { |
| 82 | MyErrorPrinter error; |
| 83 | |
| 84 | Importer importer(&tree, &error); |
| 85 | |
| 86 | const FileDescriptor *fd{importer.Import(file_name)}; |
| 87 | |
| 88 | stree->SetPackageName(fd->package().c_str()); |
| 89 | |
| 90 | stree->SetProtoFile(file_name); |
| 91 | |
| 92 | for (int i{0}; 1 > i && fd->service_count() > i; ++i) { |
| 93 | const ServiceDescriptor * iter = fd->service(i); |
| 94 | stree->SetName(iter->name().c_str()); |
| 95 | |
| 96 | for (int j{0}; iter->method_count() > j; ++j) { |
| 97 | const MethodDescriptor *method{iter->method(j)}; |
| 98 | |
| 99 | SyntaxFunc func; |
| 100 | func.SetName(method->name().c_str()); |
| 101 | |
| 102 | const Descriptor * input_type = method->input_type(); |
| 103 | const Descriptor * output_type = method->output_type(); |
| 104 | |
| 105 | func.GetReq()->SetName("Req"); |
| 106 | func.GetReq()->SetType(input_type->full_name().c_str()); |
| 107 | |
| 108 | func.GetResp()->SetName("Resp"); |
| 109 | func.GetResp()->SetType(output_type->full_name().c_str()); |
| 110 | |
| 111 | stree->GetFuncList()->push_back(func); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | int ProtoUtils::LoadExtension(const char *file_name, SyntaxTree *stree, DiskSourceTree &tree) { |
| 119 | MyErrorPrinter error; |
nothing calls this directly
no test coverage detected