Changeset 4fc41a for molecuilder/src/UIElements/UIFactory.cpp
- Timestamp:
- Mar 11, 2010, 10:37:32 AM (15 years ago)
- Children:
- ff1812
- Parents:
- 4c60ef
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/UIElements/UIFactory.cpp
r4c60ef r4fc41a 8 8 9 9 #include <cassert> 10 #include "Patterns/Singleton_impl.hpp" 10 11 #include "UIElements/UIFactory.hpp" 11 12 12 13 // all factories that can be used: 13 14 #include "UIElements/TextUIFactory.hpp" 14 15 UIFactory *UIFactory::theFactory = 0;16 15 17 16 UIFactory::UIFactory() … … 27 26 28 27 void UIFactory::makeUserInterface(InterfaceTypes type) { 29 assert(theFactory == 0 && "makeUserInterface should only be called once");30 28 switch(type) { 31 29 case Text : 32 theFactory = new TextUIFactory();30 setInstance(new TextUIFactory()); 33 31 break; 34 32 … … 39 37 } 40 38 41 UIFactory* UIFactory::get(){ 42 assert(theFactory != 0 && "No UserInterface created prior to factory access"); 43 return theFactory; 44 } 45 46 47 void UIFactory::purgeInstance(){ 48 if(theFactory) { 49 delete theFactory; 50 theFactory = 0; 51 } 52 } 39 CONSTRUCT_SINGLETON(UIFactory)
Note:
See TracChangeset
for help on using the changeset viewer.