| 32 | } |
| 33 | |
| 34 | void ProtobufDescriptor::genProtoFile(const std::string &OutDir) const { |
| 35 | google::protobuf::DescriptorPool DescriptorPool; |
| 36 | auto *FD = DescriptorPool.BuildFile(ProtoFile); |
| 37 | if (!FD) { |
| 38 | assert(false && "Failed to generate proto file"); |
| 39 | } |
| 40 | std::ofstream OFS((fs::path(OutDir) / ProtoFile.name()).string()); |
| 41 | OFS << FD->DebugString(); |
| 42 | OFS.close(); |
| 43 | } |
| 44 | |
| 45 | std::string ProtobufDescriptor::getHeaderName() const { return Name + ".pb.h"; } |
| 46 |