QxOrm  1.2.3
C++ Object Relational Mapping library
is_container.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** http://www.qxorm.com/
00004 ** http://sourceforge.net/projects/qxorm/
00005 ** Original file by Lionel Marty
00006 **
00007 ** This file is part of the QxOrm library
00008 **
00009 ** This software is provided 'as-is', without any express or implied
00010 ** warranty. In no event will the authors be held liable for any
00011 ** damages arising from the use of this software.
00012 **
00013 ** GNU Lesser General Public License Usage
00014 ** This file must be used under the terms of the GNU Lesser
00015 ** General Public License version 2.1 as published by the Free Software
00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the
00017 ** packaging of this file.  Please review the following information to
00018 ** ensure the GNU Lesser General Public License version 2.1 requirements
00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00020 **
00021 ** If you have questions regarding the use of this file, please contact :
00022 ** contact@qxorm.com
00023 **
00024 ****************************************************************************/
00025 
00026 #ifndef _QX_IS_CONTAINER_H_
00027 #define _QX_IS_CONTAINER_H_
00028 
00029 #ifdef _MSC_VER
00030 #pragma once
00031 #endif
00032 
00040 #include <boost/mpl/if.hpp>
00041 #include <boost/mpl/or.hpp>
00042 #include <boost/mpl/logical.hpp>
00043 
00044 #include <QxTraits/is_boost_unordered_map.h>
00045 #include <QxTraits/is_boost_unordered_set.h>
00046 #include <QxTraits/is_qt_hash.h>
00047 #include <QxTraits/is_qt_linked_list.h>
00048 #include <QxTraits/is_qt_list.h>
00049 #include <QxTraits/is_qt_map.h>
00050 #include <QxTraits/is_qt_multi_hash.h>
00051 #include <QxTraits/is_qt_multi_map.h>
00052 #include <QxTraits/is_qt_set.h>
00053 #include <QxTraits/is_qt_vector.h>
00054 #include <QxTraits/is_qx_collection.h>
00055 #include <QxTraits/is_std_list.h>
00056 #include <QxTraits/is_std_map.h>
00057 #include <QxTraits/is_std_set.h>
00058 #include <QxTraits/is_std_vector.h>
00059 
00060 namespace qx {
00061 namespace trait {
00062 
00067 template <typename T>
00068 class is_container
00069 {
00070 
00071 private:
00072 
00073    typedef typename boost::mpl::or_< qx::trait::is_boost_unordered_map<T>, 
00074                                      qx::trait::is_boost_unordered_set<T>, 
00075                                      qx::trait::is_qt_hash<T>, 
00076                                      qx::trait::is_qt_linked_list<T> >::type cond_is_container_1;
00077 
00078    typedef typename boost::mpl::or_< typename qx::trait::is_container<T>::cond_is_container_1, 
00079                                      qx::trait::is_qt_list<T>, 
00080                                      qx::trait::is_qt_map<T>, 
00081                                      qx::trait::is_qt_multi_hash<T> >::type cond_is_container_2;
00082 
00083    typedef typename boost::mpl::or_< typename qx::trait::is_container<T>::cond_is_container_2, 
00084                                      qx::trait::is_qt_multi_map<T>, 
00085                                      qx::trait::is_qt_set<T>, 
00086                                      qx::trait::is_qt_vector<T> >::type cond_is_container_3;
00087 
00088    typedef typename boost::mpl::or_< typename qx::trait::is_container<T>::cond_is_container_3, 
00089                                      qx::trait::is_qx_collection<T>, 
00090                                      qx::trait::is_std_list<T>, 
00091                                      qx::trait::is_std_map<T> >::type cond_is_container_4;
00092 
00093    typedef typename boost::mpl::or_< typename qx::trait::is_container<T>::cond_is_container_4, 
00094                                      qx::trait::is_std_set<T>, 
00095                                      qx::trait::is_std_vector<T> >::type cond_is_container_5;
00096 
00097    typedef typename boost::mpl::if_< typename qx::trait::is_container<T>::cond_is_container_5, 
00098                                      boost::mpl::true_, 
00099                                      boost::mpl::false_ >::type type_is_container;
00100 
00101 public:
00102 
00103    enum { value = qx::trait::is_container<T>::type_is_container::value };
00104 
00105    typedef typename qx::trait::is_container<T>::type_is_container type;
00106 
00107 };
00108 
00109 } // namespace trait
00110 } // namespace qx
00111 
00112 #endif // _QX_IS_CONTAINER_H_