-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAMProxyObjectCommiter.h
90 lines (77 loc) · 3.16 KB
/
AMProxyObjectCommiter.h
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
//
// AMProxyObjectCommiter.h
// Created by Joan Martin.
// Take a look to my repos at http://github.com/vilanovi
//
// Copyright (c) 2013 Joan Martin, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
#import <Foundation/Foundation.h>
extern NSString * const AMProxyObjectCommiterNillyfiedValuesKey;
extern NSString * const AMProxyObjectCommiterChangedValuesKey;
@interface AMProxyObjectCommiter : NSProxy
/*!
* Main init method.
* @param object The object to track.
* @return The AMProxyObjectCommiter instance initialized.
*/
- (id)__initWithObject:(id)object;
/*!
* @property The tracked object.
*/
@property (nonatomic, readonly) id __object;
/*!
* Use this method to commit changes for the given key.
* @param key The key of the value.
*/
- (void)__commitChangesForKey:(NSString*)key;
/*!
* This method commits all tracked changes for all keys.
*/
- (void)__commitChanges;
/*!
* Get the current tracked changes.
* @return A dictionary containing the changes.
* @discussion The dictonary contains two keys 'AMProxyObjectCommiterNillyfiedValuesKey' with a value of type array containing all the keys with nil values and 'AMProxyObjectCommiterChangedValuesKey' with a value of type dictionary containing all new key values.
*/
- (NSDictionary*)__changes;
/*!
* Check if the value for the given key has been modifyed.
* @param key The key of the value.
* @return YES if modifyed, otherwise NO.
*/
- (BOOL)__didChangeForKey:(NSString*)key;
/*!
* Get the current edited value.
* @param key The key of the value.
* @return The edited value.
* @discussion This method is equivalent to method '-valueForKey:' applyed to the proxy object.
*/
- (id)__editedValueForKey:(NSString*)key;
/*!
* Get the non-edited (original) value for the given key.
* @param key The key of the value.
* @return The edited value.
* @discussion This method is equivalent to method '-valueForKey:' or the current accessor applyed to the original object. Also, you can get the original value just by calling the accessor (via non KVC).
*/
- (id)__originalValueForKey:(NSString*)key;
/*!
* TODO
*/
- (void)__trackSetSelector:(SEL)setSelector forGetSelector:(SEL)getSelector;
@end