xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Common::PEResources Class Reference

A class able to load resources from a Windows Portable Executable, such as cursors, bitmaps, and sounds. More...

#include <pe_exe.h>

Inheritance diagram for Common::PEResources:
Inheritance graph
[legend]
Collaboration diagram for Common::PEResources:
Collaboration graph
[legend]

Classes

struct  Resource
 
struct  Section
 

Public Member Functions

 PEResources (SeekableReadStream *exe)
 
 ~PEResources ()
 
const std::vector< PEResourceIDgetTypeList () const
 Return a list of resource types. More...
 
const std::vector< PEResourceIDgetNameList (const PEResourceID &type) const
 Return a list of names for a given type. More...
 
const std::vector< PEResourceIDgetLangList (const PEResourceID &type, const PEResourceID &name) const
 Return a list of languages for a given type and name. More...
 
SeekableReadStreamgetResource (const PEResourceID &type, const PEResourceID &name)
 Return a stream to the specified resource, taking the first language found (or 0 if non-existent). More...
 
SeekableReadStreamgetResource (const PEResourceID &type, const PEResourceID &name, const PEResourceID &lang)
 Return a stream to the specified resource (or 0 if non-existent). More...
 

Private Types

typedef std::map< PEResourceID, ResourceLangMap
 
typedef std::map< PEResourceID, LangMapNameMap
 
typedef std::map< PEResourceID, NameMapTypeMap
 

Private Member Functions

bool loadFromEXE (SeekableReadStream &exe)
 
void parseResourceLevel (SeekableReadStream &exe, Section &section, uint32 offset, int level)
 

Private Attributes

std::map< UString, Section_sections
 
ScopedPtr< SeekableReadStream_exe
 
PEResourceID _curType
 
PEResourceID _curName
 
PEResourceID _curLang
 
TypeMap _resources
 

Detailed Description

A class able to load resources from a Windows Portable Executable, such as cursors, bitmaps, and sounds.

Definition at line 102 of file pe_exe.h.

Member Typedef Documentation

◆ LangMap

Definition at line 135 of file pe_exe.h.

◆ NameMap

Definition at line 136 of file pe_exe.h.

◆ TypeMap

Definition at line 137 of file pe_exe.h.

Constructor & Destructor Documentation

◆ PEResources()

Common::PEResources::PEResources ( SeekableReadStream exe)

Definition at line 104 of file pe_exe.cpp.

References _exe, and loadFromEXE().

Here is the call graph for this function:

◆ ~PEResources()

Common::PEResources::~PEResources ( )

Definition at line 111 of file pe_exe.cpp.

Member Function Documentation

◆ getLangList()

const std::vector< PEResourceID > Common::PEResources::getLangList ( const PEResourceID type,
const PEResourceID name 
) const

Return a list of languages for a given type and name.

Definition at line 244 of file pe_exe.cpp.

References _resources.

Referenced by getResource().

Here is the caller graph for this function:

◆ getNameList()

const std::vector< PEResourceID > Common::PEResources::getNameList ( const PEResourceID type) const

Return a list of names for a given type.

Definition at line 230 of file pe_exe.cpp.

References _resources.

◆ getResource() [1/2]

SeekableReadStream * Common::PEResources::getResource ( const PEResourceID type,
const PEResourceID name 
)

Return a stream to the specified resource, taking the first language found (or 0 if non-existent).

Definition at line 263 of file pe_exe.cpp.

References _exe, _resources, getLangList(), Common::PEResources::Resource::offset, and Common::PEResources::Resource::size.

Here is the call graph for this function:

◆ getResource() [2/2]

SeekableReadStream * Common::PEResources::getResource ( const PEResourceID type,
const PEResourceID name,
const PEResourceID lang 
)

Return a stream to the specified resource (or 0 if non-existent).

Definition at line 274 of file pe_exe.cpp.

References _exe, _resources, Common::PEResources::Resource::offset, and Common::PEResources::Resource::size.

◆ getTypeList()

const std::vector< PEResourceID > Common::PEResources::getTypeList ( ) const

Return a list of resource types.

Definition at line 221 of file pe_exe.cpp.

References _resources.

◆ loadFromEXE()

bool Common::PEResources::loadFromEXE ( SeekableReadStream exe)
private

◆ parseResourceLevel()

void Common::PEResources::parseResourceLevel ( SeekableReadStream exe,
Section section,
uint32  offset,
int  level 
)
private

Member Data Documentation

◆ _curLang

PEResourceID Common::PEResources::_curLang
private

Definition at line 146 of file pe_exe.h.

Referenced by parseResourceLevel().

◆ _curName

PEResourceID Common::PEResources::_curName
private

Definition at line 145 of file pe_exe.h.

Referenced by parseResourceLevel().

◆ _curType

PEResourceID Common::PEResources::_curType
private

Definition at line 144 of file pe_exe.h.

Referenced by parseResourceLevel().

◆ _exe

ScopedPtr<SeekableReadStream> Common::PEResources::_exe
private

Definition at line 142 of file pe_exe.h.

Referenced by getResource(), and PEResources().

◆ _resources

TypeMap Common::PEResources::_resources
private

Definition at line 148 of file pe_exe.h.

Referenced by getLangList(), getNameList(), getResource(), getTypeList(), and parseResourceLevel().

◆ _sections

std::map<UString, Section> Common::PEResources::_sections
private

Definition at line 139 of file pe_exe.h.

Referenced by loadFromEXE().


The documentation for this class was generated from the following files: