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

Resource Provider Manager. More...

#include <SResProviderMgr.h>

Inheritance diagram for SResProviderMgr:
SApplication

Public Member Functions

 SResProviderMgr (void)
 Constructor.
 
 ~SResProviderMgr (void)
 Destructor.
 
void AddResProvider (IResProvider *pResProvider, LPCTSTR pszUidef=_T("uidef:xml_init")) OVERRIDE
 Adds a resource provider with a specified UI definition.
 
void AddResProviderA (IResProvider *pResProvider, LPCSTR pszUidef="uidef:xml_init") OVERRIDE
 Adds a resource provider with a specified UI definition (ANSI version).
 
void RemoveResProvider (IResProvider *pResProvider) OVERRIDE
 Removes a resource provider.
 
void RemoveAll () OVERRIDE
 Removes all resource providers.
 
IResProviderGetHeadResProvider () SCONST OVERRIDE
 Retrieves the first resource provider in the list.
 
IResProviderGetTailResProvider () SCONST OVERRIDE
 Retrieves the last resource provider in the list.
 
void SetFilePrefix (LPCTSTR pszFilePrefix) OVERRIDE
 Sets the file prefix for resource paths.
 
BOOL HasResource (LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
 Checks if a resource exists.
 
HICON LoadIcon (LPCTSTR pszResName, int cx=0, int cy=0, BOOL bFromFile=FALSE) OVERRIDE
 Loads an icon resource.
 
HCURSOR LoadCursor (LPCTSTR pszResName, BOOL bFromFile=FALSE) OVERRIDE
 Loads a cursor resource.
 
HBITMAP LoadBitmap (LPCTSTR pszResName, BOOL bFromFile=FALSE) OVERRIDE
 Loads a bitmap 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.
 
IResProviderGetMatchResProvider (LPCTSTR pszType, LPCTSTR pszResName)
 Finds the resource provider that contains the specified resource type and name.
 
IBitmapSLoadImage2 (const SStringW &strImgID)
 Loads an image using a type:name formatted string.
 
HICON LoadIcon2 (const SStringW &strIconID)
 Loads an icon using a name:size formatted string.
 
BOOL LoadRawBuffer (LPCTSTR pszType, LPCTSTR pszResName, IResProvider *pResProvider, SAutoBuf &buf)
 Loads the raw buffer for a resource using a specified resource provider.
 

Protected Types

typedef SMap< SStringT, HCURSOR > CURSORMAP
 

Protected Member Functions

LPCTSTR SysCursorName2ID (LPCTSTR pszCursorName)
 Converts a system cursor name to its corresponding ID.
 
BOOL IsFileType (LPCTSTR pszType)
 Checks if the resource type is an external file.
 

Protected Attributes

SStringT m_strFilePrefix
 
SList< IResProvider * > m_lstResPackage
 
CURSORMAP m_mapCachedCursor
 
SCriticalSection m_cs
 

Detailed Description

Resource Provider Manager.

Manages multiple resource providers and provides methods to load and manage resources.

Definition at line 18 of file SResProviderMgr.h.

Member Typedef Documentation

◆ CURSORMAP

typedef SMap<SStringT, HCURSOR> SResProviderMgr::CURSORMAP
protected

Definition at line 207 of file SResProviderMgr.h.

Constructor & Destructor Documentation

◆ SResProviderMgr()

SResProviderMgr::SResProviderMgr ( void )

Constructor.

Definition at line 11 of file SResProviderMgr.cpp.

◆ ~SResProviderMgr()

SResProviderMgr::~SResProviderMgr ( void )

Destructor.

Definition at line 15 of file SResProviderMgr.cpp.

Member Function Documentation

◆ AddResProvider()

void SResProviderMgr::AddResProvider ( IResProvider * pResProvider,
LPCTSTR pszUidef = _T("uidef:xml_init") )

Adds a resource provider with a specified UI definition.

Parameters
pResProviderPointer to the resource provider to add.
pszUidefUI definition string (default is "uidef:xml_init").

Definition at line 63 of file SResProviderMgr.cpp.

◆ AddResProviderA()

void SResProviderMgr::AddResProviderA ( IResProvider * pResProvider,
LPCSTR pszUidef = "uidef:xml_init" )

Adds a resource provider with a specified UI definition (ANSI version).

Parameters
pResProviderPointer to the resource provider to add.
pszUidefUI definition string (default is "uidef:xml_init").

Definition at line 74 of file SResProviderMgr.cpp.

◆ GetHeadResProvider()

IResProvider * SResProviderMgr::GetHeadResProvider ( )

Retrieves the first resource provider in the list.

Returns
Pointer to the first resource provider, or nullptr if the list is empty.

Definition at line 99 of file SResProviderMgr.cpp.

◆ GetMatchResProvider()

IResProvider * SResProviderMgr::GetMatchResProvider ( LPCTSTR pszType,
LPCTSTR pszResName )

Finds the resource provider that contains the specified resource type and name.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
Returns
Pointer to the resource provider, or nullptr if not found.

Definition at line 45 of file SResProviderMgr.cpp.

◆ GetRawBuffer()

BOOL SResProviderMgr::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 128 of file SResProviderMgr.cpp.

◆ GetRawBufferSize()

size_t SResProviderMgr::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 159 of file SResProviderMgr.cpp.

◆ GetTailResProvider()

IResProvider * SResProviderMgr::GetTailResProvider ( )

Retrieves the last resource provider in the list.

Returns
Pointer to the last resource provider, or nullptr if the list is empty.

Definition at line 104 of file SResProviderMgr.cpp.

◆ HasResource()

BOOL SResProviderMgr::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 375 of file SResProviderMgr.cpp.

◆ IsFileType()

BOOL SResProviderMgr::IsFileType ( LPCTSTR pszType)
protected

Checks if the resource type is an external file.

Parameters
pszTypeType of the resource.
Returns
TRUE if the resource type is an external file, FALSE otherwise.

Definition at line 416 of file SResProviderMgr.cpp.

◆ LoadBitmap()

HBITMAP SResProviderMgr::LoadBitmap ( LPCTSTR pszResName,
BOOL bFromFile = FALSE )

Loads a bitmap resource.

Parameters
pszResNameName of the bitmap resource.
bFromFileTRUE if the resource should be loaded from a file, FALSE otherwise (default is FALSE).
Returns
Handle to the loaded bitmap, or nullptr if loading fails.

Definition at line 266 of file SResProviderMgr.cpp.

◆ LoadCursor()

HCURSOR SResProviderMgr::LoadCursor ( LPCTSTR pszResName,
BOOL bFromFile = FALSE )

Loads a cursor resource.

Parameters
pszResNameName of the cursor resource.
bFromFileTRUE if the resource should be loaded from a file, FALSE otherwise (default is FALSE).
Returns
Handle to the loaded cursor, or nullptr if loading fails.

Definition at line 295 of file SResProviderMgr.cpp.

◆ LoadIcon()

HICON SResProviderMgr::LoadIcon ( LPCTSTR pszResName,
int cx = 0,
int cy = 0,
BOOL bFromFile = FALSE )

Loads an icon resource.

Parameters
pszResNameName of the icon resource.
cxDesired width of the icon (default is 0).
cyDesired height of the icon (default is 0).
bFromFileTRUE if the resource should be loaded from a file, FALSE otherwise (default is FALSE).
Returns
Handle to the loaded icon, or nullptr if loading fails.

Definition at line 347 of file SResProviderMgr.cpp.

◆ LoadIcon2()

HICON SResProviderMgr::LoadIcon2 ( const SStringW & strIconID)

Loads an icon using a name:size formatted string.

Parameters
strIconIDName:size formatted string.
Returns
Handle to the loaded icon, or nullptr if loading fails.

Definition at line 400 of file SResProviderMgr.cpp.

◆ LoadImage()

IBitmapS * SResProviderMgr::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 225 of file SResProviderMgr.cpp.

◆ LoadImage2()

IBitmapS * SResProviderMgr::LoadImage2 ( const SStringW & strImgID)

Loads an image using a type:name formatted string.

Parameters
strImgIDType:name formatted string.
Returns
Pointer to the loaded IBitmapS object, or nullptr if loading fails.

Definition at line 389 of file SResProviderMgr.cpp.

◆ LoadImgX()

IImgX * SResProviderMgr::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 191 of file SResProviderMgr.cpp.

◆ LoadRawBuffer()

BOOL SResProviderMgr::LoadRawBuffer ( LPCTSTR pszType,
LPCTSTR pszResName,
IResProvider * pResProvider,
SAutoBuf & buf )

Loads the raw buffer for a resource using a specified resource provider.

Parameters
pszTypeType of the resource.
pszResNameName of the resource.
pResProviderPointer to the resource provider.
bufBuffer to store the raw data.
Returns
TRUE if the raw buffer is successfully loaded, FALSE otherwise.

Definition at line 446 of file SResProviderMgr.cpp.

◆ RemoveAll()

void SResProviderMgr::RemoveAll ( )

Removes all resource providers.

Definition at line 20 of file SResProviderMgr.cpp.

◆ RemoveResProvider()

void SResProviderMgr::RemoveResProvider ( IResProvider * pResProvider)

Removes a resource provider.

Parameters
pResProviderPointer to the resource provider to remove.

Definition at line 82 of file SResProviderMgr.cpp.

◆ SetFilePrefix()

void SResProviderMgr::SetFilePrefix ( LPCTSTR pszFilePrefix)

Sets the file prefix for resource paths.

Parameters
pszFilePrefixFile prefix to set.

Definition at line 438 of file SResProviderMgr.cpp.

◆ SysCursorName2ID()

LPCTSTR SResProviderMgr::SysCursorName2ID ( LPCTSTR pszCursorName)
protected

Converts a system cursor name to its corresponding ID.

Parameters
pszCursorNameName of the system cursor.
Returns
ID of the system cursor.

Definition at line 109 of file SResProviderMgr.cpp.

Member Data Documentation

◆ m_cs

SCriticalSection SResProviderMgr::m_cs
protected

Definition at line 210 of file SResProviderMgr.h.

◆ m_lstResPackage

SList<IResProvider *> SResProviderMgr::m_lstResPackage
protected

Definition at line 205 of file SResProviderMgr.h.

◆ m_mapCachedCursor

CURSORMAP SResProviderMgr::m_mapCachedCursor
protected

Definition at line 208 of file SResProviderMgr.h.

◆ m_strFilePrefix

SStringT SResProviderMgr::m_strFilePrefix
protected

Definition at line 204 of file SResProviderMgr.h.


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