| 32 | using google::protobuf::Message; |
| 33 | |
| 34 | bool ReadProtoFromTextFile(const char* filename, Message* proto) { |
| 35 | int fd = open(filename, O_RDONLY); |
| 36 | CHECK_NE(fd, -1) << "File not found: " << filename; |
| 37 | FileInputStream* input = new FileInputStream(fd); |
| 38 | bool success = google::protobuf::TextFormat::Parse(input, proto); |
| 39 | delete input; |
| 40 | close(fd); |
| 41 | return success; |
| 42 | } |
| 43 | |
| 44 | void WriteProtoToTextFile(const Message& proto, const char* filename) { |
| 45 | int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
no outgoing calls
no test coverage detected