00001 /*************************************************************************** 00002 * * 00003 * (c) Art Tevs, MPI Informatik Saarbruecken * 00004 * mailto: <tevs@mpi-sb.mpg.de> * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 ***************************************************************************/ 00012 00013 00014 #ifndef _NR_SCRIPT_RESOURCE_LOADER_H_ 00015 #define _NR_SCRIPT_RESOURCE_LOADER_H_ 00016 00017 //---------------------------------------------------------------------------------- 00018 // Includes 00019 //---------------------------------------------------------------------------------- 00020 #include "Prerequisities.h" 00021 #include "ResourceLoader.h" 00022 #include "IScript.h" 00023 #include "Script.h" 00024 00025 namespace nrEngine{ 00026 00027 //! Script loader is used to create/load engine's script objects 00028 /** 00029 * Scriptloader is used to load standard scripts based on the engine's language. 00030 * Standard scripts are very simple and at the time they can only be used 00031 * to load other script languages having more functionality. 00032 * 00033 * @see IResourceLoader 00034 * \ingroup script 00035 **/ 00036 class _NRExport ScriptLoader : public IResourceLoader{ 00037 public: 00038 00039 /** 00040 * Declare supported resource types and supported files. 00041 **/ 00042 ScriptLoader(); 00043 00044 /** 00045 * Destructor 00046 **/ 00047 ~ScriptLoader(); 00048 00049 private: 00050 /** 00051 * Initialize supported resource and file types for the resource script 00052 **/ 00053 Result initializeResourceLoader(); 00054 00055 /** 00056 * Load the script resource. 00057 * 00058 * If a script is loaded then it will be added to the kernel as a task, 00059 * because scripts are task executed in the kernel. 00060 * If you write your own script-loader (i.e. different script language), 00061 * so you have to worry about the adding the script into the kernel . 00062 **/ 00063 Result loadResource(IResource* res, const std::string& fileName, PropertyList* param = NULL); 00064 00065 /** 00066 * Create an empty script resource. The resource represents a script 00067 * which does have no effect. 00068 * 00069 * @param resourceType Unique name of the resource type to be created 00070 * @return Instance of empty resource 00071 **/ 00072 IResource* createEmptyResource(const std::string& resourceType); 00073 00074 /** 00075 * @see IResourceLoader::createResourceImpl() 00076 **/ 00077 IResource* createResource(const std::string& resourceType, PropertyList* params = NULL); 00078 00079 }; 00080 00081 }; 00082 00083 #endif