Changes in src/UIElements/UIFactory.cpp [d7940e:9fe36b]
- File:
-
- 1 edited
-
src/UIElements/UIFactory.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/UIFactory.cpp
rd7940e r9fe36b 8 8 9 9 #include <cassert> 10 #include "Patterns/Singleton_impl.hpp"11 10 #include "UIElements/UIFactory.hpp" 12 11 13 12 // all factories that can be used: 14 13 #include "UIElements/TextUIFactory.hpp" 14 #ifdef USE_GUI_QT 15 #include "UIElements/QT4/QTUIFactory.hpp" 16 #endif 17 18 UIFactory *UIFactory::theFactory = 0; 15 19 16 20 UIFactory::UIFactory() … … 26 30 27 31 void UIFactory::makeUserInterface(InterfaceTypes type) { 32 assert(theFactory == 0 && "makeUserInterface should only be called once"); 28 33 switch(type) { 29 34 case Text : 30 setInstance(new TextUIFactory());35 theFactory = new TextUIFactory(); 31 36 break; 32 37 #ifdef USE_GUI_QT 38 case QT4 : 39 theFactory = new QTUIFactory(); 40 break; 41 #endif 33 42 default: 34 43 assert(0 && "No such Factory in stock"); … … 37 46 } 38 47 39 CONSTRUCT_SINGLETON(UIFactory) 48 UIFactory* UIFactory::get(){ 49 assert(theFactory != 0 && "No UserInterface created prior to factory access"); 50 return theFactory; 51 } 52 53 54 void UIFactory::purgeInstance(){ 55 if(theFactory) { 56 delete theFactory; 57 theFactory = 0; 58 } 59 }
Note:
See TracChangeset
for help on using the changeset viewer.
