aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/core')
-rw-r--r--Firestore/core/src/firebase/firestore/model/document_key.h9
-rw-r--r--Firestore/core/test/firebase/firestore/testutil/testutil.h5
2 files changed, 9 insertions, 5 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/document_key.h b/Firestore/core/src/firebase/firestore/model/document_key.h
index 8e590d8..134bda5 100644
--- a/Firestore/core/src/firebase/firestore/model/document_key.h
+++ b/Firestore/core/src/firebase/firestore/model/document_key.h
@@ -55,6 +55,10 @@ class DocumentKey {
operator FSTDocumentKey*() const {
return [FSTDocumentKey keyWithPath:path()];
}
+
+ std::string ToString() const {
+ return path().CanonicalString();
+ }
#endif
/**
@@ -83,11 +87,6 @@ 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).
diff --git a/Firestore/core/test/firebase/firestore/testutil/testutil.h b/Firestore/core/test/firebase/firestore/testutil/testutil.h
index 094efc5..9c69784 100644
--- a/Firestore/core/test/firebase/firestore/testutil/testutil.h
+++ b/Firestore/core/test/firebase/firestore/testutil/testutil.h
@@ -17,6 +17,7 @@
#ifndef FIRESTORE_CORE_TEST_FIREBASE_FIRESTORE_TESTUTIL_TESTUTIL_H_
#define FIRESTORE_CORE_TEST_FIREBASE_FIRESTORE_TESTUTIL_TESTUTIL_H_
+#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/field_path.h"
#include "Firestore/core/src/firebase/firestore/model/resource_path.h"
#include "absl/strings/string_view.h"
@@ -27,6 +28,10 @@ namespace testutil {
// Below are convenience methods for creating instances for tests.
+inline model::DocumentKey Key(absl::string_view path) {
+ return model::DocumentKey::FromPathString(path);
+}
+
inline model::FieldPath Field(absl::string_view field) {
return model::FieldPath::FromServerFormat(field);
}