aboutsummaryrefslogtreecommitdiff
path: root/cc/primitive_set.h
diff options
context:
space:
mode:
authorBartosz Przydatek <przydatek@google.com>2017-05-09 12:10:16 +0200
committerThai Duong <thaidn@google.com>2017-05-10 16:49:08 -0700
commite6e608ec51cccaf175ec6669a80a732a93bc493c (patch)
treeda2f6a5ab49a9596105fed851a836eae366e8770 /cc/primitive_set.h
parent77bc62fa9d80cfd2743408e2c2e72a955fdef9ee (diff)
downloadtink-e6e608ec51cccaf175ec6669a80a732a93bc493c.tar.gz
Changing 'const string&' arguments to StringPiece
Change-Id: I0a56f34273c6d4d1db45f70a77c44521a2b96e42 ORIGINAL_AUTHOR=Bartosz Przydatek <przydatek@google.com> GitOrigin-RevId: 4ad25f03e09cde7eb7ab72799483f94a06425e08
Diffstat (limited to 'cc/primitive_set.h')
-rw-r--r--cc/primitive_set.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/cc/primitive_set.h b/cc/primitive_set.h
index 06b8c22da..b7b6e0359 100644
--- a/cc/primitive_set.h
+++ b/cc/primitive_set.h
@@ -23,6 +23,7 @@
#include "cc/crypto_format.h"
#include "cc/util/errors.h"
#include "cc/util/statusor.h"
+#include "google/protobuf/stubs/stringpiece.h"
#include "proto/tink.pb.h"
namespace cloud {
@@ -55,10 +56,11 @@ class PrimitiveSet {
template <class P2>
class Entry {
public:
- Entry(std::unique_ptr<P2> primitive, std::string identifier,
+ Entry(std::unique_ptr<P2> primitive,
+ google::protobuf::StringPiece identifier,
google::cloud::crypto::tink::KeyStatusType status) :
primitive_(std::move(primitive)),
- identifier_(identifier),
+ identifier_(identifier.ToString()),
status_(status) {
}
P2& get_primitive() const {
@@ -92,13 +94,13 @@ class PrimitiveSet {
// Returns the entries with primitives identifed by 'identifier'.
util::StatusOr<Primitives*> get_primitives(
- const std::string& identifier) {
+ google::protobuf::StringPiece identifier) {
typename CiphertextPrefixToPrimitivesMap::iterator found =
- primitives_.find(identifier);
+ primitives_.find(identifier.ToString());
if (found == primitives_.end()) {
return ToStatusF(util::error::NOT_FOUND,
"No primitives found for identifier '%s'.",
- identifier.c_str());
+ identifier.ToString().c_str());
}
return &(found->second);
}