resource.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005-2008 by the FIFE team                              *
00003  *   http://www.fifengine.de                                               *
00004  *   This file is part of FIFE.                                            *
00005  *                                                                         *
00006  *   FIFE is free software; you can redistribute it and/or                 *
00007  *   modify it under the terms of the GNU Lesser General Public            *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2.1 of the License, or (at your option) any later version.    *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
00020  ***************************************************************************/
00021 
00022 #ifndef FIFE_RESOURE_H
00023 #define FIFE_RESOURE_H
00024 
00025 // Standard C++ library includes
00026 
00027 // 3rd party library includes
00028 
00029 // FIFE includes
00030 // These includes are split up in two parts, separated by one empty line
00031 // First block: files included from the FIFE root src directory
00032 // Second block: files included from the same folder
00033 #include "resource_location.h"
00034 
00035 namespace FIFE {
00036 
00037     class IReferenceCounted {
00038     public:
00039         virtual ~IReferenceCounted() { }
00040         
00047         virtual void addRef() = 0;
00048 
00052         virtual void decRef() = 0;
00053 
00057         virtual unsigned int getRefCount() = 0;
00058     };
00059 
00063     class IResource: public virtual IReferenceCounted {
00064     public:
00065         virtual ~IResource() { }
00066 
00069         virtual const ResourceLocation& getResourceLocation() = 0;
00070         virtual const std::string& getResourceFile() = 0;
00071 
00074         virtual void setResourceLocation(const ResourceLocation& location) = 0;
00075         virtual void setResourceFile(const std::string& filename) = 0;
00076         
00079         virtual int getPoolId() = 0;
00080         virtual void setPoolId(int poolid) = 0;
00081     };
00082 
00087     class ResourceLoader {
00088     public:
00089         virtual ~ResourceLoader() { };
00090         virtual IResource* loadResource(const ResourceLocation& location) = 0;
00091     };
00092 
00095     class ResourceSaver {
00096     public:
00097         virtual ~ResourceSaver() { };
00098 
00099         virtual void save(const ResourceLocation& location, IResource* resource) = 0;
00100         virtual void save(const std::string& filename, IResource* resource) { save(ResourceLocation(filename), resource); }
00101     };
00102 }
00103 
00104 #endif
Generated by  doxygen 1.6.2-20100208