soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SResProviderFiles Class Reference

Resource provider for resources stored in files. More...

#include <SResProvider.h>

Inheritance diagram for SResProviderFiles:
TObjRefImpl< IResProvider > IResProvider IObjRef

Public Member Functions

 SResProviderFiles ()
 Constructor.
 
BOOL Init (WPARAM wParam, LPARAM lParam) OVERRIDE
 Initializes the resource provider.
 
BOOL HasResource (LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
 Checks if a resource exists.
 
HICON LoadIcon (LPCTSTR pszResName, int cx, int cy) OVERRIDE
 Loads an icon resource.
 
HBITMAP LoadBitmap (LPCTSTR pszResName) OVERRIDE
 Loads a bitmap resource.
 
HCURSOR LoadCursor (LPCTSTR pszResName) OVERRIDE
 Loads a cursor resource.
 
IBitmapSLoadImage (LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
 Loads an image resource as an IBitmapS object.
 
IImgXLoadImgX (LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
 Loads an image resource as an IImgX object.
 
size_t GetRawBufferSize (LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
 Retrieves the size of the raw buffer for a resource.
 
BOOL GetRawBuffer (LPCTSTR pszType, LPCTSTR pszResName, LPVOID pBuf, size_t size) OVERRIDE
 Retrieves the raw buffer for a resource.
 
void EnumResource (EnumResCallback funEnumCB, LPARAM lp) OVERRIDE
 Enumerates resources of a specific type.
 
void EnumFile (EnumFileCallback funEnumCB, LPARAM lp) OVERRIDE
 Enumerates files in the resource provider.
 
- Public Member Functions inherited from TObjRefImpl< IResProvider >
 TObjRefImpl ()
 Constructor that initializes the reference count to 1.
 
virtual ~TObjRefImpl ()
 Virtual destructor.
 
long AddRef () override
 Increments the reference count.
 
long Release () override
 Decrements the reference count and deletes the object if the count reaches zero.
 
void OnFinalRelease () override
 Deletes the object.
 
- Public Member Functions inherited from IResProvider
long AddRef () PURE
 添加引用
 
long Release () PURE
 释放引用
 
void OnFinalRelease () PURE
 释放对象
 
BOOL Init (WPARAM wParam, LPARAM lParam) PURE
 资源初始化函数
 
BOOL HasResource (LPCTSTR pszType, LPCTSTR pszResName) PURE
 查询一个资源是否存在
 
HICON LoadIcon (LPCTSTR pszResName, int cx, int cy) PURE
 从资源中加载ICON
 
HBITMAP LoadBitmap (LPCTSTR pszResName) PURE
 从资源中加载HBITMAP
 
HCURSOR LoadCursor (LPCTSTR pszResName) PURE
 从资源中加载光标
 
IBitmapSLoadImage (LPCTSTR pszType, LPCTSTR pszResName) PURE
 从资源加载一个IBitmap对象
 
IImgXLoadImgX (LPCTSTR pszType, LPCTSTR pszResName) PURE
 从资源中创建一个IImgX对象
 
size_t GetRawBufferSize (LPCTSTR pszType, LPCTSTR pszResName) PURE
 获得资源数据大小
 
BOOL GetRawBuffer (LPCTSTR pszType, LPCTSTR pszResName, LPVOID pBuf, size_t size) PURE
 获得资源内存块
 
void EnumResource (EnumResCallback funEnumCB, LPARAM lp) PURE
 枚举资源
 
void EnumFile (EnumFileCallback funEnumCB, LPARAM lp) PURE
 枚举资源文件,返回文件路径
 
- Public Member Functions inherited from IObjRef
long AddRef () PURE
 Increases the reference count.
 
long Release () PURE
 Decreases the reference count.
 
void OnFinalRelease () PURE
 Called when the reference count reaches zero and the object is about to be released.
 

Protected Member Functions

void _EnumFile (LPCTSTR pszPath, EnumFileCallback funEnumCB, LPARAM lp)
 Enumerates files in a specified path.
 
SStringT GetRes (LPCTSTR strType, LPCTSTR pszResName)
 Retrieves the resource path for a given type and name.
 

Protected Attributes

SStringT m_strPath
 
SMap< SResID, SStringT > m_mapFiles
 
- Protected Attributes inherited from TObjRefImpl< IResProvider >
LONG m_cRef
 Reference count.
 

Detailed Description

Resource provider for resources stored in files.

Definition at line 232 of file SResProvider.h.

Constructor & Destructor Documentation

◆ SResProviderFiles()

SResProviderFiles::SResProviderFiles ( )

Constructor.

Definition at line 353 of file SResProvider.cpp.

Member Function Documentation

◆ _EnumFile()

void SResProviderFiles::_EnumFile ( LPCTSTR pszPath,
EnumFileCallback funEnumCB,
LPARAM lp )
protected

Enumerates files in a specified path.

Parameters
pszPathPath to the directory containing the files.
funEnumCBCallback function to process each file.
lpUser-defined parameter passed to the callback function.

Definition at line 501 of file SResProvider.cpp.

◆ EnumFile()

void SResProviderFiles::EnumFile ( EnumFileCallback funEnumCB,
LPARAM lp )

Enumerates files in the resource provider.

Parameters
funEnumCBCallback function to process each file.
lpUser-defined parameter passed to the callback function.

Definition at line 496 of file SResProvider.cpp.

◆ EnumResource()

void SResProviderFiles::EnumResource ( EnumResCallback funEnumCB,
LPARAM lp )

Enumerates resources of a specific type.

Parameters
funEnumCBCallback function to process each resource.
lpUser-defined parameter passed to the callback function.

Definition at line 485 of file SResProvider.cpp.

◆ GetRawBuffer()

BOOL SResProviderFiles::GetRawBuffer ( LPCTSTR pszType,
LPCTSTR pszResName,
LPVOID pBuf,
size_t size )

Retrieves the raw buffer for a resource.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
pBufBuffer to store the raw data.
sizeSize of the buffer.
Returns
TRUE if the raw buffer is successfully retrieved, FALSE otherwise.

Definition at line 425 of file SResProvider.cpp.

◆ GetRawBufferSize()

size_t SResProviderFiles::GetRawBufferSize ( LPCTSTR pszType,
LPCTSTR pszResName )

Retrieves the size of the raw buffer for a resource.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
Returns
Size of the raw buffer, or 0 if the resource does not exist.

Definition at line 417 of file SResProvider.cpp.

◆ GetRes()

SStringT SResProviderFiles::GetRes ( LPCTSTR strType,
LPCTSTR pszResName )
protected

Retrieves the resource path for a given type and name.

Parameters
strTypeType of the resource.
pszResNameName of the resource.
Returns
Full path to the resource file, or an empty string if not found.

Definition at line 357 of file SResProvider.cpp.

◆ HasResource()

BOOL SResProviderFiles::HasResource ( LPCTSTR pszType,
LPCTSTR pszResName )

Checks if a resource exists.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
Returns
TRUE if the resource exists, FALSE otherwise.

Definition at line 479 of file SResProvider.cpp.

◆ Init()

BOOL SResProviderFiles::Init ( WPARAM wParam,
LPARAM lParam )

Initializes the resource provider.

Parameters
wParamAdditional initialization parameter (wParam).
lParamAdditional initialization parameter (lParam).
Returns
TRUE if initialization is successful, FALSE otherwise.

Definition at line 433 of file SResProvider.cpp.

◆ LoadBitmap()

HBITMAP SResProviderFiles::LoadBitmap ( LPCTSTR pszResName)

Loads a bitmap resource.

Parameters
pszResNameName of the bitmap resource.
Returns
Handle to the loaded bitmap, or nullptr if loading fails.

Definition at line 377 of file SResProvider.cpp.

◆ LoadCursor()

HCURSOR SResProviderFiles::LoadCursor ( LPCTSTR pszResName)

Loads a cursor resource.

Parameters
pszResNameName of the cursor resource.
Returns
Handle to the loaded cursor, or nullptr if loading fails.

Definition at line 393 of file SResProvider.cpp.

◆ LoadIcon()

HICON SResProviderFiles::LoadIcon ( LPCTSTR pszResName,
int cx,
int cy )

Loads an icon resource.

Parameters
pszResNameName of the icon resource.
cxDesired width of the icon.
cyDesired height of the icon.
Returns
Handle to the loaded icon, or nullptr if loading fails.

Definition at line 385 of file SResProvider.cpp.

◆ LoadImage()

IBitmapS * SResProviderFiles::LoadImage ( LPCTSTR pszType,
LPCTSTR pszResName )

Loads an image resource as an IBitmapS object.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
Returns
Pointer to the loaded IBitmapS object, or nullptr if loading fails.

Definition at line 401 of file SResProvider.cpp.

◆ LoadImgX()

IImgX * SResProviderFiles::LoadImgX ( LPCTSTR pszType,
LPCTSTR pszResName )

Loads an image resource as an IImgX object.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
Returns
Pointer to the loaded IImgX object, or nullptr if loading fails.

Definition at line 409 of file SResProvider.cpp.

Member Data Documentation

◆ m_mapFiles

SMap<SResID, SStringT> SResProviderFiles::m_mapFiles
protected

Definition at line 344 of file SResProvider.h.

◆ m_strPath

SStringT SResProviderFiles::m_strPath
protected

Definition at line 343 of file SResProvider.h.


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