diff options
author | Gil <mcg@google.com> | 2018-01-19 12:27:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-19 12:27:11 -0800 |
commit | 39d8252300015c26f1932cff42032613fdb36a09 (patch) | |
tree | 93bb3ab7c476289c4afe6cf91773a60b6f53a94d /Firestore/Source/Core | |
parent | 9f7c094f9f00a6efc0107071f109ef1bc4d7357d (diff) |
Port comparison to C++ (#678)
This reimplements our comparison functions as C++ Comparators and then provides compatibility shims for interoperating with existing Objective-C usage.
A few specialized comparators aren't suitable for porting but only have a single usage (e.g. CompareBytes for comparing NSData * instances). In these cases I've moved them into the caller.
* Use int32_t for typeof(ID) in FSTDocumentReference
* Migrate callers of FSTComparison.h to Objective-C++
* Port comparison to C++
* Migrate usages of FSTComparison.h to C++ equivalents
* Remove FSTComparison
Diffstat (limited to 'Firestore/Source/Core')
-rw-r--r-- | Firestore/Source/Core/FSTTimestamp.mm (renamed from Firestore/Source/Core/FSTTimestamp.m) | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Firestore/Source/Core/FSTTimestamp.m b/Firestore/Source/Core/FSTTimestamp.mm index 6d9e314..d2b492a 100644 --- a/Firestore/Source/Core/FSTTimestamp.m +++ b/Firestore/Source/Core/FSTTimestamp.mm @@ -16,8 +16,11 @@ #import "Firestore/Source/Core/FSTTimestamp.h" +#include "Firestore/core/src/firebase/firestore/util/comparison.h" + #import "Firestore/Source/Util/FSTAssert.h" -#import "Firestore/Source/Util/FSTComparison.h" + +using firebase::firestore::util::WrapCompare; NS_ASSUME_NONNULL_BEGIN @@ -110,11 +113,11 @@ static const int kNanosPerSecond = 1000000000; } - (NSComparisonResult)compare:(FSTTimestamp *)other { - NSComparisonResult result = FSTCompareInt64s(self.seconds, other.seconds); + NSComparisonResult result = WrapCompare<int64_t>(self.seconds, other.seconds); if (result != NSOrderedSame) { return result; } - return FSTCompareInt32s(self.nanos, other.nanos); + return WrapCompare<int32_t>(self.nanos, other.nanos); } @end |