| 42 | |
| 43 | template <typename T> |
| 44 | static inline Result loadSpecification(T& formatObj, |
| 45 | std::istream& in) { |
| 46 | |
| 47 | google::protobuf::io::IstreamInputStream rawInput(&in); |
| 48 | google::protobuf::io::CodedInputStream codedInput(&rawInput); |
| 49 | |
| 50 | // Support models up to 2GB |
| 51 | codedInput.SetTotalBytesLimit(std::numeric_limits<int>::max()); |
| 52 | |
| 53 | if (!formatObj.ParseFromCodedStream(&codedInput)) { |
| 54 | return Result(ResultType::FAILED_TO_DESERIALIZE, |
| 55 | "unable to deserialize object"); |
| 56 | } |
| 57 | |
| 58 | return Result(); |
| 59 | } |
| 60 | |
| 61 | static inline Result loadSpecificationPath(Specification::Model& formatObj, |
| 62 | const std::string& path) { |
no test coverage detected