[692] | 1 | /************************************************************************
|
---|
| 2 | filename: CEGUIConfig_xmlHandler.h
|
---|
| 3 | created: 17/7/2004
|
---|
| 4 | author: Paul D Turner
|
---|
| 5 |
|
---|
| 6 | purpose: Interface to configuration file parser
|
---|
| 7 | *************************************************************************/
|
---|
| 8 | /*************************************************************************
|
---|
| 9 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
| 10 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
| 11 |
|
---|
| 12 | This library is free software; you can redistribute it and/or
|
---|
| 13 | modify it under the terms of the GNU Lesser General Public
|
---|
| 14 | License as published by the Free Software Foundation; either
|
---|
| 15 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 16 |
|
---|
| 17 | This library is distributed in the hope that it will be useful,
|
---|
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | Lesser General Public License for more details.
|
---|
| 21 |
|
---|
| 22 | You should have received a copy of the GNU Lesser General Public
|
---|
| 23 | License along with this library; if not, write to the Free Software
|
---|
| 24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 25 | *************************************************************************/
|
---|
| 26 | #ifndef _CEGUIConfig_xmlHandler_h_
|
---|
| 27 | #define _CEGUIConfig_xmlHandler_h_
|
---|
| 28 |
|
---|
| 29 | #include "CEGUIBase.h"
|
---|
| 30 | #include "CEGUIString.h"
|
---|
| 31 | #include "CEGUILogger.h"
|
---|
| 32 | #include "CEGUIXMLHandler.h"
|
---|
| 33 |
|
---|
| 34 | #include <vector>
|
---|
| 35 |
|
---|
| 36 | // Start of CEGUI namespace section
|
---|
| 37 | namespace CEGUI
|
---|
| 38 | {
|
---|
| 39 | /*!
|
---|
| 40 | \brief
|
---|
| 41 | Handler class used to parse the Configuration XML file.
|
---|
| 42 | */
|
---|
| 43 | class Config_xmlHandler : public XMLHandler
|
---|
| 44 | {
|
---|
| 45 | public:
|
---|
| 46 | /*************************************************************************
|
---|
| 47 | Construction & Destruction
|
---|
| 48 | *************************************************************************/
|
---|
| 49 | /*!
|
---|
| 50 | \brief
|
---|
| 51 | Constructor for GUILayout_xmlHandler objects
|
---|
| 52 | */
|
---|
| 53 | Config_xmlHandler(void) {}
|
---|
| 54 |
|
---|
| 55 | /*!
|
---|
| 56 | \brief
|
---|
| 57 | Destructor for GUILayout_xmlHandler objects
|
---|
| 58 | */
|
---|
| 59 | virtual ~Config_xmlHandler(void) {}
|
---|
| 60 |
|
---|
| 61 | /*************************************************************************
|
---|
| 62 | SAX2 Handler overrides
|
---|
| 63 | *************************************************************************/
|
---|
| 64 | /*!
|
---|
| 65 | \brief
|
---|
| 66 | document processing (only care about elements, schema validates format)
|
---|
| 67 | */
|
---|
| 68 | virtual void elementStart(const String& element, const XMLAttributes& attributes);
|
---|
| 69 |
|
---|
| 70 | /*************************************************************************
|
---|
| 71 | Functions used by our implementation
|
---|
| 72 | *************************************************************************/
|
---|
| 73 | /*!
|
---|
| 74 | \brief
|
---|
| 75 | Return log filename
|
---|
| 76 | */
|
---|
| 77 | const String& getLogFilename(void) const {return d_logFilename;}
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | /*!
|
---|
| 81 | \brief
|
---|
| 82 | Return initial scheme filename to load
|
---|
| 83 | */
|
---|
| 84 | const String& getSchemeFilename(void) const {return d_schemeFilename;}
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | /*!
|
---|
| 88 | \brief
|
---|
| 89 | Return initial layout filename to load and set as the GUI sheet.
|
---|
| 90 | */
|
---|
| 91 | const String& getLayoutFilename(void) const {return d_layoutFilename;}
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | /*!
|
---|
| 95 | \brief
|
---|
| 96 | Return the name of the initialisation script to run
|
---|
| 97 | */
|
---|
| 98 | const String& getInitScriptFilename(void) const {return d_initScriptFilename;}
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | /*!
|
---|
| 102 | \brief
|
---|
| 103 | Return the name of the termination script to run
|
---|
| 104 | */
|
---|
| 105 | const String& getTermScriptFilename(void) const {return d_termScriptFilename;}
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | /*!
|
---|
| 109 | \brief
|
---|
| 110 | Return name of font to use as default.
|
---|
| 111 | */
|
---|
| 112 | const String& getDefaultFontName(void) const {return d_defaultFontName;}
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | /*!
|
---|
| 116 | \brief
|
---|
| 117 | Return name of default resource group.
|
---|
| 118 | */
|
---|
| 119 | const String& getDefaultResourceGroup(void) const {return d_defaultResourceGroup;}
|
---|
| 120 |
|
---|
| 121 | /*!
|
---|
| 122 | \brief
|
---|
| 123 | Return logging level which was read from the config file.
|
---|
| 124 | */
|
---|
| 125 | LoggingLevel getLoggingLevel(void) const {return d_logLevel;}
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 | private:
|
---|
| 129 | /*************************************************************************
|
---|
| 130 | Implementation Constants
|
---|
| 131 | *************************************************************************/
|
---|
| 132 | static const String CEGUIConfigElement; //!< Tag name for CEGUIConfig elements.
|
---|
| 133 | static const char ConfigLogfileAttribute[]; //!< Attribute name that stores the filename to use for the log.
|
---|
| 134 | static const char ConfigSchemeAttribute[]; //!< Attribute name that stores the filename of a scheme to load.
|
---|
| 135 | static const char ConfigLayoutAttribute[]; //!< Attribute name that stores the filename of a layout to load.
|
---|
| 136 | static const char ConfigDefaultFontAttribute[]; //!< Attribute name that stores the name of the default font to set (as loaded by scheme)
|
---|
| 137 | static const char ConfigInitScriptAttribute[]; //!< Attribute name that stores the filename of an initialisation script to run.
|
---|
| 138 | static const char ConfigTerminateScriptAttribute[]; //!< Attribute name that stores the filename of a termination script to run.
|
---|
| 139 | static const char ConfigDefaultResourceGroupAttribute[]; //!< Attribute name that stores the default resource group (also used when loading config resources).
|
---|
| 140 | static const char ConfigLoggingLevelAttribute[]; //!< Attribute name that stores the logging level to be used.
|
---|
| 141 |
|
---|
| 142 | /*************************************************************************
|
---|
| 143 | Implementation Data
|
---|
| 144 | *************************************************************************/
|
---|
| 145 | String d_logFilename; //!< filename for the log.
|
---|
| 146 | String d_schemeFilename; //!< filename for the scheme to auto-load.
|
---|
| 147 | String d_layoutFilename; //!< filename for the layout to auto-load.
|
---|
| 148 | String d_initScriptFilename; //!< filename for the script to run after system init.
|
---|
| 149 | String d_termScriptFilename; //!< filename for the script to run before system shutdown.
|
---|
| 150 | String d_defaultFontName; //!< Holds name of default font to set.
|
---|
| 151 | String d_defaultResourceGroup; //!< Holds default resource group name.
|
---|
| 152 | LoggingLevel d_logLevel; //!< Holds the logging level read from the config.
|
---|
| 153 | };
|
---|
| 154 |
|
---|
| 155 |
|
---|
| 156 | } // End of CEGUI namespace section
|
---|
| 157 |
|
---|
| 158 | #endif // end of guard _CEGUIConfig_xmlHandler_h_
|
---|