Blame view

Pods/Realm/include/RLMObject_Private.h 4.21 KB
75d24c15   yangbin   123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  ////////////////////////////////////////////////////////////////////////////
  //
  // Copyright 2014 Realm Inc.
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  // http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  //
  ////////////////////////////////////////////////////////////////////////////
  
  #import <Realm/RLMObjectBase_Dynamic.h>
  
  NS_ASSUME_NONNULL_BEGIN
  
  @class RLMProperty, RLMArray;
  typedef NS_ENUM(int32_t, RLMPropertyType);
  
  FOUNDATION_EXTERN void RLMInitializeWithValue(RLMObjectBase *, id, RLMSchema *);
  
  // RLMObject accessor and read/write realm
  @interface RLMObjectBase () {
  @public
      RLMRealm *_realm;
      __unsafe_unretained RLMObjectSchema *_objectSchema;
  }
  
  // shared schema for this class
  + (nullable RLMObjectSchema *)sharedSchema;
  
  + (nullable NSArray<RLMProperty *> *)_getProperties;
  + (bool)_realmIgnoreClass;
  
  @end
  
  @interface RLMDynamicObject : RLMObject
  
  @end
  
  // Calls valueForKey: and re-raises NSUndefinedKeyExceptions
  FOUNDATION_EXTERN id _Nullable RLMValidatedValueForProperty(id object, NSString *key, NSString *className);
  
  // Compare two RLObjectBases
  FOUNDATION_EXTERN BOOL RLMObjectBaseAreEqual(RLMObjectBase * _Nullable o1, RLMObjectBase * _Nullable o2);
  
  typedef void (^RLMObjectNotificationCallback)(RLMObjectBase *_Nullable object,
                                                NSArray<NSString *> *_Nullable propertyNames,
                                                NSArray *_Nullable oldValues,
                                                NSArray *_Nullable newValues,
                                                NSError *_Nullable error);
  
  FOUNDATION_EXTERN RLMNotificationToken *RLMObjectBaseAddNotificationBlock(RLMObjectBase *obj,
                                                                            NSArray<NSString *> *_Nullable key_paths,
                                                                            dispatch_queue_t _Nullable queue,
                                                                            RLMObjectNotificationCallback block);
  
  RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj,
                                                      RLMObjectChangeBlock block,
                                                      NSArray<NSString *> *_Nullable key_paths,
                                                      dispatch_queue_t _Nullable queue);
  
  // Returns whether the class is a descendent of RLMObjectBase
  FOUNDATION_EXTERN BOOL RLMIsObjectOrSubclass(Class klass);
  
  // Returns whether the class is an indirect descendant of RLMObjectBase
  FOUNDATION_EXTERN BOOL RLMIsObjectSubclass(Class klass);
  
  FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
  
  FOUNDATION_EXTERN id RLMObjectFreeze(RLMObjectBase *obj) NS_RETURNS_RETAINED;
  
  FOUNDATION_EXTERN id RLMObjectThaw(RLMObjectBase *obj);
  
  // Gets an object identifier suitable for use with Combine. This value may
  // change when an unmanaged object is added to the Realm.
  FOUNDATION_EXTERN uint64_t RLMObjectBaseGetCombineId(RLMObjectBase *);
  
  // An accessor object which is used to interact with Swift properties from obj-c
  @interface RLMManagedPropertyAccessor : NSObject
  // Perform any initialization required for KVO on a *unmanaged* object
  + (void)observe:(RLMProperty *)property on:(RLMObjectBase *)parent;
  // Initialize the given property on a *managed* object which previous was unmanaged
  + (void)promote:(RLMProperty *)property on:(RLMObjectBase *)parent;
  // Initialize the given property on a newly created *managed* object
  + (void)initialize:(RLMProperty *)property on:(RLMObjectBase *)parent;
  // Read the value of the property, on either kind of object
  + (id)get:(RLMProperty *)property on:(RLMObjectBase *)parent;
  // Set the property to the given value, on either kind of object
  + (void)set:(RLMProperty *)property on:(RLMObjectBase *)parent to:(id)value;
  @end
  
  NS_ASSUME_NONNULL_END