IsBasic.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *
00003  * Copyright (C) 2009-2010 Cassio Neri Moreira
00004  *
00005  * This file is part of the KeyValue library.
00006  *
00007  * The KeyValue library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation, either version 3 of the License, or (at
00010  * your option) any later version.
00011  *
00012  * The KeyValue library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00015  * Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along
00018  * with KeyValue. If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  **************************************************************************/
00021 
00029 #ifndef KEYVALUE_UTIL_ISBASIC_H_
00030 #define KEYVALUE_UTIL_ISBASIC_H_
00031 
00032 #include <boost/type_traits/is_enum.hpp>
00033 
00034 #include "keyvalue/extern/String.h"
00035 #include "keyvalue/extern/Ptime.h"
00036 
00037 namespace keyvalue {
00038 namespace util {
00039 
00052 template <typename ElementType>
00053 struct IsBasic {
00054   enum { value_ = 0 };
00055 };
00056 
00057 template <>
00058 struct IsBasic<bool> {
00059   enum { value_ = 1 };
00060 };
00061 
00062 template <>
00063 struct IsBasic<double> {
00064   enum { value_ = 1 };
00065 };
00066 
00067 template <>
00068 struct IsBasic<string> {
00069   enum { value_ = 1 };
00070 };
00071 
00072 template <>
00073 struct IsBasic<ptime> {
00074   enum { value_ = 1 };
00075 };
00076 
00077 template <>
00078 struct IsBasic<unsigned int> {
00079   enum { value_ = 1 };
00080 };
00081 
00094 template <typename ElementType>
00095 struct IsBasicOrEnum {
00096   enum { value_ = (boost::is_enum<ElementType>::value ||
00097     IsBasic<ElementType>::value_ ? 1 : 0) };
00098 };
00099 
00100 } // namespace util
00101 } // namespace keyvalue
00102 
00103 #endif // KEYVALUE_UTIL_ISBASIC_H_

Generated on Sat Mar 20 15:08:29 2010 for KeyValue by  doxygen 1.6.1