1 ////////////////////////////////////////////////////////////////////////////
3 // Copyright 2014 Realm Inc.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 ////////////////////////////////////////////////////////////////////////////
19 #import "RLMArray_Private.h"
21 #import "RLMCollection_Private.hpp"
23 #import "RLMResults_Private.hpp"
25 #import <realm/link_view_fwd.hpp>
26 #import <realm/table_ref.hpp>
32 @class RLMObjectBase, RLMObjectSchema, RLMProperty;
34 class RLMObservationInfo;
36 @interface RLMArray () {
38 NSString *_objectClassName;
39 RLMPropertyType _type;
42 // The name of the property which this RLMArray represents
44 __weak RLMObjectBase *_parentObject;
48 @interface RLMManagedArray : RLMArray <RLMFastEnumerable>
49 - (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;
50 - (RLMManagedArray *)initWithList:(realm::List)list
51 realm:(__unsafe_unretained RLMRealm *const)realm
52 parentInfo:(RLMClassInfo *)parentInfo
53 property:(__unsafe_unretained RLMProperty *const)property;
55 - (bool)isBackedByList:(realm::List const&)list;
57 // deletes all objects in the RLMArray from their containing realms
58 - (void)deleteObjectsFromRealm;
61 void RLMValidateArrayObservationKey(NSString *keyPath, RLMArray *array);
63 // Initialize the observation info for an array if needed
64 void RLMEnsureArrayObservationInfo(std::unique_ptr<RLMObservationInfo>& info,
65 NSString *keyPath, RLMArray *array, id observed);
69 // RLMResults private methods
71 @interface RLMResults () <RLMFastEnumerable>
72 - (void)deleteObjectsFromRealm;