NoMap.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 
00028 #ifndef KEYVALUE_KEY_MAP_NOMAP_H_
00029 #define KEYVALUE_KEY_MAP_NOMAP_H_
00030 
00031 #include <boost/static_assert.hpp>
00032 #include <boost/type_traits/is_same.hpp>
00033 
00034 #include "keyvalue/extern/String.h"
00035 #include "keyvalue/extern/Ptime.h"
00036 #include "keyvalue/key/Key.h"
00037 
00038 namespace keyvalue {
00039 
00040 // Forward declaration
00041 
00042 namespace value {
00043 class Variant;
00044 }
00045 
00046 namespace key {
00047 
00065 template <typename OutputType>
00066 class NoMap {
00067 
00068 public:
00069 
00070   typedef OutputType OutputType_;
00071 
00072   NoMap();
00073 
00085   OutputType
00086   map(const value::Variant& variant) const;
00087 
00088 private:
00089 
00095   virtual string
00096   getName() const = 0;
00097 
00098   typedef typename boost::is_same<OutputType, bool  >::type IsBool_;
00099   typedef typename boost::is_same<OutputType, double>::type IsDouble_;
00100   typedef typename boost::is_same<OutputType, ptime >::type IsPtime_;
00101   typedef typename boost::is_same<OutputType, string>::type IsString_;
00102   typedef typename boost::is_same<OutputType, unsigned int>::type IsUInt_;
00103 
00104   /*
00105    ATTENTION: If you get a compiler error here about
00106 
00107    'boost::STATIC_ASSERTION_FAILURE<x>'
00108 
00109    this means that you are trying to instantiate PartialMap for an
00110    OutputType different of bool, double, string, ptime and unsigned int.
00111    */
00112   BOOST_STATIC_ASSERT(IsBool_::value || IsDouble_::value ||
00113     IsString_::value || IsPtime_::value || IsUInt_::value);
00114 
00115 }; // class NoMap
00116 
00117 } // namespace key
00118 } // namespace keyvalue
00119 
00120 #endif // KEYVALUE_KEY_MAP_NOMAP_H_

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