📄 objreg.h
字号:
// ObjReg.h : interface and implementation of CObjRegistry class
//
/////////////////////////////////////////////////////////////////////////////
// Object registry is used for storing, runtime class information of the
// objects. Given the key or the class name, it queries and returns the Runtime Class
// to the client
// Written by : T. Kulathu Sarma
// This file is part of Singleton application to demonstrate the concept of Singleton classes.
// This file is provided "as is" with no expressed or implied warranty.
#ifndef _OBJ_REGISTRY
#define _OBJ_REGISTRY
class CObjRegistry
{
// Constructor
public :
CObjRegistry( CRuntimeClass * pRuntimeClass, LPCSTR lpszKey = NULL )
{
ASSERT( pRuntimeClass != NULL );
if( lpszKey == NULL )
{
GetRegistry().SetAt( pRuntimeClass->m_lpszClassName, pRuntimeClass );
}
else
{
GetRegistry().SetAt( lpszKey, pRuntimeClass );
}
}
// Static members, to operate on the registry
public :
static BOOL GetRuntimeClass( LPCSTR lpszKey, CRuntimeClass * & rpRuntimeClass )
{
return GetRegistry().Lookup( lpszKey, ( LPVOID & ) rpRuntimeClass );
}
static INT GetCount()
{
return GetRegistry().GetCount();
}
// Implementation - Method to return reference to Static Registry object
private :
static CMapStringToPtr & GetRegistry()
{
static CMapStringToPtr Registry;
return Registry;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -