PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: TypeInfo.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_TYPEINFO_H__ 00024 #define __PLCORE_TYPEINFO_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Base/TypeInfo/DynTypeInfo.h" 00032 #include "PLCore/Base/Type/EnumType.h" 00033 #include "PLCore/Base/Type/DefaultValue.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLCore { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Forward declarations ] 00044 //[-------------------------------------------------------] 00045 template <typename T> 00046 class Type; 00047 00048 00049 //[-------------------------------------------------------] 00050 //[ Classes ] 00051 //[-------------------------------------------------------] 00052 /** 00053 * @brief 00054 * Dynamic type wrapper 00055 */ 00056 template <typename T> 00057 class TypeInfo : public DynTypeInfo { 00058 00059 00060 //[-------------------------------------------------------] 00061 //[ Public static data ] 00062 //[-------------------------------------------------------] 00063 public: 00064 static TypeInfo Instance; 00065 00066 00067 //[-------------------------------------------------------] 00068 //[ Public functions ] 00069 //[-------------------------------------------------------] 00070 public: 00071 /** 00072 * @brief 00073 * Constructor 00074 */ 00075 TypeInfo() 00076 { 00077 } 00078 00079 /** 00080 * @brief 00081 * Destructor 00082 */ 00083 virtual ~TypeInfo() 00084 { 00085 } 00086 00087 00088 //[-------------------------------------------------------] 00089 //[ Public virtual DynTypeInfo functions ] 00090 //[-------------------------------------------------------] 00091 public: 00092 virtual int GetTypeID() const override 00093 { 00094 return Type<T>::TypeID; 00095 } 00096 00097 virtual String GetTypeName() const override 00098 { 00099 return Type<T>::GetTypeName(); 00100 } 00101 00102 virtual bool IsEnumType() const override 00103 { 00104 return false; 00105 } 00106 00107 virtual bool IsFlagType() const override 00108 { 00109 return false; 00110 } 00111 00112 virtual String GetEnumValue(const String &sEnum) const override 00113 { 00114 return ""; 00115 } 00116 00117 00118 }; 00119 00120 00121 //[-------------------------------------------------------] 00122 //[ Static variables ] 00123 //[-------------------------------------------------------] 00124 template <typename T> TypeInfo<T> TypeInfo<T>::Instance; 00125 00126 00127 //[-------------------------------------------------------] 00128 //[ Include type info implementations ] 00129 //[-------------------------------------------------------] 00130 #include "TypeInfoEnum.inl" 00131 #include "TypeInfoFlag.inl" 00132 00133 00134 //[-------------------------------------------------------] 00135 //[ Namespace ] 00136 //[-------------------------------------------------------] 00137 } // PLCore 00138 00139 00140 #endif // __PLCORE_TYPEINFO_H__
|