Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIWindowFactoryManager.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIWindowFactoryManager.h
00003         created:        22/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines interface for WindowFactoryManager class
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIWindowFactoryManager_h_
00027 #define _CEGUIWindowFactoryManager_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include "CEGUISingleton.h"
00032 #include "CEGUILogger.h"
00033 #include "CEGUIIteratorBase.h"
00034 #include <map>
00035 #include <vector>
00036 
00037 #if defined(_MSC_VER)
00038 #       pragma warning(push)
00039 #       pragma warning(disable : 4275)
00040 #       pragma warning(disable : 4251)
00041 #endif
00042 
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00051 class CEGUIBASE_API WindowFactoryManager : public Singleton<WindowFactoryManager>
00052 {
00053 public:
00054         /*************************************************************************
00055                 Class used to track active alias targets
00056         *************************************************************************/
00057         class CEGUIBASE_API AliasTargetStack
00058         {
00059         public:
00064                 AliasTargetStack(void) {}
00065 
00066 
00071                 ~AliasTargetStack(void) {}
00072 
00073 
00081                 const String&   getActiveTarget(void) const;
00082 
00090                 uint    getStackedTargetCount(void) const;
00091 
00092 
00093         private:
00094                 friend class WindowFactoryManager;
00095                 typedef std::vector<String>     TargetTypeStack;                
00096 
00097                 TargetTypeStack d_targetStack;          
00098         };
00099 
00100 
00101         /*************************************************************************
00102                 Construction and Destruction
00103         *************************************************************************/
00108         WindowFactoryManager(void)
00109         {
00110                 Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton created");
00111         }
00112 
00113 
00118         ~WindowFactoryManager(void)
00119         {
00120                 Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton destroyed");
00121         }
00122 
00123 
00124         /*************************************************************************
00125                 Public Interface
00126         *************************************************************************/
00134         static  WindowFactoryManager&   getSingleton(void);
00135 
00136 
00144         static  WindowFactoryManager*   getSingletonPtr(void);
00145 
00146 
00160         void    addFactory(WindowFactory* factory);
00161 
00162 
00177         void    removeFactory(const String& name);
00178 
00179 
00194         void    removeFactory(WindowFactory* factory);
00195 
00196 
00204         void    removeAllFactories(void)                {d_factoryRegistry.clear();}
00205 
00206 
00219         WindowFactory*  getFactory(const String& type) const;
00220 
00221 
00232         bool    isFactoryPresent(const String& name) const;
00233 
00234 
00260         void    addWindowTypeAlias(const String& aliasName, const String& targetType);
00261 
00262 
00280         void    removeWindowTypeAlias(const String& aliasName, const String& targetType);
00281 
00282 
00283 private:
00284         /*************************************************************************
00285                 Implementation Data
00286         *************************************************************************/
00287         typedef std::map<String, WindowFactory*>        WindowFactoryRegistry;          
00288         typedef std::map<String, AliasTargetStack>      TypeAliasRegistry;              
00289 
00290         WindowFactoryRegistry   d_factoryRegistry;                      
00291         TypeAliasRegistry               d_aliasRegistry;                        
00292 
00293 public:
00294         /*************************************************************************
00295                 Iterator stuff
00296         *************************************************************************/
00297         typedef ConstBaseIterator<WindowFactoryRegistry>        WindowFactoryIterator;
00298         typedef ConstBaseIterator<TypeAliasRegistry>            TypeAliasIterator;
00299 
00304         WindowFactoryIterator   getIterator(void) const;
00305 
00306 
00311         TypeAliasIterator       getAliasIterator(void) const;
00312 };
00313 
00314 } // End of  CEGUI namespace section
00315 
00316 
00317 #if defined(_MSC_VER)
00318 #       pragma warning(pop)
00319 #endif
00320 
00321 #endif  // end of guard _CEGUIWindowFactoryManager_h_

Generated on Wed Feb 16 12:41:08 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1