aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/model/document_key.h
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/core/src/firebase/firestore/model/document_key.h')
-rw-r--r--Firestore/core/src/firebase/firestore/model/document_key.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/document_key.h b/Firestore/core/src/firebase/firestore/model/document_key.h
index 6eb1e18..8e590d8 100644
--- a/Firestore/core/src/firebase/firestore/model/document_key.h
+++ b/Firestore/core/src/firebase/firestore/model/document_key.h
@@ -21,6 +21,10 @@
#include <memory>
#include <string>
+#if defined(__OBJC__)
+#import "Firestore/Source/Model/FSTDocumentKey.h"
+#endif // defined(__OBJC__)
+
#include "Firestore/core/src/firebase/firestore/model/resource_path.h"
#include "absl/strings/string_view.h"
@@ -43,6 +47,16 @@ class DocumentKey {
/** Creates a new document key, taking ownership of the given path. */
explicit DocumentKey(ResourcePath&& path);
+#if defined(__OBJC__)
+ DocumentKey(FSTDocumentKey* key) // NOLINT(runtime/explicit)
+ : path_(std::make_shared<ResourcePath>(key.path)) {
+ }
+
+ operator FSTDocumentKey*() const {
+ return [FSTDocumentKey keyWithPath:path()];
+ }
+#endif
+
/**
* Creates and returns a new document key using '/' to split the string into
* segments.
@@ -69,6 +83,11 @@ class DocumentKey {
return path_ ? *path_ : Empty().path();
}
+#if defined(__OBJC__)
+ // Helper function to convert to FSTDocumentKey during the C++ migration.
+ FSTDocumentKey* ToFSTDocumentKey() const;
+#endif // defined(__OBJC__)
+
private:
// This is an optimization to make passing DocumentKey around cheaper (it's
// copied often).