paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/factory pgfactory.cpp,1.1,1.2


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/factory pgfactory.cpp,1.1,1.2
Date: Wed, 26 Jun 2002 07:22:20 -0400

Update of /cvsroot/paragui/paragui/src/factory
In directory subversions:/tmp/cvs-serv8693/src/factory

Modified Files:
        pgfactory.cpp 
Log Message:
basic factory stuff



Index: pgfactory.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/factory/pgfactory.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** pgfactory.cpp       25 Jun 2002 20:38:42 -0000      1.1
--- pgfactory.cpp       26 Jun 2002 11:22:17 -0000      1.2
***************
*** 1,7 ****
--- 1,24 ----
+ #include <map>
  #include "pgfactory.h"
  
+ static std::map<std::string, PG_Factory::CREATEFN> creator_map;
+ 
  PG_FactoryBaseObject::PG_FactoryBaseObject() {
  }
        
  PG_FactoryBaseObject::~PG_FactoryBaseObject() {
+ }
+ 
+ void PG_Factory::RegisterCreateFn(const std::string& classname, CREATEFN fn) {
+               creator_map[classname] = fn;
+ }
+ 
+ PG_Widget* PG_Factory::CreateObject(const std::string& classname, PG_Widget* 
parent) {
+       CREATEFN create = creator_map[classname];
+       
+       if(create == NULL) {
+               return NULL;
+       }
+       
+       return create(parent);
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]