123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #import <Foundation/Foundation.h>
- #import <realm/table_ref.hpp>
- #import <unordered_map>
- #import <vector>
- namespace realm {
- class ObjectSchema;
- class Schema;
- struct Property;
- struct ColKey;
- }
- class RLMObservationInfo;
- @class RLMRealm, RLMSchema, RLMObjectSchema, RLMProperty;
- NS_ASSUME_NONNULL_BEGIN
- namespace std {
- template<> struct hash<NSString *> {
- size_t operator()(__unsafe_unretained NSString *const str) const {
- return [str hash];
- }
- };
- template<> struct equal_to<NSString *> {
- bool operator()(__unsafe_unretained NSString * lhs, __unsafe_unretained NSString *rhs) const {
- return [lhs isEqualToString:rhs];
- }
- };
- }
- class RLMClassInfo {
- public:
- RLMClassInfo(RLMRealm *, RLMObjectSchema *, const realm::ObjectSchema *);
- __unsafe_unretained RLMRealm *const realm;
- __unsafe_unretained RLMObjectSchema *const rlmObjectSchema;
- const realm::ObjectSchema *const objectSchema;
-
-
- std::vector<RLMObservationInfo *> observedObjects;
-
-
- realm::TableRef table() const;
-
-
- RLMProperty *_Nullable propertyForTableColumn(realm::ColKey) const noexcept;
-
-
- RLMProperty *_Nullable propertyForPrimaryKey() const noexcept;
-
-
- realm::ColKey tableColumn(NSString *propertyName) const;
- realm::ColKey tableColumn(RLMProperty *property) const;
-
- RLMClassInfo &linkTargetType(size_t propertyIndex);
-
- RLMClassInfo &linkTargetType(realm::Property const& property);
-
- RLMClassInfo &freeze(RLMRealm *);
- };
- class RLMSchemaInfo {
- using impl = std::unordered_map<NSString *, RLMClassInfo>;
- public:
- RLMSchemaInfo() = default;
- RLMSchemaInfo(RLMRealm *realm);
- RLMSchemaInfo clone(realm::Schema const& source_schema, RLMRealm *target_realm);
-
- RLMClassInfo& operator[](NSString *name);
- impl::iterator begin() noexcept;
- impl::iterator end() noexcept;
- impl::const_iterator begin() const noexcept;
- impl::const_iterator end() const noexcept;
- private:
- std::unordered_map<NSString *, RLMClassInfo> m_objects;
- };
- NS_ASSUME_NONNULL_END
|