![]() |
QxOrm
1.4.2
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** http://www.qxorm.com/ 00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com) 00005 ** 00006 ** This file is part of the QxOrm library 00007 ** 00008 ** This software is provided 'as-is', without any express or implied 00009 ** warranty. In no event will the authors be held liable for any 00010 ** damages arising from the use of this software 00011 ** 00012 ** Commercial Usage 00013 ** Licensees holding valid commercial QxOrm licenses may use this file in 00014 ** accordance with the commercial license agreement provided with the 00015 ** Software or, alternatively, in accordance with the terms contained in 00016 ** a written agreement between you and Lionel Marty 00017 ** 00018 ** GNU General Public License Usage 00019 ** Alternatively, this file may be used under the terms of the GNU 00020 ** General Public License version 3.0 as published by the Free Software 00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the 00022 ** packaging of this file. Please review the following information to 00023 ** ensure the GNU General Public License version 3.0 requirements will be 00024 ** met : http://www.gnu.org/copyleft/gpl.html 00025 ** 00026 ** If you are unsure which license is appropriate for your use, or 00027 ** if you have questions regarding the use of this file, please contact : 00028 ** contact@qxorm.com 00029 ** 00030 ****************************************************************************/ 00031 00032 #ifndef _QX_IS_SMART_PTR_H_ 00033 #define _QX_IS_SMART_PTR_H_ 00034 00035 #ifdef _MSC_VER 00036 #pragma once 00037 #endif 00038 00046 #include <boost/mpl/if.hpp> 00047 #include <boost/mpl/or.hpp> 00048 #include <boost/mpl/logical.hpp> 00049 00050 #include <QxTraits/is_boost_intrusive_ptr.h> 00051 #include <QxTraits/is_boost_scoped_ptr.h> 00052 #include <QxTraits/is_boost_shared_ptr.h> 00053 #include <QxTraits/is_boost_weak_ptr.h> 00054 #include <QxTraits/is_qt_shared_data_ptr.h> 00055 #include <QxTraits/is_qt_scoped_ptr.h> 00056 #include <QxTraits/is_qt_shared_ptr.h> 00057 #include <QxTraits/is_qt_weak_ptr.h> 00058 #include <QxTraits/is_qx_dao_ptr.h> 00059 #include <QxTraits/is_std_unique_ptr.h> 00060 #include <QxTraits/is_std_shared_ptr.h> 00061 #include <QxTraits/is_std_weak_ptr.h> 00062 00063 namespace qx { 00064 namespace trait { 00065 00070 template <typename T> 00071 struct is_smart_ptr : public boost::mpl::false_ { ; }; 00072 00073 template <typename T> 00074 struct is_smart_ptr< boost::shared_ptr<T> > : public boost::mpl::true_ { ; }; 00075 00076 template <typename T> 00077 struct is_smart_ptr< boost::shared_ptr<T> & > : public boost::mpl::true_ { ; }; 00078 00079 template <typename T> 00080 struct is_smart_ptr< const boost::shared_ptr<T> > : public boost::mpl::true_ { ; }; 00081 00082 template <typename T> 00083 struct is_smart_ptr< const boost::shared_ptr<T> & > : public boost::mpl::true_ { ; }; 00084 00085 template <typename T> 00086 struct is_smart_ptr< boost::intrusive_ptr<T> > : public boost::mpl::true_ { ; }; 00087 00088 template <typename T> 00089 struct is_smart_ptr< boost::intrusive_ptr<T> & > : public boost::mpl::true_ { ; }; 00090 00091 template <typename T> 00092 struct is_smart_ptr< const boost::intrusive_ptr<T> > : public boost::mpl::true_ { ; }; 00093 00094 template <typename T> 00095 struct is_smart_ptr< const boost::intrusive_ptr<T> & > : public boost::mpl::true_ { ; }; 00096 00097 template <typename T> 00098 struct is_smart_ptr< boost::scoped_ptr<T> > : public boost::mpl::true_ { ; }; 00099 00100 template <typename T> 00101 struct is_smart_ptr< boost::scoped_ptr<T> & > : public boost::mpl::true_ { ; }; 00102 00103 template <typename T> 00104 struct is_smart_ptr< const boost::scoped_ptr<T> > : public boost::mpl::true_ { ; }; 00105 00106 template <typename T> 00107 struct is_smart_ptr< const boost::scoped_ptr<T> & > : public boost::mpl::true_ { ; }; 00108 00109 template <typename T> 00110 struct is_smart_ptr< boost::weak_ptr<T> > : public boost::mpl::true_ { ; }; 00111 00112 template <typename T> 00113 struct is_smart_ptr< boost::weak_ptr<T> & > : public boost::mpl::true_ { ; }; 00114 00115 template <typename T> 00116 struct is_smart_ptr< const boost::weak_ptr<T> > : public boost::mpl::true_ { ; }; 00117 00118 template <typename T> 00119 struct is_smart_ptr< const boost::weak_ptr<T> & > : public boost::mpl::true_ { ; }; 00120 00121 #if (QT_VERSION >= 0x040600) 00122 00123 template <typename T> 00124 struct is_smart_ptr< QScopedPointer<T> > : public boost::mpl::true_ { ; }; 00125 00126 template <typename T> 00127 struct is_smart_ptr< QScopedPointer<T> & > : public boost::mpl::true_ { ; }; 00128 00129 template <typename T> 00130 struct is_smart_ptr< const QScopedPointer<T> > : public boost::mpl::true_ { ; }; 00131 00132 template <typename T> 00133 struct is_smart_ptr< const QScopedPointer<T> & > : public boost::mpl::true_ { ; }; 00134 00135 #endif // (QT_VERSION >= 0x040600) 00136 00137 template <typename T> 00138 struct is_smart_ptr< QSharedDataPointer<T> > : public boost::mpl::true_ { ; }; 00139 00140 template <typename T> 00141 struct is_smart_ptr< QSharedDataPointer<T> & > : public boost::mpl::true_ { ; }; 00142 00143 template <typename T> 00144 struct is_smart_ptr< const QSharedDataPointer<T> > : public boost::mpl::true_ { ; }; 00145 00146 template <typename T> 00147 struct is_smart_ptr< const QSharedDataPointer<T> & > : public boost::mpl::true_ { ; }; 00148 00149 template <typename T> 00150 struct is_smart_ptr< QSharedPointer<T> > : public boost::mpl::true_ { ; }; 00151 00152 template <typename T> 00153 struct is_smart_ptr< QSharedPointer<T> & > : public boost::mpl::true_ { ; }; 00154 00155 template <typename T> 00156 struct is_smart_ptr< const QSharedPointer<T> > : public boost::mpl::true_ { ; }; 00157 00158 template <typename T> 00159 struct is_smart_ptr< const QSharedPointer<T> & > : public boost::mpl::true_ { ; }; 00160 00161 template <typename T> 00162 struct is_smart_ptr< QWeakPointer<T> > : public boost::mpl::true_ { ; }; 00163 00164 template <typename T> 00165 struct is_smart_ptr< QWeakPointer<T> & > : public boost::mpl::true_ { ; }; 00166 00167 template <typename T> 00168 struct is_smart_ptr< const QWeakPointer<T> > : public boost::mpl::true_ { ; }; 00169 00170 template <typename T> 00171 struct is_smart_ptr< const QWeakPointer<T> & > : public boost::mpl::true_ { ; }; 00172 00173 template <typename T> 00174 struct is_smart_ptr< qx::dao::ptr<T> > : public boost::mpl::true_ { ; }; 00175 00176 template <typename T> 00177 struct is_smart_ptr< qx::dao::ptr<T> & > : public boost::mpl::true_ { ; }; 00178 00179 template <typename T> 00180 struct is_smart_ptr< const qx::dao::ptr<T> > : public boost::mpl::true_ { ; }; 00181 00182 template <typename T> 00183 struct is_smart_ptr< const qx::dao::ptr<T> & > : public boost::mpl::true_ { ; }; 00184 00185 #ifdef _QX_CPP_11_SMART_PTR 00186 #ifndef BOOST_NO_CXX11_SMART_PTR 00187 00188 template <typename T> 00189 struct is_smart_ptr< std::shared_ptr<T> > : public boost::mpl::true_ { ; }; 00190 00191 template <typename T> 00192 struct is_smart_ptr< std::shared_ptr<T> & > : public boost::mpl::true_ { ; }; 00193 00194 template <typename T> 00195 struct is_smart_ptr< const std::shared_ptr<T> > : public boost::mpl::true_ { ; }; 00196 00197 template <typename T> 00198 struct is_smart_ptr< const std::shared_ptr<T> & > : public boost::mpl::true_ { ; }; 00199 00200 template <typename T> 00201 struct is_smart_ptr< std::unique_ptr<T> > : public boost::mpl::true_ { ; }; 00202 00203 template <typename T> 00204 struct is_smart_ptr< std::unique_ptr<T> & > : public boost::mpl::true_ { ; }; 00205 00206 template <typename T> 00207 struct is_smart_ptr< const std::unique_ptr<T> > : public boost::mpl::true_ { ; }; 00208 00209 template <typename T> 00210 struct is_smart_ptr< const std::unique_ptr<T> & > : public boost::mpl::true_ { ; }; 00211 00212 template <typename T> 00213 struct is_smart_ptr< std::weak_ptr<T> > : public boost::mpl::true_ { ; }; 00214 00215 template <typename T> 00216 struct is_smart_ptr< std::weak_ptr<T> & > : public boost::mpl::true_ { ; }; 00217 00218 template <typename T> 00219 struct is_smart_ptr< const std::weak_ptr<T> > : public boost::mpl::true_ { ; }; 00220 00221 template <typename T> 00222 struct is_smart_ptr< const std::weak_ptr<T> & > : public boost::mpl::true_ { ; }; 00223 00224 #endif // BOOST_NO_CXX11_SMART_PTR 00225 #endif // _QX_CPP_11_SMART_PTR 00226 00227 } // namespace trait 00228 } // namespace qx 00229 00230 #endif // _QX_IS_SMART_PTR_H_