3 #ifndef RESOURCE_FILE_H
4 #define RESOURCE_FILE_H
9 #include "OffsetFile.h"
15 struct PEFContainerHeader
;
20 virtual ~ResourceFile();
22 void Init(BFile
& file
); // throws Exception
24 status_t
InitCheck() const;
26 bool AddItem(ResourceItem
* item
, int32 index
= -1);
27 ResourceItem
* RemoveItem(int32 index
);
28 bool RemoveItem(ResourceItem
* item
);
29 int32
IndexOf(ResourceItem
* item
) const;
30 ResourceItem
* ItemAt(int32 index
) const;
31 int32
CountItems() const;
33 uint32
GetResourcesSize() const;
34 uint32
WriteResources(void* buffer
, uint32 size
);
37 void PrintToStream(bool longInfo
= true);
40 void _InitFile(BFile
& file
);
41 void _InitELFFile(BFile
& file
);
42 void _InitPEFFile(BFile
& file
,
43 const PEFContainerHeader
& pefHeader
);
46 bool _ReadIndexEntry(int32 index
,
49 void _ReadInfoTable();
50 bool _ReadInfoTableEnd(const void* data
,
52 const void* _ReadResourceInfo(const MemArea
& area
,
53 const resource_info
* info
,
57 inline int16
_GetInt16(int16 value
);
58 inline uint16
_GetUInt16(uint16 value
);
59 inline int32
_GetInt32(int32 value
);
60 inline uint32
_GetUInt32(uint32 value
);
68 ResourceItem
* fInfoTableItem
;
75 ResourceFile::_GetInt16(int16 value
)
77 return (fHostEndianess
? value
: B_SWAP_INT16(value
));
83 ResourceFile::_GetUInt16(uint16 value
)
85 return (fHostEndianess
? value
: B_SWAP_INT16(value
));
91 ResourceFile::_GetInt32(int32 value
)
93 return (fHostEndianess
? value
: B_SWAP_INT32(value
));
99 ResourceFile::_GetUInt32(uint32 value
)
101 return (fHostEndianess
? value
: B_SWAP_INT32(value
));
105 #endif // RESOURCE_FILE_H