[148] | 1 | /* |
---|
| 2 | ----------------------------------------------------------------------------- |
---|
| 3 | This source file is part of OGRE |
---|
| 4 | (Object-oriented Graphics Rendering Engine) |
---|
| 5 | For the latest info, see http://www.ogre3d.org/ |
---|
| 6 | |
---|
| 7 | Copyright (c) 2000-2013 Torus Knot Software Ltd |
---|
| 8 | |
---|
| 9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
| 10 | of this software and associated documentation files (the "Software"), to deal |
---|
| 11 | in the Software without restriction, including without limitation the rights |
---|
| 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
| 13 | copies of the Software, and to permit persons to whom the Software is |
---|
| 14 | furnished to do so, subject to the following conditions: |
---|
| 15 | |
---|
| 16 | The above copyright notice and this permission notice shall be included in |
---|
| 17 | all copies or substantial portions of the Software. |
---|
| 18 | |
---|
| 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
| 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
| 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
| 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
| 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
| 25 | THE SOFTWARE. |
---|
| 26 | ----------------------------------------------------------------------------- |
---|
| 27 | */ |
---|
| 28 | #ifndef __ScriptLoader_H__ |
---|
| 29 | #define __ScriptLoader_H__ |
---|
| 30 | |
---|
| 31 | #include "OgrePrerequisites.h" |
---|
| 32 | #include "OgreDataStream.h" |
---|
| 33 | #include "OgreStringVector.h" |
---|
| 34 | #include "OgreHeaderPrefix.h" |
---|
| 35 | |
---|
| 36 | namespace Ogre { |
---|
| 37 | |
---|
| 38 | /** \addtogroup Core |
---|
| 39 | * @{ |
---|
| 40 | */ |
---|
| 41 | /** \addtogroup General |
---|
| 42 | * @{ |
---|
| 43 | */ |
---|
| 44 | /** Abstract class defining the interface used by classes which wish |
---|
| 45 | to perform script loading to define instances of whatever they manage. |
---|
| 46 | @remarks |
---|
| 47 | Typically classes of this type wish to either parse individual script files |
---|
| 48 | on demand, or be called with a group of files matching a certain pattern |
---|
| 49 | at the appropriate time. Normally this will coincide with resource loading, |
---|
| 50 | although the script use does not necessarily have to be a ResourceManager |
---|
| 51 | (which subclasses from this class), it may be simply a script loader which |
---|
| 52 | manages non-resources but needs to be synchronised at the same loading points. |
---|
| 53 | @par |
---|
| 54 | Subclasses should add themselves to the ResourceGroupManager as a script loader |
---|
| 55 | if they wish to be called at the point a resource group is loaded, at which |
---|
| 56 | point the parseScript method will be called with each file which matches a |
---|
| 57 | the pattern returned from getScriptPatterns. |
---|
| 58 | */ |
---|
| 59 | class _OgreExport ScriptLoader |
---|
| 60 | { |
---|
| 61 | public: |
---|
| 62 | virtual ~ScriptLoader(); |
---|
| 63 | /** Gets the file patterns which should be used to find scripts for this |
---|
| 64 | class. |
---|
| 65 | @remarks |
---|
| 66 | This method is called when a resource group is loaded if you use |
---|
| 67 | ResourceGroupManager::_registerScriptLoader. |
---|
| 68 | @return |
---|
| 69 | A list of file patterns, in the order they should be searched in. |
---|
| 70 | */ |
---|
| 71 | virtual const StringVector& getScriptPatterns(void) const = 0; |
---|
| 72 | |
---|
| 73 | /** Parse a script file. |
---|
| 74 | @param stream Weak reference to a data stream which is the source of the script |
---|
| 75 | @param groupName The name of a resource group which should be used if any resources |
---|
| 76 | are created during the parse of this script. |
---|
| 77 | */ |
---|
| 78 | virtual void parseScript(DataStreamPtr& stream, const String& groupName) = 0; |
---|
| 79 | |
---|
| 80 | /** Gets the relative loading order of scripts of this type. |
---|
| 81 | @remarks |
---|
| 82 | There are dependencies between some kinds of scripts, and to enforce |
---|
| 83 | this all implementors of this interface must define a loading order. |
---|
| 84 | @return A value representing the relative loading order of these scripts |
---|
| 85 | compared to other script users, where higher values load later. |
---|
| 86 | */ |
---|
| 87 | virtual Real getLoadingOrder(void) const = 0; |
---|
| 88 | |
---|
| 89 | }; |
---|
| 90 | |
---|
| 91 | /** @} */ |
---|
| 92 | /** @} */ |
---|
| 93 | |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | #include "OgreHeaderSuffix.h" |
---|
| 97 | |
---|
| 98 | #endif |
---|