RLMObject_Private.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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)(NSArray<NSString *> *_Nullable propertyNames,
  41. NSArray *_Nullable oldValues,
  42. NSArray *_Nullable newValues,
  43. NSError *_Nullable error);
  44. FOUNDATION_EXTERN RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectNotificationCallback block);
  45. // Returns whether the class is a descendent of RLMObjectBase
  46. FOUNDATION_EXTERN BOOL RLMIsObjectOrSubclass(Class klass);
  47. // Returns whether the class is an indirect descendant of RLMObjectBase
  48. FOUNDATION_EXTERN BOOL RLMIsObjectSubclass(Class klass);
  49. FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
  50. @interface RLMManagedPropertyAccessor : NSObject
  51. + (void)initializeObject:(void *)object parent:(RLMObjectBase *)parent property:(RLMProperty *)property;
  52. + (id)get:(void *)pointer;
  53. @end
  54. NS_ASSUME_NONNULL_END