From d006304f6a1ab312eea2c4170ce34a6b89fcab01 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Wed, 18 Oct 2023 09:00:05 -0700 Subject: [PATCH] Migrate ParseTagAndName to use absl::string_view PiperOrigin-RevId: 574492000 --- mediapipe/framework/tool/validate_name.cc | 2 +- mediapipe/framework/tool/validate_name.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mediapipe/framework/tool/validate_name.cc b/mediapipe/framework/tool/validate_name.cc index ad66b43d8..8f9be7687 100644 --- a/mediapipe/framework/tool/validate_name.cc +++ b/mediapipe/framework/tool/validate_name.cc @@ -127,7 +127,7 @@ absl::Status ValidateTag(const std::string& tag) { "\" does not match \"" MEDIAPIPE_TAG_REGEX "\".")); } -absl::Status ParseTagAndName(const std::string& tag_and_name, std::string* tag, +absl::Status ParseTagAndName(absl::string_view tag_and_name, std::string* tag, std::string* name) { // An optional tag and colon, followed by a name. RET_CHECK(tag); diff --git a/mediapipe/framework/tool/validate_name.h b/mediapipe/framework/tool/validate_name.h index 274d06721..8646203c0 100644 --- a/mediapipe/framework/tool/validate_name.h +++ b/mediapipe/framework/tool/validate_name.h @@ -22,6 +22,7 @@ #include #include "absl/base/macros.h" +#include "absl/strings/string_view.h" #include "mediapipe/framework/port/proto_ns.h" #include "mediapipe/framework/port/status.h" @@ -85,7 +86,7 @@ absl::Status ValidateTag(const std::string& tag); // The format is an optional tag and colon, followed by a name. // Example 1: "VIDEO:frames2" -> tag: "VIDEO", name: "frames2" // Example 2: "video_frames_1" -> tag: "", name: "video_frames_1" -absl::Status ParseTagAndName(const std::string& tag_and_name, std::string* tag, +absl::Status ParseTagAndName(absl::string_view tag_and_name, std::string* tag, std::string* name); // Parse a generic TAG:index:name string. The format is a tag, then an