RLMObject_Private.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2014 Realm Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #import <Realm/RLMObjectBase_Dynamic.h>
  19. NS_ASSUME_NONNULL_BEGIN
  20. @class RLMProperty, RLMArray;
  21. typedef NS_ENUM(int32_t, RLMPropertyType);
  22. FOUNDATION_EXTERN void RLMInitializeWithValue(RLMObjectBase *, id, RLMSchema *);
  23. // RLMObject accessor and read/write realm
  24. @interface RLMObjectBase () {
  25. @public
  26. RLMRealm *_realm;
  27. __unsafe_unretained RLMObjectSchema *_objectSchema;
  28. }
  29. // shared schema for this class
  30. + (nullable RLMObjectSchema *)sharedSchema;
  31. + (nullable NSArray<RLMProperty *> *)_getPropertiesWithInstance:(id)obj;
  32. + (bool)_realmIgnoreClass;
  33. @end
  34. @interface RLMDynamicObject : RLMObject
  35. @end
  36. // Calls valueForKey: and re-raises NSUndefinedKeyExceptions
  37. FOUNDATION_EXTERN id _Nullable RLMValidatedValueForProperty(id object, NSString *key, NSString *className);
  38. // Compare two RLObjectBases
  39. FOUNDATION_EXTERN BOOL RLMObjectBaseAreEqual(RLMObjectBase * _Nullable o1, RLMObjectBase * _Nullable o2);
  40. typedef void (^RLMObjectNotificationCallback)(RLMObjectBase *_Nullable object,
  41. NSArray<NSString *> *_Nullable propertyNames,
  42. NSArray *_Nullable oldValues,
  43. NSArray *_Nullable newValues,
  44. NSError *_Nullable error);
  45. FOUNDATION_EXTERN RLMNotificationToken *RLMObjectBaseAddNotificationBlock(RLMObjectBase *obj,
  46. dispatch_queue_t _Nullable queue,
  47. RLMObjectNotificationCallback block);
  48. RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectChangeBlock block,
  49. dispatch_queue_t _Nullable queue);
  50. // Returns whether the class is a descendent of RLMObjectBase
  51. FOUNDATION_EXTERN BOOL RLMIsObjectOrSubclass(Class klass);
  52. // Returns whether the class is an indirect descendant of RLMObjectBase
  53. FOUNDATION_EXTERN BOOL RLMIsObjectSubclass(Class klass);
  54. FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
  55. FOUNDATION_EXTERN id RLMObjectFreeze(RLMObjectBase *obj) NS_RETURNS_RETAINED;
  56. // Gets an object identifier suitable for use with Combine. This value may
  57. // change when an unmanaged object is added to the Realm.
  58. FOUNDATION_EXTERN uint64_t RLMObjectBaseGetCombineId(RLMObjectBase *);
  59. @interface RLMManagedPropertyAccessor : NSObject
  60. + (void)initializeObject:(void *)object parent:(RLMObjectBase *)parent property:(RLMProperty *)property;
  61. + (id)get:(void *)pointer;
  62. @end
  63. NS_ASSUME_NONNULL_END