aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/StringView.h
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/Source/Local/StringView.h')
-rw-r--r--Firestore/Source/Local/StringView.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/Firestore/Source/Local/StringView.h b/Firestore/Source/Local/StringView.h
index 4e36cff..85afcaa 100644
--- a/Firestore/Source/Local/StringView.h
+++ b/Firestore/Source/Local/StringView.h
@@ -19,9 +19,10 @@
#import <Foundation/Foundation.h>
-#include <leveldb/slice.h>
#include <string>
+
#include "absl/strings/string_view.h"
+#include "leveldb/slice.h"
namespace Firestore {
@@ -43,7 +44,7 @@ class StringView {
// Creates a StringView from an NSString. When StringView is an argument type
// into which an NSString* is passed, the caller should ensure that the
// NSString is retained.
- StringView(NSString *str)
+ StringView(NSString *str) // NOLINT(runtime/explicit)
: data_([str UTF8String]), size_([str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]) {
}
@@ -54,20 +55,24 @@ class StringView {
// Creates a StringView from the given char* pointer but computes the size
// with strlen. This is really only suitable for passing C string literals.
- StringView(const char *data) : data_(data), size_(strlen(data)) {
+ StringView(const char *data) // NOLINT(runtime/explicit)
+ : data_(data), size_(strlen(data)) {
}
// Creates a StringView from the given slice.
- StringView(leveldb::Slice slice) : data_(slice.data()), size_(slice.size()) {
+ StringView(leveldb::Slice slice) // NOLINT(runtime/explicit)
+ : data_(slice.data()), size_(slice.size()) {
}
// Creates a StringView from the absl::string_view.
- StringView(absl::string_view s) : data_(s.data()), size_(s.size()) {
+ StringView(absl::string_view s) // NOLINT(runtime/explicit)
+ : data_(s.data()), size_(s.size()) {
}
// Creates a StringView from the given std::string. The string must be an
// lvalue for the lifetime requirements to be satisfied.
- StringView(const std::string &str) : data_(str.data()), size_(str.size()) {
+ StringView(const std::string &str) // NOLINT(runtime/explicit)
+ : data_(str.data()), size_(str.size()) {
}
// Converts this StringView to a Slice, which is an equivalent (and more