1 // ResourceItem.h 2 3 #ifndef RESOURCE_ITEM_H 4 #define RESOURCE_ITEM_H 5 6 #include <String.h> 7 #include <SupportDefs.h> 8 9 class BPositionIO; 10 11 class ResourceItem { 12 public: 13 typedef int32 roff_t; 14 15 public: 16 ResourceItem(); 17 virtual ~ResourceItem(); 18 19 void SetLocation(roff_t offset, roff_t size); 20 void SetIdentity(type_code type, int32 id, 21 const char* name); 22 23 void SetOffset(roff_t offset); 24 roff_t GetOffset() const; 25 26 void SetSize(roff_t size); 27 roff_t GetSize() const; 28 29 void SetType(type_code type); 30 type_code GetType() const; 31 32 void SetID(int32 id); 33 int32 GetID() const; 34 35 void SetName(const char* name); 36 const char* GetName() const; 37 38 void SetData(const void* data, roff_t size = -1); 39 void UnsetData(); 40 void* AllocData(roff_t size = -1); 41 void* GetData() const; 42 43 status_t LoadData(BPositionIO& file, 44 roff_t position = -1, 45 roff_t size = -1); 46 status_t WriteData(BPositionIO& file) const; 47 48 void PrintToStream(); 49 50 private: 51 roff_t fOffset; 52 roff_t fSize; 53 type_code fType; 54 int32 fID; 55 BString fName; 56 void* fData; 57 }; 58 59 #endif // RESOURCE_ITEM_H 60