source: GTP/trunk/Lib/Geom/OgreStuff/include/OgreScriptLoader.h @ 1809

Revision 1809, 3.4 KB checked in by gumbau, 18 years ago (diff)
RevLine 
[1809]1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __ScriptLoader_H__
26#define __ScriptLoader_H__
27
28#include "OgrePrerequisites.h"
29#include "OgreDataStream.h"
30#include "OgreStringVector.h"
31
32namespace Ogre {
33
34        /** Abstract class defining the interface used by classes which wish
35                to perform script loading to define instances of whatever they manage.
36        @remarks
37                Typically classes of this type wish to either parse individual script files
38                on demand, or be called with a group of files matching a certain pattern
39                at the appropriate time. Normally this will coincide with resource loading,
40                although the script use does not necessarily have to be a ResourceManager
41                (which subclasses from this class), it may be simply a script loader which
42                manages non-resources but needs to be synchronised at the same loading points.
43        @par
44                Subclasses should add themselves to the ResourceGroupManager as a script loader
45                if they wish to be called at the point a resource group is loaded, at which
46                point the parseScript method will be called with each file which matches a
47                the pattern returned from getScriptPatterns.
48        */
49        class _OgreExport ScriptLoader
50        {
51        public:
52                virtual ~ScriptLoader();
53                /** Gets the file patterns which should be used to find scripts for this
54                        class.
55                @remarks
56                        This method is called when a resource group is loaded if you use
57                        ResourceGroupManager::_registerScriptLoader.
58                @returns
59                        A list of file patterns, in the order they should be searched in.
60                */
61                virtual const StringVector& getScriptPatterns(void) const = 0;
62
63                /** Parse a script file.
64                @param stream Weak reference to a data stream which is the source of the script
65                @param groupName The name of a resource group which should be used if any resources
66                        are created during the parse of this script.
67                */
68                virtual void parseScript(DataStreamPtr& stream, const String& groupName) = 0;
69
70                /** Gets the relative loading order of scripts of this type.
71                @remarks
72                        There are dependencies between some kinds of scripts, and to enforce
73                        this all implementors of this interface must define a loading order.
74                @returns A value representing the relative loading order of these scripts
75                        compared to other script users, where higher values load later.
76                */
77                virtual Real getLoadingOrder(void) const  = 0;
78
79        };
80
81
82}
83
84
85#endif
Note: See TracBrowser for help on using the repository browser.