NBTContainer.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // NBTFile.h
  3. // InsideJob
  4. //
  5. // Created by Adam Preble on 10/6/10.
  6. // Copyright 2010 Adam Preble. All rights reserved.
  7. //
  8. #import <Cocoa/Cocoa.h>
  9. typedef enum {
  10. NBTTypeEnd = 0,
  11. NBTTypeByte = 1,
  12. NBTTypeShort = 2,
  13. NBTTypeInt = 3,
  14. NBTTypeLong = 4,
  15. NBTTypeFloat = 5,
  16. NBTTypeDouble = 6,
  17. NBTTypeByteArray = 7,
  18. NBTTypeString = 8,
  19. NBTTypeList = 9,
  20. NBTTypeCompound = 10,
  21. } NBTType;
  22. @interface NBTContainer : NSObject {
  23. NSString *name;
  24. NSMutableArray *children;
  25. NBTType type;
  26. NSString *stringValue;
  27. NSNumber *numberValue;
  28. NBTType listType;
  29. }
  30. @property (nonatomic, copy) NSString *name;
  31. @property (nonatomic, retain) NSMutableArray *children;
  32. @property (nonatomic, assign) NBTType type;
  33. @property (nonatomic, retain) NSString *stringValue;
  34. @property (nonatomic, retain) NSNumber *numberValue;
  35. @property (nonatomic, assign) NBTType listType;
  36. + (NBTContainer *)containerWithName:(NSString *)theName type:(NBTType)theType numberValue:(NSNumber *)theNumber;
  37. + (id)nbtContainerWithData:(NSData *)data;
  38. - (void)readFromData:(NSData *)data;
  39. - (NSData *)writeData;
  40. - (NBTContainer *)childNamed:(NSString *)theName;
  41. @end