aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-04-19 17:17:05 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-19 17:19:31 -0700
commit2d8da1d12a5fbeaa99e1cdd761b735a02020611b (patch)
treed7dbe8108cb9d204acd444333419e217ee541ff2
parente07c9e23a94866966aa7e336a519b55931d570e3 (diff)
Removed deprecated methods from tensorflow::StringPiece.
This will allow tensorflow::StringPiece to be more easily replaced with absl::string_view as absl::string_view does not contain those methods. PiperOrigin-RevId: 193599651
-rw-r--r--tensorflow/core/lib/core/stringpiece.cc4
-rw-r--r--tensorflow/core/lib/core/stringpiece.h26
-rw-r--r--tensorflow/core/lib/core/stringpiece_test.cc10
3 files changed, 0 insertions, 40 deletions
diff --git a/tensorflow/core/lib/core/stringpiece.cc b/tensorflow/core/lib/core/stringpiece.cc
index 0b006fa2b4..4c488066e4 100644
--- a/tensorflow/core/lib/core/stringpiece.cc
+++ b/tensorflow/core/lib/core/stringpiece.cc
@@ -25,10 +25,6 @@ std::ostream& operator<<(std::ostream& o, StringPiece piece) {
return o;
}
-bool StringPiece::contains(StringPiece s) const {
- return std::search(begin(), end(), s.begin(), s.end()) != end();
-}
-
size_t StringPiece::find(char c, size_t pos) const {
if (pos >= size_) {
return npos;
diff --git a/tensorflow/core/lib/core/stringpiece.h b/tensorflow/core/lib/core/stringpiece.h
index 835b938cbf..0cf6c24850 100644
--- a/tensorflow/core/lib/core/stringpiece.h
+++ b/tensorflow/core/lib/core/stringpiece.h
@@ -88,20 +88,6 @@ class StringPiece {
size_t find(char c, size_t pos = 0) const;
size_t rfind(char c, size_t pos = npos) const;
- // DEPRECATED: Use tensorflow::str_util::StrContains instead.
- bool contains(StringPiece s) const;
-
- // Checks whether StringPiece starts with x and if so advances the beginning
- // of it to past the match. It's basically a shortcut for starts_with
- // followed by remove_prefix.
- // DEPRECATED: Use tensorflow::str_util::ConsumePrefix instead.
- bool Consume(StringPiece x) {
- if (starts_with(x)) {
- remove_prefix(x.size_);
- return true;
- }
- return false;
- }
StringPiece substr(size_t pos, size_t n = npos) const;
@@ -114,18 +100,6 @@ class StringPiece {
// > 0 iff "*this" > "b"
int compare(StringPiece b) const;
- // Return true iff "x" is a prefix of "*this"
- // DEPRECATED: Use tensorflow::str_util::StartsWith instead.
- bool starts_with(StringPiece x) const {
- return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0));
- }
- // Return true iff "x" is a suffix of "*this"
- // DEPRECATED: Use tensorflow::str_util::EndsWith instead.
- bool ends_with(StringPiece x) const {
- return ((size_ >= x.size_) &&
- (memcmp(data_ + (size_ - x.size_), x.data_, x.size_) == 0));
- }
-
private:
const char* data_;
size_t size_;
diff --git a/tensorflow/core/lib/core/stringpiece_test.cc b/tensorflow/core/lib/core/stringpiece_test.cc
index d0dbeb6072..de35d6eac6 100644
--- a/tensorflow/core/lib/core/stringpiece_test.cc
+++ b/tensorflow/core/lib/core/stringpiece_test.cc
@@ -55,14 +55,4 @@ TEST(StringPiece, Ctor) {
}
}
-TEST(StringPiece, Contains) {
- StringPiece a("abcdefg");
- StringPiece b("abcd");
- StringPiece c("efg");
- StringPiece d("gh");
- EXPECT_TRUE(a.contains(b));
- EXPECT_TRUE(a.contains(c));
- EXPECT_TRUE(!a.contains(d));
-}
-
} // namespace tensorflow