1995-04-03 20:49:14 +00:00
|
|
|
/* Protocol for NSSerialization for GNUStep
|
1995-07-01 19:01:11 +00:00
|
|
|
Copyright (C) 1995 Free Software Foundation, Inc.
|
|
|
|
|
1996-04-17 20:17:45 +00:00
|
|
|
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1995-07-01 19:01:11 +00:00
|
|
|
Date: 1995
|
1997-09-01 21:59:51 +00:00
|
|
|
Updated by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
1998-11-19 15:45:00 +00:00
|
|
|
Date: 1998
|
1995-04-03 20:49:14 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-04-03 20:49:14 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
1995-04-03 20:49:14 +00:00
|
|
|
*/
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSSerialization_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSSerialization_h_GNUSTEP_BASE_INCLUDE
|
1995-04-03 20:49:14 +00:00
|
|
|
|
1999-05-26 12:59:34 +00:00
|
|
|
#include <Foundation/NSObject.h>
|
|
|
|
|
1995-04-15 19:41:39 +00:00
|
|
|
@class NSData, NSMutableData;
|
|
|
|
|
1995-04-03 20:49:14 +00:00
|
|
|
@protocol NSObjCTypeSerializationCallBack
|
1997-09-01 21:59:51 +00:00
|
|
|
- (void) deserializeObjectAt: (id*)object
|
|
|
|
ofObjCType: (const char *)type
|
|
|
|
fromData: (NSData*)data
|
|
|
|
atCursor: (unsigned*)cursor;
|
|
|
|
- (void) serializeObjectAt: (id*)object
|
|
|
|
ofObjCType: (const char *)type
|
|
|
|
intoData: (NSMutableData*)data;
|
|
|
|
@end
|
|
|
|
|
1998-11-19 15:45:00 +00:00
|
|
|
@interface NSSerializer: NSObject
|
1997-09-01 21:59:51 +00:00
|
|
|
+ (NSData*) serializePropertyList: (id)propertyList;
|
|
|
|
+ (void) serializePropertyList: (id)propertyList
|
|
|
|
intoData: (NSMutableData*)d;
|
|
|
|
@end
|
|
|
|
|
1998-11-20 12:12:08 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
|
|
|
/*
|
|
|
|
* GNUstep extends serialization by having the option to make the
|
|
|
|
* resulting data more compact by ensuring that repeated strings
|
|
|
|
* are only stored once. If the property-list has a lot of repeated
|
|
|
|
* strings in it, this will be both faster and more space efficient
|
|
|
|
* but it will be slower if the property-list has few repeated
|
1998-12-07 11:39:40 +00:00
|
|
|
* strings. The default is NOT to generate compact versions of the data.
|
1998-11-20 12:12:08 +00:00
|
|
|
*
|
|
|
|
* The [+shouldBeCompact:] method sets default behavior.
|
|
|
|
* The [+serializePropertyList:intoData:compact:] method lets you
|
|
|
|
* override the default behavior.
|
|
|
|
*/
|
|
|
|
@interface NSSerializer (GNUstep)
|
|
|
|
+ (void) shouldBeCompact: (BOOL)flag;
|
|
|
|
+ (void) serializePropertyList: (id)propertyList
|
|
|
|
intoData: (NSMutableData*)d
|
|
|
|
compact: (BOOL)flag;
|
|
|
|
@end
|
|
|
|
#endif
|
|
|
|
|
1998-11-19 15:45:00 +00:00
|
|
|
@interface NSDeserializer: NSObject
|
1997-09-01 21:59:51 +00:00
|
|
|
+ (id) deserializePropertyListFromData: (NSData*)data
|
|
|
|
atCursor: (unsigned int*)cursor
|
|
|
|
mutableContainers: (BOOL)flag;
|
|
|
|
+ (id) deserializePropertyListFromData: (NSData*)data
|
|
|
|
mutableContainers: (BOOL)flag;
|
|
|
|
+ (id) deserializePropertyListLazilyFromData: (NSData*)data
|
1998-11-19 15:45:00 +00:00
|
|
|
atCursor: (unsigned*)cursor
|
|
|
|
length: (unsigned)length
|
|
|
|
mutableContainers: (BOOL)flag;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
1995-04-03 20:49:14 +00:00
|
|
|
@end
|
|
|
|
|
1999-06-02 09:32:16 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
|
|
|
/*
|
|
|
|
* GNUstep extends deserialization by having the option to make the
|
|
|
|
* resulting data more compact by ensuring that repeated strings
|
|
|
|
* are only stored once. If the property-list has a lot of repeated
|
|
|
|
* strings in it, this will be more space efficient but it will be
|
|
|
|
* slower (though other parts of your code may speed up through more
|
|
|
|
* efficient equality testing of uniqued strings).
|
|
|
|
* The default is NOT to deserialize uniqued strings.
|
|
|
|
*
|
|
|
|
* The [+uniquing:] method turns uniquing on/off. Turning off uniquing
|
1999-06-09 16:12:20 +00:00
|
|
|
* destroys the NSMutableSet used for uniquing.
|
|
|
|
* The [+uniqueSet] method gives you direct access to the uniquing set.
|
|
|
|
* The [+unique:] method lets you find the 'uniqued' version os a string.
|
1999-06-02 09:32:16 +00:00
|
|
|
*/
|
1999-06-09 16:12:20 +00:00
|
|
|
@class NSMutableSet;
|
1999-06-02 09:32:16 +00:00
|
|
|
@interface NSDeserializer (GNUstep)
|
|
|
|
+ (void) _becomeThreaded: (id)notification; /* private */
|
1999-06-09 16:12:20 +00:00
|
|
|
+ (NSString*) unique: (NSString*)original;
|
1999-06-02 09:32:16 +00:00
|
|
|
+ (void) uniquing: (BOOL)flag;
|
1999-06-09 16:12:20 +00:00
|
|
|
+ (NSMutableSet*) uniqueSet;
|
1999-06-02 09:32:16 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#endif /* __NSSerialization_h_GNUSTEP_BASE_INCLUDE */
|