sprint 1-alpha
sprint/serializable_rtti.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 *   sprint::serializable_rtti
00003 *
00004 *   Copyright (C) 2005-2011  Paolo Medici <www.pmx.it>
00005 *
00006 *  This library 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 Free Software
00018 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 *
00020 *******************************************************************************/
00021 
00022 #ifndef _SPRINT_SERIALIZABLE_RTTI_H
00023 #define _SPRINT_SERIALIZABLE_RTTI_H
00024 
00028 namespace sprint {
00029 
00031 enum Type {
00032      Void=0,      
00033      Int8,
00034      UnsignedInt8,
00035      In16,
00036      UnsignedInt16,
00037      Int32,
00038      UnsignedInt32,
00039      Int64,
00040      UnsignedInt64,
00041      RGB24,      
00042      RGBA32,     
00043      Float,      
00044      Double,     
00045      String,     
00046      Vector,     
00047      Pair,       
00048      Enum        
00049 };
00050 
00052 template<class T>
00053 Type rtti();
00054 
00055 /***************** some specializations ************************/
00056 
00057 template<>
00058 inline Type rtti<void>() { return Void; }
00059 
00060 template<>
00061 inline Type rtti<char>() { return Int8; }
00062 
00063 template<>
00064 inline Type rtti<unsigned char>() { return UnsignedInt8; }
00065 
00066 template<>
00067 inline Type rtti<int>() { return Int32; }
00068 
00069 template<>
00070 inline Type rtti<unsigned int>() { return UnsignedInt32; }
00071 
00072 template<>
00073 inline Type rtti<float>() { return Float; }
00074 
00075 template<>
00076 inline Type rtti<double>() { return Double; }
00077 
00078 template<>
00079 inline Type rtti<char *>() { return String; }
00080 
00081 }
00082 
00083 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines