[xplc-cvs] xplc/tests testobj.cpp,1.11,1.12
Cross-platform lightweight components
Status: Alpha
Brought to you by:
pphaneuf
From: <pph...@us...> - 2004-02-07 00:13:19
|
Update of /cvsroot/xplc/xplc/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19664/tests Modified Files: testobj.cpp Log Message: Changed the module loader some more... Index: testobj.cpp =================================================================== RCS file: /cvsroot/xplc/xplc/tests/testobj.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testobj.cpp 31 Dec 2003 18:44:17 -0000 1.11 --- testobj.cpp 7 Feb 2004 00:10:32 -0000 1.12 *************** *** 51,79 **** } ! static IModule* module = 0; ! class TestModule: public IModule { ! IMPLEMENT_IOBJECT(TestModule); ! private: ! TestComponent* component; ! public: ! TestModule(): component(0) {} ! virtual ~TestModule() { ! module = 0; ! if(component) ! component->release(); ! } ! virtual IObject* getObject(const UUID& uuid) { ! if(!component) ! component = TestComponent::create(); ! if(uuid == TestComponent_CID) { ! component->addRef(); ! return component; ! } ! return 0; ! } ! }; UUID_MAP_BEGIN(TestComponent) --- 51,65 ---- } ! static IObject* factory() { ! static TestComponent* component = 0; ! if(!component) ! component = TestComponent::create(); ! if(component) ! component->addRef(); ! return component; ! } UUID_MAP_BEGIN(TestComponent) *************** *** 82,93 **** UUID_MAP_END ! UUID_MAP_BEGIN(TestModule) ! UUID_MAP_ENTRY(IObject) ! UUID_MAP_ENTRY(IModule) ! UUID_MAP_END const XPLC_ModuleInfo XPLC_Module = { ! XPLC_MODULE_VERSION, ! new TestModule }; --- 68,84 ---- UUID_MAP_END ! const XPLC_ComponentEntry components[] = { ! { TestComponent_CID, &factory }, ! { UUID_null, 0 } ! }; const XPLC_ModuleInfo XPLC_Module = { ! XPLC_MODULE_MAGIC, ! XPLC_MODULE_VERSION_MAJOR, ! XPLC_MODULE_VERSION_MINOR, ! "Test Module", ! components, ! 0, ! 0 }; |