PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: LoaderImpl.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_LOADER_IMPL_H__ 00024 #define __PLCORE_LOADER_IMPL_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Base/Object.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Classes ] 00042 //[-------------------------------------------------------] 00043 /** 00044 * @brief 00045 * Abstract loader implementation base class, derive your concrete loader implementations from this class 00046 * 00047 * @remarks 00048 * A loader implementation is ONLY responsible for loading & saving, NOT for opening/closing 00049 * concrete file objects or for clearing the given loadable! 00050 * There's only one instance of each loader within the system, do NOT use class member variables, 00051 * do ONLY use local variables else you may get in trouble when using multi-threading. 00052 * By default, the loadable system looks for "Load" and "LoadParams" RTTI methods for loading, and 00053 * "Save" and "SaveParams" for saving. For example "Load" is used if there are no special user provided 00054 * parameters, "LoadParams" is used if a loader supports special format dependent parameters and 00055 * the user explicitly set them. Please note that it's also possible to add methods with other names, 00056 * when loading a loadable, this method name can be used explicitly. The first method parameter has to 00057 * be a reference to the loadable, the second parameter has to be a reference to the file to operate on. 00058 * 00059 * Each loader should have the following properties: 00060 * - "Type": Loader type, usually only defined once within the abstract loader base class 00061 * - "Formats": File format extensions this loader can load in (for example: "bmp" or "jpg,jpeg") 00062 * - "Load": "1" if loading is implemented, else "0" 00063 * - "Save": "1" if saving is implemented, else "0" 00064 */ 00065 class LoaderImpl : public Object { 00066 00067 00068 //[-------------------------------------------------------] 00069 //[ Friends ] 00070 //[-------------------------------------------------------] 00071 friend class Loader; 00072 00073 00074 //[-------------------------------------------------------] 00075 //[ Public static data ] 00076 //[-------------------------------------------------------] 00077 public: 00078 static PLCORE_API const String UnknownFormatVersion; /**< 'Unknown format version' string */ 00079 static PLCORE_API const String DeprecatedFormatVersion; /**< 'Deprecated format version' string */ 00080 static PLCORE_API const String NoLongerSupportedFormatVersion; /**< 'No longer supported format version' string */ 00081 static PLCORE_API const String InvalidFormatVersion; /**< 'Invalid format version' string */ 00082 00083 00084 //[-------------------------------------------------------] 00085 //[ RTTI interface ] 00086 //[-------------------------------------------------------] 00087 pl_class(PLCORE_RTTI_EXPORT, LoaderImpl, "PLCore", PLCore::Object, "Abstract loader implementation base class, derive your concrete loader implementations from this class") 00088 // Properties 00089 pl_properties 00090 pl_property("Type", "Unknown") 00091 pl_property("Formats", "") 00092 pl_property("Load", "0") 00093 pl_property("Save", "0") 00094 pl_properties_end 00095 pl_class_end 00096 00097 00098 //[-------------------------------------------------------] 00099 //[ Protected functions ] 00100 //[-------------------------------------------------------] 00101 protected: 00102 /** 00103 * @brief 00104 * Default constructor 00105 */ 00106 PLCORE_API LoaderImpl(); 00107 00108 /** 00109 * @brief 00110 * Destructor 00111 */ 00112 PLCORE_API virtual ~LoaderImpl(); 00113 00114 00115 }; 00116 00117 00118 //[-------------------------------------------------------] 00119 //[ Namespace ] 00120 //[-------------------------------------------------------] 00121 } // PLCore 00122 00123 00124 #endif // __PLCORE_LOADER_IMPL_H__
|