diff --git a/ortools/port/proto_utils.h b/ortools/port/proto_utils.h index 369b97f1a6..669dbf3204 100644 --- a/ortools/port/proto_utils.h +++ b/ortools/port/proto_utils.h @@ -18,8 +18,10 @@ #ifndef __PORTABLE_PLATFORM__ #include "google/protobuf/generated_enum_reflection.h" +#include "google/protobuf/text_format.h" #endif +#include "ortools/base/port.h" #include "ortools/base/join.h" namespace operations_research { @@ -39,7 +41,15 @@ std::string ProtoEnumToString(ProtoEnumType enum_value) { return absl::StrCat(enum_value); } +template +bool ProtobufTextFormatMergeFromString(const std::string& proto_text_string + ATTRIBUTE_UNUSED, + ProtoType* proto ATTRIBUTE_UNUSED) { + return false; +} + #else // __PORTABLE_PLATFORM__ + template std::string ProtobufDebugString(const P& message) { return message.DebugString(); @@ -62,6 +72,12 @@ std::string ProtoEnumToString(ProtoEnumType enum_value) { return enum_value_descriptor->name(); } +template +bool ProtobufTextFormatMergeFromString(const std::string& proto_text_string, + ProtoType* proto) { + return google::protobuf::TextFormat::MergeFromString(proto_text_string, proto); +} + #endif // !__PORTABLE_PLATFORM__ } // namespace operations_research