1
/* Protocol for NSSerialization for GNUStep
2
Copyright (C) 1995 Free Software Foundation, Inc.
4
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
6
Updated by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
9
This file is part of the GNUstep Base Library.
11
This library is free software; you can redistribute it and/or
12
modify it under the terms of the GNU Library General Public
13
License as published by the Free Software Foundation; either
14
version 2 of the License, or (at your option) any later version.
16
This library is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
Library General Public License for more details.
21
You should have received a copy of the GNU Library General Public
22
License along with this library; if not, write to the Free
23
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
26
#ifndef __NSSerialization_h_GNUSTEP_BASE_INCLUDE
27
#define __NSSerialization_h_GNUSTEP_BASE_INCLUDE
29
#include <Foundation/NSObject.h>
31
@class NSData, NSMutableData;
33
@protocol NSObjCTypeSerializationCallBack
34
- (void) deserializeObjectAt: (id*)object
35
ofObjCType: (const char *)type
36
fromData: (NSData*)data
37
atCursor: (unsigned*)cursor;
38
- (void) serializeObjectAt: (id*)object
39
ofObjCType: (const char *)type
40
intoData: (NSMutableData*)data;
43
@interface NSSerializer: NSObject
44
+ (NSData*) serializePropertyList: (id)propertyList;
45
+ (void) serializePropertyList: (id)propertyList
46
intoData: (NSMutableData*)d;
51
* GNUstep extends serialization by having the option to make the
52
* resulting data more compact by ensuring that repeated strings
53
* are only stored once. If the property-list has a lot of repeated
54
* strings in it, this will be both faster and more space efficient
55
* but it will be slower if the property-list has few repeated
56
* strings. The default is NOT to generate compact versions of the data.
58
* The [+shouldBeCompact:] method sets default behavior.
59
* The [+serializePropertyList:intoData:compact:] method lets you
60
* override the default behavior.
62
@interface NSSerializer (GNUstep)
63
+ (void) shouldBeCompact: (BOOL)flag;
64
+ (void) serializePropertyList: (id)propertyList
65
intoData: (NSMutableData*)d
70
@interface NSDeserializer: NSObject
71
+ (id) deserializePropertyListFromData: (NSData*)data
72
atCursor: (unsigned int*)cursor
73
mutableContainers: (BOOL)flag;
74
+ (id) deserializePropertyListFromData: (NSData*)data
75
mutableContainers: (BOOL)flag;
76
+ (id) deserializePropertyListLazilyFromData: (NSData*)data
77
atCursor: (unsigned*)cursor
78
length: (unsigned)length
79
mutableContainers: (BOOL)flag;
85
* GNUstep extends deserialization by having the option to make the
86
* resulting data more compact by ensuring that repeated strings
87
* are only stored once. If the property-list has a lot of repeated
88
* strings in it, this will be more space efficient but it will be
89
* slower (though other parts of your code may speed up through more
90
* efficient equality testing of uniqued strings).
91
* The default is NOT to deserialize uniqued strings.
93
* The [+uniquing:] method turns uniquing on/off.
94
* Uniquing is done using a global NSCountedSet - see NSCountedSet for
98
@interface NSDeserializer (GNUstep)
99
+ (void) uniquing: (BOOL)flag;
104
#endif /* __NSSerialization_h_GNUSTEP_BASE_INCLUDE */