[1812] | 1 | /************************************************************************
|
---|
| 2 | filename: CEGUIXMLParser.h
|
---|
| 3 | created: 12/3/2005
|
---|
| 4 | author: Paul D Turner
|
---|
| 5 | *************************************************************************/
|
---|
| 6 | /*************************************************************************
|
---|
| 7 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
| 8 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
| 9 |
|
---|
| 10 | This library is free software; you can redistribute it and/or
|
---|
| 11 | modify it under the terms of the GNU Lesser General Public
|
---|
| 12 | License as published by the Free Software Foundation; either
|
---|
| 13 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 14 |
|
---|
| 15 | This library is distributed in the hope that it will be useful,
|
---|
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 18 | Lesser General Public License for more details.
|
---|
| 19 |
|
---|
| 20 | You should have received a copy of the GNU Lesser General Public
|
---|
| 21 | License along with this library; if not, write to the Free Software
|
---|
| 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 23 | *************************************************************************/
|
---|
| 24 | #ifndef _CEGUIXMLParser_h_
|
---|
| 25 | #define _CEGUIXMLParser_h_
|
---|
| 26 |
|
---|
| 27 | #include "CEGUIBase.h"
|
---|
| 28 | #include "CEGUIString.h"
|
---|
| 29 |
|
---|
| 30 | // Start of CEGUI namespace section
|
---|
| 31 | namespace CEGUI
|
---|
| 32 | {
|
---|
| 33 | /*!
|
---|
| 34 | \brief
|
---|
| 35 | This is an abstract class that is used by CEGUI to interface with XML parser libraries.
|
---|
| 36 | */
|
---|
| 37 | class CEGUIEXPORT XMLParser
|
---|
| 38 | {
|
---|
| 39 | public:
|
---|
| 40 | /*!
|
---|
| 41 | \brief
|
---|
| 42 | XMLParser base class constructor.
|
---|
| 43 | */
|
---|
| 44 | XMLParser(void);
|
---|
| 45 |
|
---|
| 46 | /*!
|
---|
| 47 | \brief
|
---|
| 48 | XMLParser base class destructor.
|
---|
| 49 | */
|
---|
| 50 | virtual ~XMLParser(void);
|
---|
| 51 |
|
---|
| 52 | /*!
|
---|
| 53 | \brief
|
---|
| 54 | Initialises the XMLParser module ready for use.
|
---|
| 55 |
|
---|
| 56 | Note that this calls the protected abstract method 'initialiseImpl', which should
|
---|
| 57 | be provided in your implementation to perform any required initialisation.
|
---|
| 58 |
|
---|
| 59 | \return
|
---|
| 60 | - true if the module initialised successfully.
|
---|
| 61 | - false if the module initialisation failed.
|
---|
| 62 | */
|
---|
| 63 | bool initialise(void);
|
---|
| 64 |
|
---|
| 65 | /*!
|
---|
| 66 | \brief
|
---|
| 67 | Cleans up the XMLParser module after use.
|
---|
| 68 |
|
---|
| 69 | Note that this calls the protected abstract method 'cleanupImpl', which should
|
---|
| 70 | be provided in your implementation to perform any required cleanup.
|
---|
| 71 |
|
---|
| 72 | \return
|
---|
| 73 | Nothing.
|
---|
| 74 | */
|
---|
| 75 | void cleanup(void);
|
---|
| 76 |
|
---|
| 77 | /*!
|
---|
| 78 | \brief
|
---|
| 79 | abstract method which initiates parsing of an XML file.
|
---|
| 80 |
|
---|
| 81 | \param handler
|
---|
| 82 | XMLHandler based object which will process the XML elements.
|
---|
| 83 |
|
---|
| 84 | \param filename
|
---|
| 85 | String object holding the filename of the XML file to be parsed.
|
---|
| 86 |
|
---|
| 87 | \param schemaName
|
---|
| 88 | String object holding the name of the XML schema file to use for validating the XML.
|
---|
| 89 | Note that whether this is used or not is dependant upon the XMLParser in use.
|
---|
| 90 |
|
---|
| 91 | \param resourceGroup
|
---|
| 92 | String object holding the resource group identifier which will be passed to the
|
---|
| 93 | ResourceProvider when loading the XML and schema files.
|
---|
| 94 |
|
---|
| 95 | \return
|
---|
| 96 | Nothing.
|
---|
| 97 | */
|
---|
| 98 | virtual void parseXMLFile(XMLHandler& handler, const String& filename, const String& schemaName, const String& resourceGroup) = 0;
|
---|
| 99 |
|
---|
| 100 | /*!
|
---|
| 101 | \brief
|
---|
| 102 | Return identification string for the XML parser module. If the internal id string has not been
|
---|
| 103 | set by the XML parser module creator, a generic string of "Unknown XML parser" will be returned.
|
---|
| 104 |
|
---|
| 105 | \return
|
---|
| 106 | String object holding a string that identifies the XML parser in use.
|
---|
| 107 | */
|
---|
| 108 | const String& getIdentifierString() const;
|
---|
| 109 |
|
---|
| 110 | protected:
|
---|
| 111 | /*!
|
---|
| 112 | \brief
|
---|
| 113 | abstract method which initialises the XMLParser ready for use.
|
---|
| 114 |
|
---|
| 115 | \return
|
---|
| 116 | - true if the module initialised successfully.
|
---|
| 117 | - false if the module initialisation failed.
|
---|
| 118 | */
|
---|
| 119 | virtual bool initialiseImpl(void) = 0;
|
---|
| 120 |
|
---|
| 121 | /*!
|
---|
| 122 | \brief
|
---|
| 123 | abstract method which cleans up the XMLParser after use.
|
---|
| 124 |
|
---|
| 125 | \return
|
---|
| 126 | Nothing.
|
---|
| 127 | */
|
---|
| 128 |
|
---|
| 129 | virtual void cleanupImpl(void) = 0;
|
---|
| 130 |
|
---|
| 131 | // data fields
|
---|
| 132 | String d_identifierString; //!< String that holds some id information about the module.
|
---|
| 133 |
|
---|
| 134 | private:
|
---|
| 135 | bool d_initialised; //!< true if the parser module has been initialised,
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | } // End of CEGUI namespace section
|
---|
| 139 |
|
---|
| 140 |
|
---|
| 141 | #endif // end of guard _CEGUIXMLParser_h_
|
---|