aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/model/snapshot_version.h
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/core/src/firebase/firestore/model/snapshot_version.h')
-rw-r--r--Firestore/core/src/firebase/firestore/model/snapshot_version.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/snapshot_version.h b/Firestore/core/src/firebase/firestore/model/snapshot_version.h
index 56e8c50..1fbba1c 100644
--- a/Firestore/core/src/firebase/firestore/model/snapshot_version.h
+++ b/Firestore/core/src/firebase/firestore/model/snapshot_version.h
@@ -19,6 +19,11 @@
#include "Firestore/core/include/firebase/firestore/timestamp.h"
+#if defined(__OBJC__)
+#import "FIRTimestamp.h"
+#import "Firestore/Source/Core/FSTSnapshotVersion.h"
+#endif // defined(__OBJC__)
+
namespace firebase {
namespace firestore {
namespace model {
@@ -38,6 +43,24 @@ class SnapshotVersion {
/** Creates a new version that is smaller than all other versions. */
static const SnapshotVersion& None();
+#if defined(__OBJC__)
+ SnapshotVersion(FSTSnapshotVersion* version) // NOLINT(runtime/explicit)
+ : timestamp_{version.timestamp.seconds, version.timestamp.nanoseconds} {
+ }
+
+ operator FSTSnapshotVersion*() const {
+ if (timestamp_ == Timestamp{}) {
+ return [FSTSnapshotVersion noVersion];
+ } else {
+ return [FSTSnapshotVersion
+ versionWithTimestamp:[FIRTimestamp
+ timestampWithSeconds:timestamp_.seconds()
+ nanoseconds:timestamp_
+ .nanoseconds()]];
+ }
+ }
+#endif // defined(__OBJC__)
+
private:
Timestamp timestamp_;
};