RLMArray_Private.hpp 2.2 KB

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