]> err.no Git - sope/blob - sope-core/EOControl/EOKeyValueArchiver.h
4be5846576aad4e9b40f64bdb0697ee09c70f5a3
[sope] / sope-core / EOControl / EOKeyValueArchiver.h
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __EOControl_EOKeyValueArchiver_H__
23 #define __EOControl_EOKeyValueArchiver_H__
24
25 #import <Foundation/NSObject.h>
26
27 @class NSString, NSDictionary, NSMutableArray, NSMutableDictionary;
28 @class NSMutableSet;
29
30 @interface EOKeyValueArchiver : NSObject
31 {
32   NSMutableDictionary *plist;
33   id delegate; // non-retained
34 }
35
36 /* coding */
37
38 - (void)encodeObject:(id)_obj            forKey:(NSString *)_key;
39 - (void)encodeReferenceToObject:(id)_obj forKey:(NSString *)_key;
40 - (void)encodeBool:(BOOL)_flag           forKey:(NSString *)_key;
41 - (void)encodeInt:(int)_value            forKey:(NSString *)_key;
42
43 - (NSDictionary *)dictionary;
44
45 /* delegate */
46
47 - (void)setDelegate:(id)_delegate;
48 - (id)delegate;
49
50 @end
51
52 @interface EOKeyValueUnarchiver : NSObject
53 {
54   NSDictionary   *plist;
55   NSMutableArray *unarchivedObjects;
56   NSMutableSet   *awakeObjects;
57   id parent;
58   
59   id delegate; // non-retained
60 }
61
62 - (id)initWithDictionary:(NSDictionary *)_dict;
63
64 /* decoding */
65
66 - (id)decodeObjectForKey:(NSString *)_key;
67 - (id)decodeObjectReferenceForKey:(NSString *)_key;
68 - (BOOL)decodeBoolForKey:(NSString *)_key;
69 - (int)decodeIntForKey:(NSString *)_key;
70
71 /* operations */
72
73 - (void)ensureObjectAwake:(id)_object;
74 - (void)finishInitializationOfObjects;
75 - (void)awakeObjects;
76 - (id)parent;
77
78 /* delegate */
79
80 - (void)setDelegate:(id)_delegate;
81 - (id)delegate;
82
83 @end
84
85 @protocol EOKeyValueArchiving
86
87 - (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver;
88 - (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver;
89
90 @end
91
92 @interface NSObject(EOKeyValueArchivingAwakeMethods)
93
94 - (void)finishInitializationWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_una;
95 - (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver;
96
97 @end
98
99 /* delegates */
100
101 @interface NSObject(KVCArchiverDelegates)
102
103 - (id)archiver:(EOKeyValueArchiver *)_archiver
104   referenceToEncodeForObject:(id)_obj;
105
106 @end
107
108 @interface NSObject(KVCUnarchiverDelegates)
109
110 - (id)unarchiver:(EOKeyValueUnarchiver *)_unarchiver
111   objectForReference:(id)_obj;
112
113 @end
114
115 #endif /* __EOControl_EOKeyValueArchiver_H__ */