14#ifndef __SOBJECTFACTORY__H__ 
   15#define __SOBJECTFACTORY__H__ 
   17#include <core/SCmnMap.h> 
   18#include <helper/obj-ref-impl.hpp> 
   19#include <interface/SObjFactory-i.h> 
   30SOUI_EXP SObjectInfo 
ObjInfo_New(LPCWSTR name, 
int type, LPCWSTR alise = NULL);
 
   46class CElementTraits<SObjectInfo> : 
public CElementTraitsBase<SObjectInfo> {
 
   53    static ULONG 
Hash(INARGTYPE objInfo)
 
   55        ULONG uRet = CElementTraits<SStringW>::Hash(objInfo.szName);
 
   56        uRet = (uRet << 5) + objInfo.nType;
 
 
   68        return obj1.nType == obj2.nType && _wcsicmp(obj1.szName, obj2.szName) == 0;
 
 
 
  103        return T::BaseClassName();
 
 
  119    STDMETHOD_(IObjectFactory *, 
Clone)(CTHIS) SCONST OVERRIDE
 
 
  130        return ObjInfo_New(T::GetClassName(), T::GetClassType(), T::GetClassAlise());
 
 
 
  134typedef IObjectFactory *SObjectFactoryPtr;
 
  155    BOOL 
RegisterFactory(
const IObjectFactory *objFactory, BOOL bReplace = 
false);
 
  206    virtual IObject *CreateObject(
const SObjectInfo &objInfo) 
const;
 
  213    virtual IObject *OnCreateUnknownObject(
const SObjectInfo &objInfo) 
const;
 
  219    static void OnFactoryRemoved(
const SObjectFactoryPtr &obj);
 
 
SOUI_EXP BOOL ObjInfo_IsValid(const SObjectInfo *pObjInfo)
Checks if the object information is valid.
SNSBEGIN SOUI_EXP SObjectInfo ObjInfo_New(LPCWSTR name, int type, LPCWSTR alise=NULL)
Creates a new object information structure.
static bool CompareElements(INARGTYPE obj1, INARGTYPE obj2)
Compares two SObjectInfo structures.
static ULONG Hash(INARGTYPE objInfo)
Computes the hash value for an SObjectInfo.
SCmnMap(void(*funOnKeyRemoved)(const SObjectFactoryPtr &)=NULL)
SObjectFactoryMgr(void)
Constructor for SObjectFactoryMgr.
BOOL UnregisterFactory(const SObjectInfo &objInfo)
Unregisters an object factory.
BOOL TplUnregisterFactory()
Template method to unregister a factory for a specific object type.
BOOL TplRegisterFactory()
Template method to register a factory for a specific object type.
BOOL RegisterFactory(const IObjectFactory *objFactory, BOOL bReplace=false)
Registers an object factory.
SObjectInfo BaseObjectInfoFromObjectInfo(const SObjectInfo &objInfo)
Gets the base object information from a given object information.
void SetSwndDefAttr(IObject *pObject) const
Sets default attributes for a given object.
Template-based object factory.
IObject * NewObject() SCONST OVERRIDE
Creates a new object of type T.
TplSObjectFactory()
Default constructor.
void OnFinalRelease()
Called when the final reference is released.
IObjectFactory * Clone() SCONST OVERRIDE
Clones the object factory.
LPCWSTR BaseClassName() SCONST OVERRIDE
Gets the base class name of the object.
SObjectInfo GetObjectInfo() SCONST OVERRIDE
Gets the object information for the factory.