19 #ifndef ASYLO_UTIL_PROTO_FLAG_H_ 20 #define ASYLO_UTIL_PROTO_FLAG_H_ 24 #include <google/protobuf/text_format.h> 25 #include "absl/strings/str_cat.h" 26 #include "absl/strings/string_view.h" 27 #include "asylo/util/logging.h" 37 bool AbslParseFlag(absl::string_view text, T *flag, std::string *error) {
38 if (!google::protobuf::TextFormat::ParseFromString(
39 std::string(text.data(), text.size()), flag)) {
41 absl::StrCat(
"Failed to parse ", flag->GetDescriptor()->full_name());
49 std::string serialized_flag;
50 CHECK(google::protobuf::TextFormat::PrintToString(flag, &serialized_flag));
51 return serialized_flag;
std::string AbslUnparseFlag(const T &flag)
Definition: proto_flag.h:48
bool AbslParseFlag(absl::string_view text, T *flag, std::string *error)
Definition: proto_flag.h:37