Index: net/der/input.cc |
diff --git a/net/der/input.cc b/net/der/input.cc |
index 5065ccaca93e9bdc3ffc06b5af2eaa332d57f1ae..871f9f4ec7dc29a52d645f9c2194c2795d559394 100644 |
--- a/net/der/input.cc |
+++ b/net/der/input.cc |
@@ -19,6 +19,11 @@ Input::Input() : data_(nullptr), len_(0) { |
Input::Input(const uint8_t* data, size_t len) : data_(data), len_(len) { |
} |
+Input::Input(const base::StringPiece& in) |
+ : data_(reinterpret_cast<const uint8_t*>(in.data())), len_(in.length()) {} |
+ |
+Input::Input(const std::string* s) : Input(base::StringPiece(*s)) {} |
+ |
bool Input::Equals(const Input& other) const { |
if (len_ != other.len_) |
return false; |
@@ -29,6 +34,10 @@ std::string Input::AsString() const { |
return std::string(reinterpret_cast<const char*>(data_), len_); |
} |
+base::StringPiece Input::AsStringPiece() const { |
+ return base::StringPiece(reinterpret_cast<const char*>(data_), len_); |
+} |
+ |
bool operator<(const Input& lhs, const Input& rhs) { |
return std::lexicographical_compare( |
lhs.UnsafeData(), lhs.UnsafeData() + lhs.Length(), rhs.UnsafeData(), |