Changes in src/UIElements/UIFactory.cpp [9fe36b:d7940e]
- File:
-
- 1 edited
-
src/UIElements/UIFactory.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/UIFactory.cpp
r9fe36b rd7940e 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 #ifdef USE_GUI_QT15 #include "UIElements/QT4/QTUIFactory.hpp"16 #endif17 18 UIFactory *UIFactory::theFactory = 0;19 15 20 16 UIFactory::UIFactory() … … 30 26 31 27 void UIFactory::makeUserInterface(InterfaceTypes type) { 32 assert(theFactory == 0 && "makeUserInterface should only be called once");33 28 switch(type) { 34 29 case Text : 35 theFactory = new TextUIFactory();30 setInstance(new TextUIFactory()); 36 31 break; 37 #ifdef USE_GUI_QT 38 case QT4 : 39 theFactory = new QTUIFactory(); 40 break; 41 #endif 32 42 33 default: 43 34 assert(0 && "No such Factory in stock"); … … 46 37 } 47 38 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 } 39 CONSTRUCT_SINGLETON(UIFactory)
Note:
See TracChangeset
for help on using the changeset viewer.
