Changes in src/UIElements/UIFactory.cpp [cc04b7:d7940e]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/UIFactory.cpp
rcc04b7 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 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.