diff options
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util')
-rw-r--r-- | Firestore/core/src/firebase/firestore/util/string_apple.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Firestore/core/src/firebase/firestore/util/string_apple.h b/Firestore/core/src/firebase/firestore/util/string_apple.h index 3f6b814..73388be 100644 --- a/Firestore/core/src/firebase/firestore/util/string_apple.h +++ b/Firestore/core/src/firebase/firestore/util/string_apple.h @@ -22,6 +22,8 @@ #import <Foundation/Foundation.h> +#include <string> + #include "absl/strings/string_view.h" namespace firebase { @@ -57,6 +59,12 @@ inline absl::string_view MakeStringView(NSString* str) { [str UTF8String], [str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); } +// Creates a std::string wrapper for the contents of the given NSString. +inline std::string MakeString(NSString* str) { + return std::string([str UTF8String], + [str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); +} + } // namespace util } // namespace firestore } // namespace firebase |