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 //---------------------------------------------------------------------------------- 00015 // Includes 00016 //---------------------------------------------------------------------------------- 00017 #include "FileStreamLoader.h" 00018 #include "Log.h" 00019 00020 namespace nrEngine{ 00021 00022 //---------------------------------------------------------------------------------- 00023 FileStreamLoader::FileStreamLoader() : IResourceLoader("FileStreamLoader") 00024 { 00025 initializeResourceLoader(); 00026 } 00027 00028 00029 //---------------------------------------------------------------------------------- 00030 FileStreamLoader::~FileStreamLoader() 00031 { 00032 00033 } 00034 00035 //---------------------------------------------------------------------------------- 00036 Result FileStreamLoader::initializeResourceLoader() 00037 { 00038 00039 // fill out supported resource types; 00040 declareSupportedResourceType("File"); 00041 00042 return OK; 00043 } 00044 00045 //---------------------------------------------------------------------------------- 00046 Result FileStreamLoader::loadResource(IResource* res, const std::string& fileName, PropertyList* param) 00047 { 00048 // create a pointer to the stream object and open the file 00049 FileStream* fileStream = dynamic_cast<FileStream*>(res); 00050 return fileStream->open(fileName); 00051 } 00052 00053 00054 //---------------------------------------------------------------------------------- 00055 IResource* FileStreamLoader::createResource(const std::string& resourceType, PropertyList* params) 00056 { 00057 // create an plugin instance 00058 return new FileStream(); 00059 } 00060 00061 00062 //---------------------------------------------------------------------------------- 00063 IResource* FileStreamLoader::createEmptyResource(const std::string& resourceType) 00064 { 00065 // create an instance of empty plugin 00066 return new EmptyFileStream(); 00067 } 00068 00069 }; 00070