RLMObject_Private.h
3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Realm/RLMObject.h>
// RLMObject accessor and read/write realm
@interface RLMObjectBase () {
@public
RLMRealm *_realm;
// objectSchema is a cached pointer to an object stored in the RLMSchema
// owned by _realm, so it's guaranteed to stay alive as long as this object
// without retaining it (and retaining it makes iteration slower)
__unsafe_unretained RLMObjectSchema *_objectSchema;
}
// standalone initializer
- (instancetype)initWithValue:(id)value schema:(RLMSchema *)schema NS_DESIGNATED_INITIALIZER;
// live accessor initializer
- (instancetype)initWithRealm:(__unsafe_unretained RLMRealm *const)realm
schema:(__unsafe_unretained RLMObjectSchema *const)schema NS_DESIGNATED_INITIALIZER;
// shared schema for this class
+ (RLMObjectSchema *)sharedSchema;
// provide injection point for alternative Swift object util class
+ (Class)objectUtilClass:(BOOL)isSwift;
@end
@interface RLMObject ()
// standalone initializer
- (instancetype)initWithValue:(id)value schema:(RLMSchema *)schema NS_DESIGNATED_INITIALIZER;
// live accessor initializer
- (instancetype)initWithRealm:(__unsafe_unretained RLMRealm *const)realm
schema:(__unsafe_unretained RLMObjectSchema *const)schema NS_DESIGNATED_INITIALIZER;
@end
@interface RLMDynamicObject : RLMObject
@end
//
// Getters and setters for RLMObjectBase ivars for realm and objectSchema
//
FOUNDATION_EXTERN void RLMObjectBaseSetRealm(RLMObjectBase *object, RLMRealm *realm);
FOUNDATION_EXTERN RLMRealm *RLMObjectBaseRealm(RLMObjectBase *object);
FOUNDATION_EXTERN void RLMObjectBaseSetObjectSchema(RLMObjectBase *object, RLMObjectSchema *objectSchema);
FOUNDATION_EXTERN RLMObjectSchema *RLMObjectBaseObjectSchema(RLMObjectBase *object);
// Get linking objects for an RLMObjectBase
FOUNDATION_EXTERN NSArray *RLMObjectBaseLinkingObjectsOfClass(RLMObjectBase *object, NSString *className, NSString *property);
// Dynamic access to RLMObjectBase properties
FOUNDATION_EXTERN id RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase *object, NSString *key);
FOUNDATION_EXTERN void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase *object, NSString *key, id obj);
// Calls valueForKey: and re-raises NSUndefinedKeyExceptions
FOUNDATION_EXTERN id RLMValidatedValueForProperty(id object, NSString *key, NSString *className);
// Compare two RLObjectBases
FOUNDATION_EXTERN BOOL RLMObjectBaseAreEqual(RLMObjectBase *o1, RLMObjectBase *o2);
// Get ObjectUil class for objc or swift
FOUNDATION_EXTERN Class RLMObjectUtilClass(BOOL isSwift);
FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
@class RLMProperty, RLMArray;
@interface RLMObjectUtil : NSObject
+ (NSArray RLM_GENERIC(NSString *) *)ignoredPropertiesForClass:(Class)cls;
+ (NSArray RLM_GENERIC(NSString *) *)indexedPropertiesForClass:(Class)cls;
+ (NSArray RLM_GENERIC(NSString *) *)getGenericListPropertyNames:(id)obj;
+ (void)initializeListProperty:(RLMObjectBase *)object property:(RLMProperty *)property array:(RLMArray *)array;
+ (void)initializeOptionalProperty:(RLMObjectBase *)object property:(RLMProperty *)property;
+ (NSDictionary RLM_GENERIC(NSString *, NSNumber *) *)getOptionalProperties:(id)obj;
+ (NSArray RLM_GENERIC(NSString *) *)requiredPropertiesForClass:(Class)cls;
@end