home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSSerialization.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  2.4 KB  |  69 lines

  1. /*    NSSerialization.h
  2.     Standard Serialization of Property Lists
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #import <Foundation/NSObject.h>
  7. #import <Foundation/NSData.h>
  8.  
  9. /***************    Serialization of very basic types    ***********/
  10.  
  11. @interface NSMutableData (NSMutableDataSerialization)
  12.  
  13. - (void)serializeInt:(int)value;
  14. - (void)serializeInts:(int *)intBuffer count:(unsigned)numInts;
  15. - (void)serializeInt:(int)value atIndex:(unsigned)index;
  16. - (void)serializeInts:(int *)intBuffer count:(unsigned)numInts atIndex:(unsigned)index;
  17. - (void)serializeAlignedBytesLength:(unsigned)length;
  18.  
  19. @end
  20.  
  21. @interface NSData (NSDataDeserialization)
  22.  
  23. - (int)deserializeIntAtIndex:(unsigned)index;
  24. - (void)deserializeInts:(int *)intBuffer count:(unsigned)numInts atIndex:(unsigned)index;
  25. - (int)deserializeIntAtCursor:(unsigned *)cursor;
  26. - (void)deserializeInts:(int *)intBuffer count:(unsigned)numInts atCursor:(unsigned *)cursor;
  27. - (unsigned)deserializeAlignedBytesLengthAtCursor:(unsigned *)cursor;
  28. - (void)deserializeBytes:(void *)buffer length:(unsigned)bytes atCursor:(unsigned *)cursor;
  29.  
  30. @end
  31.  
  32. /*********     Objective-C Type Serialization ************************/
  33.  
  34. @protocol NSObjCTypeSerializationCallBack
  35.  
  36. - (void)serializeObjectAt:(id *)object ofObjCType:(const char *)type intoData:(NSMutableData *)data;
  37. - (void)deserializeObjectAt:(id *)object ofObjCType:(const char *)type fromData:(NSData *)data atCursor:(unsigned *)cursor;
  38.  
  39. @end
  40.  
  41. @interface NSMutableData (NSMutableDataObjcTypeSerialization)
  42.  
  43. - (void)serializeDataAt:(const void *)data ofObjCType:(const char *)type context:(id <NSObjCTypeSerializationCallBack>)callback;
  44.  
  45. @end
  46.  
  47. @interface NSData (NSDataObjCTypeDeserialization)
  48.  
  49. - (void)deserializeDataAt:(void *)data ofObjCType:(const char *)type atCursor:(unsigned *)cursor context:(id <NSObjCTypeSerializationCallBack>)callback;
  50.  
  51. @end
  52.  
  53. /***************    Property List Serialization    ***************/
  54.  
  55. @interface NSSerializer : NSObject
  56.  
  57. + (void)serializePropertyList:(id)aPropertyList intoData:(NSMutableData *)mdata;
  58. + (NSData *)serializePropertyList:(id)aPropertyList;
  59.  
  60. @end
  61.  
  62. @interface NSDeserializer : NSObject
  63.     
  64. + (id)deserializePropertyListFromData:(NSData *)data atCursor:(unsigned *)cursor mutableContainers:(BOOL)mut;
  65. + (id)deserializePropertyListLazilyFromData:(NSData *)data atCursor:(unsigned *)cursor length:(unsigned)length mutableContainers:(BOOL)mut;
  66. + (id)deserializePropertyListFromData:(NSData *)serialization mutableContainers:(BOOL)mut;
  67.  
  68. @end
  69.