1 | /************************************************************************
|
---|
2 | filename: CEGUIResourceProvider.h
|
---|
3 | created: 8/7/2004
|
---|
4 | author: James '_mental_' O'Sullivan
|
---|
5 |
|
---|
6 | purpose: Defines abstract base class for loading DataContainer objects
|
---|
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 _CEGUIResourceProvider_h_
|
---|
27 | #define _CEGUIResourceProvider_h_
|
---|
28 |
|
---|
29 | #include "CEGUIBase.h"
|
---|
30 | #include "CEGUIDataContainer.h"
|
---|
31 | #include "CEGUIString.h"
|
---|
32 |
|
---|
33 |
|
---|
34 | // Start of CEGUI namespace section
|
---|
35 | namespace CEGUI
|
---|
36 | {
|
---|
37 | /*!
|
---|
38 | \brief
|
---|
39 | Abstract class that defines the required interface for all resource provider sub-classes.
|
---|
40 |
|
---|
41 | A ResourceProvider is used to load both XML and binary data from an external source. This could be from a filesystem or the resource manager of a specific renderer.
|
---|
42 | */
|
---|
43 | class CEGUIEXPORT ResourceProvider
|
---|
44 | {
|
---|
45 | public:
|
---|
46 | /*************************************************************************
|
---|
47 | Construction and Destruction
|
---|
48 | *************************************************************************/
|
---|
49 | /*!
|
---|
50 | \brief
|
---|
51 | Constructor for the ResourceProvider class
|
---|
52 | */
|
---|
53 | ResourceProvider() { }
|
---|
54 |
|
---|
55 | /*!
|
---|
56 | \brief
|
---|
57 | Destructor for the ResourceProvider class
|
---|
58 | */
|
---|
59 | virtual ~ResourceProvider(void) { }
|
---|
60 |
|
---|
61 | /*************************************************************************
|
---|
62 | Accessor functions
|
---|
63 | *************************************************************************/
|
---|
64 |
|
---|
65 | // /*!
|
---|
66 | // \brief
|
---|
67 | // Load XML data using InputSource objects.
|
---|
68 | //
|
---|
69 | // \param filename
|
---|
70 | // String containing a filename of the resource to be loaded.
|
---|
71 | //
|
---|
72 | // \param output
|
---|
73 | // Reference to a InputSourceContainer object to load the data into.
|
---|
74 | // */
|
---|
75 | // virtual void loadInputSourceContainer(const String& filename, InputSourceContainer& output) = 0;
|
---|
76 |
|
---|
77 | /*!
|
---|
78 | \brief
|
---|
79 | Load raw binary data.
|
---|
80 |
|
---|
81 | \param filename
|
---|
82 | String containing a filename of the resource to be loaded.
|
---|
83 |
|
---|
84 | \param output
|
---|
85 | Reference to a RawDataContainer object to load the data into.
|
---|
86 |
|
---|
87 | \param resourceGroup
|
---|
88 | Optional String that may be used by implementations to identify the group from
|
---|
89 | which the resource should be loaded.
|
---|
90 | */
|
---|
91 | virtual void loadRawDataContainer(const String& filename, RawDataContainer& output, const String& resourceGroup) = 0;
|
---|
92 |
|
---|
93 | /*!
|
---|
94 | \brief
|
---|
95 | Unload raw binary data. This gives the resource provider a change to unload the data
|
---|
96 | in its own way before the data container object is destroyed. If it does nothing,
|
---|
97 | then the object will release its memory.
|
---|
98 |
|
---|
99 | \param data
|
---|
100 | Reference to a RawDataContainer object that is about to be destroyed.
|
---|
101 |
|
---|
102 | */
|
---|
103 | virtual void unloadRawDataContainer(RawDataContainer& data) { }
|
---|
104 |
|
---|
105 | /*!
|
---|
106 | \brief
|
---|
107 | Return the current default resource group identifier.
|
---|
108 |
|
---|
109 | \return
|
---|
110 | String object containing the currently set default resource group identifier.
|
---|
111 | */
|
---|
112 | const String& getDefaultResourceGroup(void) const { return d_defaultResourceGroup; }
|
---|
113 |
|
---|
114 | /*!
|
---|
115 | \brief
|
---|
116 | Set the default resource group identifier.
|
---|
117 |
|
---|
118 | \param resourceGroup
|
---|
119 | String object containing the default resource group identifier to be used.
|
---|
120 |
|
---|
121 | \return
|
---|
122 | Nothing.
|
---|
123 | */
|
---|
124 | void setDefaultResourceGroup(const String& resourceGroup) { d_defaultResourceGroup = resourceGroup; }
|
---|
125 |
|
---|
126 | protected:
|
---|
127 | String d_defaultResourceGroup; //!< Default resource group identifier.
|
---|
128 | };
|
---|
129 |
|
---|
130 | } // End of CEGUI namespace section
|
---|
131 |
|
---|
132 | #endif // end of guard _CEGUIResourceProvider_h_
|
---|