Resource provider for resources stored in files. More...
#include <SResProvider.h>
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. | |
IBitmapS * | LoadImage (LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE |
Loads an image resource as an IBitmapS object. | |
IImgX * | LoadImgX (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. | |
![]() | |
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. | |
![]() | |
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 |
从资源中加载光标 | |
IBitmapS * | LoadImage (LPCTSTR pszType, LPCTSTR pszResName) PURE |
从资源加载一个IBitmap对象 | |
IImgX * | LoadImgX (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 |
枚举资源文件,返回文件路径 | |
![]() | |
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 |
![]() | |
LONG | m_cRef |
Reference count. | |
Resource provider for resources stored in files.
Definition at line 232 of file SResProvider.h.
SResProviderFiles::SResProviderFiles | ( | ) |
Constructor.
Definition at line 353 of file SResProvider.cpp.
|
protected |
Enumerates files in a specified path.
pszPath | Path to the directory containing the files. |
funEnumCB | Callback function to process each file. |
lp | User-defined parameter passed to the callback function. |
Definition at line 501 of file SResProvider.cpp.
void SResProviderFiles::EnumFile | ( | EnumFileCallback | funEnumCB, |
LPARAM | lp ) |
Enumerates files in the resource provider.
funEnumCB | Callback function to process each file. |
lp | User-defined parameter passed to the callback function. |
Definition at line 496 of file SResProvider.cpp.
void SResProviderFiles::EnumResource | ( | EnumResCallback | funEnumCB, |
LPARAM | lp ) |
Enumerates resources of a specific type.
funEnumCB | Callback function to process each resource. |
lp | User-defined parameter passed to the callback function. |
Definition at line 485 of file SResProvider.cpp.
BOOL SResProviderFiles::GetRawBuffer | ( | LPCTSTR | pszType, |
LPCTSTR | pszResName, | ||
LPVOID | pBuf, | ||
size_t | size ) |
Retrieves the raw buffer for a resource.
pszType | Type of the resource. |
pszResName | Name of the resource. |
pBuf | Buffer to store the raw data. |
size | Size of the buffer. |
Definition at line 425 of file SResProvider.cpp.
size_t SResProviderFiles::GetRawBufferSize | ( | LPCTSTR | pszType, |
LPCTSTR | pszResName ) |
Retrieves the size of the raw buffer for a resource.
pszType | Type of the resource. |
pszResName | Name of the resource. |
Definition at line 417 of file SResProvider.cpp.
|
protected |
Retrieves the resource path for a given type and name.
strType | Type of the resource. |
pszResName | Name of the resource. |
Definition at line 357 of file SResProvider.cpp.
BOOL SResProviderFiles::HasResource | ( | LPCTSTR | pszType, |
LPCTSTR | pszResName ) |
Checks if a resource exists.
pszType | Type of the resource. |
pszResName | Name of the resource. |
Definition at line 479 of file SResProvider.cpp.
BOOL SResProviderFiles::Init | ( | WPARAM | wParam, |
LPARAM | lParam ) |
Initializes the resource provider.
wParam | Additional initialization parameter (wParam). |
lParam | Additional initialization parameter (lParam). |
Definition at line 433 of file SResProvider.cpp.
HBITMAP SResProviderFiles::LoadBitmap | ( | LPCTSTR | pszResName | ) |
Loads a bitmap resource.
pszResName | Name of the bitmap resource. |
Definition at line 377 of file SResProvider.cpp.
HCURSOR SResProviderFiles::LoadCursor | ( | LPCTSTR | pszResName | ) |
Loads a cursor resource.
pszResName | Name of the cursor resource. |
Definition at line 393 of file SResProvider.cpp.
HICON SResProviderFiles::LoadIcon | ( | LPCTSTR | pszResName, |
int | cx, | ||
int | cy ) |
Loads an icon resource.
pszResName | Name of the icon resource. |
cx | Desired width of the icon. |
cy | Desired height of the icon. |
Definition at line 385 of file SResProvider.cpp.
IBitmapS * SResProviderFiles::LoadImage | ( | LPCTSTR | pszType, |
LPCTSTR | pszResName ) |
Loads an image resource as an IBitmapS object.
pszType | Type of the resource. |
pszResName | Name of the resource. |
Definition at line 401 of file SResProvider.cpp.
IImgX * SResProviderFiles::LoadImgX | ( | LPCTSTR | pszType, |
LPCTSTR | pszResName ) |
Loads an image resource as an IImgX object.
pszType | Type of the resource. |
pszResName | Name of the resource. |
Definition at line 409 of file SResProvider.cpp.
|
protected |
Definition at line 344 of file SResProvider.h.
|
protected |
Definition at line 343 of file SResProvider.h.