PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: VarDesc.h * 00003 * 00004 * Copyright (C) 2002-2011 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_VARDESC_H__ 00024 #define __PLCORE_VARDESC_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Base/MemberDesc.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Forward declarations ] 00042 //[-------------------------------------------------------] 00043 class Object; 00044 class DynVar; 00045 00046 00047 //[-------------------------------------------------------] 00048 //[ Classes ] 00049 //[-------------------------------------------------------] 00050 /** 00051 * @brief 00052 * Variable descriptor 00053 * 00054 * @remarks 00055 * This class contains a descriptor for a variable and consists of information 00056 * belonging to a specific variable, such as it's name, type and description. 00057 */ 00058 class VarDesc : public MemberDesc { 00059 00060 00061 //[-------------------------------------------------------] 00062 //[ Public functions ] 00063 //[-------------------------------------------------------] 00064 public: 00065 /** 00066 * @brief 00067 * Constructor 00068 * 00069 * @param[in] nType 00070 * Type ID 00071 * @param[in] sType 00072 * Type name 00073 * @param[in] sName 00074 * Var name 00075 * @param[in] sDescription 00076 * Var description 00077 * @param[in] sAnnotation 00078 * Var annotation 00079 */ 00080 PLCORE_API VarDesc(int nType, const String &sType, const String &sName, const String &sDescription, const String &sAnnotation); 00081 00082 /** 00083 * @brief 00084 * Destructor 00085 */ 00086 PLCORE_API virtual ~VarDesc(); 00087 00088 /** 00089 * @brief 00090 * Initialize instance 00091 * 00092 * @remarks 00093 * This method is just here to ensure, that the compiler will actually create static instances 00094 */ 00095 PLCORE_API void Dummy(); 00096 00097 /** 00098 * @brief 00099 * Get type ID 00100 * 00101 * @return 00102 * Type ID 00103 */ 00104 inline int GetTypeID() const; 00105 00106 /** 00107 * @brief 00108 * Get type name 00109 * 00110 * @return 00111 * Type name 00112 */ 00113 inline String GetTypeName() const; 00114 00115 00116 //[-------------------------------------------------------] 00117 //[ Public virtual VarDesc functions ] 00118 //[-------------------------------------------------------] 00119 public: 00120 /** 00121 * @brief 00122 * Get default value as string 00123 * 00124 * @return 00125 * Default value as string 00126 */ 00127 PLCORE_API virtual String GetDefault() const; 00128 00129 /** 00130 * @brief 00131 * Get attribute 00132 * 00133 * @param[in] cObject 00134 * Object to return the attribute pointer from 00135 * 00136 * @return 00137 * Pointer to var (can be a null pointer, do not destroy the returned instance) 00138 */ 00139 PLCORE_API virtual DynVar *GetAttribute(const Object &cObject) const; 00140 00141 00142 //[-------------------------------------------------------] 00143 //[ Protected data ] 00144 //[-------------------------------------------------------] 00145 protected: 00146 int m_nType; /**< Type ID */ 00147 String m_sType; /**< Type name */ 00148 00149 00150 }; 00151 00152 00153 //[-------------------------------------------------------] 00154 //[ Namespace ] 00155 //[-------------------------------------------------------] 00156 } // PLCore 00157 00158 00159 //[-------------------------------------------------------] 00160 //[ Implementation ] 00161 //[-------------------------------------------------------] 00162 #include "PLCore/Base/Var/VarDesc.inl" 00163 00164 00165 #endif // __PLCORE_VARDESC_H__
|