CEGUIWindowFactoryManager.h

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 CEGUIEXPORT WindowFactoryManager : public Singleton<WindowFactoryManager>
00052 {
00053 public:
00058     struct CEGUIEXPORT FalagardWindowMapping
00059     {
00060         String  d_windowType;
00061         String  d_lookName;
00062         String  d_baseType;
00063     };
00064 
00069         class CEGUIEXPORT AliasTargetStack
00070         {
00071         public:
00076                 AliasTargetStack(void) {}
00077 
00078 
00083                 ~AliasTargetStack(void) {}
00084 
00085 
00093                 const String&   getActiveTarget(void) const;
00094 
00102                 uint    getStackedTargetCount(void) const;
00103 
00104 
00105         private:
00106                 friend class WindowFactoryManager;
00107                 typedef std::vector<String>     TargetTypeStack;                
00108 
00109                 TargetTypeStack d_targetStack;          
00110         };
00111 
00112 
00113         /*************************************************************************
00114                 Construction and Destruction
00115         *************************************************************************/
00120         WindowFactoryManager(void)
00121         {
00122                 Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton created");
00123         }
00124 
00125 
00130         ~WindowFactoryManager(void)
00131         {
00132                 Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton destroyed");
00133         }
00134 
00135 
00136         /*************************************************************************
00137                 Public Interface
00138         *************************************************************************/
00146         static  WindowFactoryManager&   getSingleton(void);
00147 
00148 
00156         static  WindowFactoryManager*   getSingletonPtr(void);
00157 
00158 
00172         void    addFactory(WindowFactory* factory);
00173 
00174 
00189         void    removeFactory(const String& name);
00190 
00191 
00206         void    removeFactory(WindowFactory* factory);
00207 
00208 
00216         void    removeAllFactories(void)                {d_factoryRegistry.clear();}
00217 
00218 
00231         WindowFactory*  getFactory(const String& type) const;
00232 
00233 
00248     bool        isFactoryPresent(const String& name) const;
00249 
00250 
00276         void    addWindowTypeAlias(const String& aliasName, const String& targetType);
00277 
00278 
00296         void    removeWindowTypeAlias(const String& aliasName, const String& targetType);
00297 
00323     void addFalagardWindowMapping(const String& newType, const String& targetType, const String& lookName);
00324 
00332     void removeFalagardWindowMapping(const String& type);
00333 
00345     bool isFalagardMappedType(const String& type) const;
00346 
00359     const String& getMappedLookForType(const String& type) const;
00360 
00361 
00380     String getDereferencedAliasType(const String& type) const;
00381 
00382 private:
00383         /*************************************************************************
00384                 Implementation Data
00385         *************************************************************************/
00386         typedef std::map<String, WindowFactory*>        WindowFactoryRegistry;          
00387         typedef std::map<String, AliasTargetStack>      TypeAliasRegistry;              
00388     typedef std::map<String, FalagardWindowMapping> FalagardMapRegistry;    
00389 
00390         WindowFactoryRegistry   d_factoryRegistry;                      
00391         TypeAliasRegistry               d_aliasRegistry;                        
00392     FalagardMapRegistry     d_falagardRegistry;         
00393 
00394 public:
00395         /*************************************************************************
00396                 Iterator stuff
00397         *************************************************************************/
00398         typedef ConstBaseIterator<WindowFactoryRegistry>        WindowFactoryIterator;
00399         typedef ConstBaseIterator<TypeAliasRegistry>            TypeAliasIterator;
00400     typedef ConstBaseIterator<FalagardMapRegistry>      FalagardMappingIterator;
00401 
00406         WindowFactoryIterator   getIterator(void) const;
00407 
00408 
00413         TypeAliasIterator       getAliasIterator(void) const;
00414 
00415 
00420     FalagardMappingIterator getFalagardMappingIterator() const;
00421 };
00422 
00423 } // End of  CEGUI namespace section
00424 
00425 
00426 #if defined(_MSC_VER)
00427 #       pragma warning(pop)
00428 #endif
00429 
00430 #endif  // end of guard _CEGUIWindowFactoryManager_h_

Generated on Sat Nov 26 09:34:49 2005 for Crazy Eddies GUI System by  doxygen 1.4.5