]> err.no Git - sope/blob - sope-core/EOControl/EOKeyValueArchiver.h
Drop apache 1 build-dependency
[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 (eg a WOComponent)
60 }
61
62 - (id)initWithDictionary:(NSDictionary *)_dict;
63
64 /* decoding */
65
66 - (id)decodeObjectForKey:(NSString *)_key;
67 - (id)decodeObjectReferenceForKey:(NSString *)_key; /* ask delegate for obj */
68 - (BOOL)decodeBoolForKey:(NSString *)_key;
69 - (int)decodeIntForKey:(NSString *)_key;
70
71 - (id)decodeObjectAtIndex:(unsigned)_idx;
72
73 /* operations */
74
75 - (void)ensureObjectAwake:(id)_object;
76 - (void)finishInitializationOfObjects;
77 - (void)awakeObjects;
78 - (id)parent;
79
80 /* delegate */
81
82 - (void)setDelegate:(id)_delegate;
83 - (id)delegate;
84
85 @end
86
87 @protocol EOKeyValueArchiving
88
89 - (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver;
90 - (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver;
91
92 @end
93
94 @interface NSObject(EOKeyValueArchivingAwakeMethods)
95
96 - (void)finishInitializationWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_un;
97 - (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver;
98
99 @end
100
101 /* delegates */
102
103 @interface NSObject(KVCArchiverDelegates)
104
105 - (id)archiver:(EOKeyValueArchiver *)_archiver
106   referenceToEncodeForObject:(id)_obj;
107
108 @end
109
110 @interface NSObject(KVCUnarchiverDelegates)
111
112 - (id)unarchiver:(EOKeyValueUnarchiver *)_unarchiver
113   objectForReference:(id)_obj;
114
115 @end
116
117 #endif /* __EOControl_EOKeyValueArchiver_H__ */