RLMArray_Private.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 "RLMArray_Private.h"
  19. #import "RLMCollection_Private.hpp"
  20. #import "RLMResults_Private.hpp"
  21. #import <realm/table_ref.hpp>
  22. namespace realm {
  23. class Results;
  24. }
  25. @class RLMObjectBase, RLMObjectSchema, RLMProperty;
  26. class RLMClassInfo;
  27. class RLMObservationInfo;
  28. @interface RLMArray () {
  29. @protected
  30. NSString *_objectClassName;
  31. RLMPropertyType _type;
  32. BOOL _optional;
  33. @public
  34. // The name of the property which this RLMArray represents
  35. NSString *_key;
  36. __weak RLMObjectBase *_parentObject;
  37. }
  38. @end
  39. @interface RLMManagedArray : RLMArray <RLMFastEnumerable>
  40. - (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;
  41. - (RLMManagedArray *)initWithList:(realm::List)list
  42. parentInfo:(RLMClassInfo *)parentInfo
  43. property:(__unsafe_unretained RLMProperty *const)property;
  44. - (bool)isBackedByList:(realm::List const&)list;
  45. // deletes all objects in the RLMArray from their containing realms
  46. - (void)deleteObjectsFromRealm;
  47. @end
  48. void RLMValidateArrayObservationKey(NSString *keyPath, RLMArray *array);
  49. // Initialize the observation info for an array if needed
  50. void RLMEnsureArrayObservationInfo(std::unique_ptr<RLMObservationInfo>& info,
  51. NSString *keyPath, RLMArray *array, id observed);
  52. //
  53. // RLMResults private methods
  54. //
  55. @interface RLMResults () <RLMFastEnumerable>
  56. - (void)deleteObjectsFromRealm;
  57. @end