Changes in src/UIElements/UIFactory.cpp [d7940e:cc04b7]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/UIFactory.cpp
rd7940e rcc04b7 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 15 UIFactory *UIFactory::theFactory = 0; 15 16 16 17 UIFactory::UIFactory() … … 26 27 27 28 void UIFactory::makeUserInterface(InterfaceTypes type) { 29 assert(theFactory == 0 && "makeUserInterface should only be called once"); 28 30 switch(type) { 29 31 case Text : 30 setInstance(new TextUIFactory());32 theFactory = new TextUIFactory(); 31 33 break; 32 34 … … 37 39 } 38 40 39 CONSTRUCT_SINGLETON(UIFactory) 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 }
Note:
See TracChangeset
for help on using the changeset viewer.