FSTDocument.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #include "Firestore/core/src/firebase/firestore/model/document_key.h"
  18. #include "Firestore/core/src/firebase/firestore/model/field_path.h"
  19. #include "Firestore/core/src/firebase/firestore/model/snapshot_version.h"
  20. @class FSTFieldValue;
  21. @class FSTObjectValue;
  22. NS_ASSUME_NONNULL_BEGIN
  23. /**
  24. * The result of a lookup for a given path may be an existing document or a tombstone that marks
  25. * the path deleted.
  26. */
  27. @interface FSTMaybeDocument : NSObject <NSCopying>
  28. - (id)init __attribute__((unavailable("Abstract base class")));
  29. - (const firebase::firestore::model::DocumentKey &)key;
  30. - (const firebase::firestore::model::SnapshotVersion &)version;
  31. @end
  32. @interface FSTDocument : FSTMaybeDocument
  33. + (instancetype)documentWithData:(FSTObjectValue *)data
  34. key:(firebase::firestore::model::DocumentKey)key
  35. version:(firebase::firestore::model::SnapshotVersion)version
  36. hasLocalMutations:(BOOL)mutations;
  37. - (nullable FSTFieldValue *)fieldForPath:(const firebase::firestore::model::FieldPath &)path;
  38. @property(nonatomic, strong, readonly) FSTObjectValue *data;
  39. @property(nonatomic, readonly, getter=hasLocalMutations) BOOL localMutations;
  40. @end
  41. @interface FSTDeletedDocument : FSTMaybeDocument
  42. + (instancetype)documentWithKey:(firebase::firestore::model::DocumentKey)key
  43. version:(firebase::firestore::model::SnapshotVersion)version;
  44. @end
  45. /** An NSComparator suitable for comparing docs using only their keys. */
  46. extern const NSComparator FSTDocumentComparatorByKey;
  47. NS_ASSUME_NONNULL_END