diff options
author | Gil <mcg@google.com> | 2018-04-09 11:54:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-09 11:54:39 -0700 |
commit | 0a6618705389543191a8c44278d4c6791c84602a (patch) | |
tree | 4f195f31da90b29ffa5219e016b2cfd9ad0a7ccf /Firestore/Source/Local/StringView.h | |
parent | 2f2bb7f4c717bb95df69735e93ae84de8b8feaad (diff) |
Add lint checking for Objective-C++ sources (#1048)
* lint.sh now lints Objective-C++ too
* cpplint checks system-style includes that should be user-style
This prevents it from recognizing project sources as if they were C
system headers and then complaining that they're in the wrong place.
* cpplint checks #imports and #includes
* cpplint checks that C++ system headers aren't #imported
* cpplint checks for C system headers that could be C++ system headers
* cpplint checks that Objective-C sources include their headers
Diffstat (limited to 'Firestore/Source/Local/StringView.h')
-rw-r--r-- | Firestore/Source/Local/StringView.h | 17 |
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 |