![]() |
QxOrm
1.2.3
C++ Object Relational Mapping library
|
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_FUNCTION_9_H_ 00027 #define _QX_FUNCTION_9_H_ 00028 00029 #ifdef _MSC_VER 00030 #pragma once 00031 #endif 00032 00040 #include <QxFunction/IxFunction.h> 00041 #include <QxFunction/QxParameters.h> 00042 00043 namespace qx { 00044 00049 template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9> 00050 class QxFunction_9 : public IxFunction 00051 { 00052 00053 public: 00054 00055 typedef boost::function<R (Owner *, P1, P2, P3, P4, P5, P6, P7, P8, P9)> type_fct; 00056 typedef typename qx::trait::remove_attr<P1, false>::type type_P1; 00057 typedef typename qx::trait::remove_attr<P2, false>::type type_P2; 00058 typedef typename qx::trait::remove_attr<P3, false>::type type_P3; 00059 typedef typename qx::trait::remove_attr<P4, false>::type type_P4; 00060 typedef typename qx::trait::remove_attr<P5, false>::type type_P5; 00061 typedef typename qx::trait::remove_attr<P6, false>::type type_P6; 00062 typedef typename qx::trait::remove_attr<P7, false>::type type_P7; 00063 typedef typename qx::trait::remove_attr<P8, false>::type type_P8; 00064 typedef typename qx::trait::remove_attr<P9, false>::type type_P9; 00065 QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_9); 00066 00067 virtual qx_bool isValidParams(const QString & params) const { Q_UNUSED(params); return true; } 00068 virtual qx_bool isValidParams(const type_any_params & params) const { Q_UNUSED(params); return true; } 00069 00070 private: 00071 00072 template <class T, bool bReturnValue /* = false */> 00073 struct QxInvokerFct 00074 { 00075 static inline qx_bool invoke(void * pOwner, const T & params, boost::any * ret, const QxFunction_9 * pThis) 00076 { 00077 QX_FUNCTION_INVOKE_START_WITH_OWNER(); 00078 QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1); 00079 QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2); 00080 QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3); 00081 QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4); 00082 QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5); 00083 QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6); 00084 QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7); 00085 QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8); 00086 QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9); 00087 try { pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7, p8, p9); } 00088 QX_FUNCTION_CATCH_AND_RETURN_INVOKE(); 00089 } 00090 }; 00091 00092 template <class T> 00093 struct QxInvokerFct<T, true> 00094 { 00095 static inline qx_bool invoke(void * pOwner, const T & params, boost::any * ret, const QxFunction_9 * pThis) 00096 { 00097 QX_FUNCTION_INVOKE_START_WITH_OWNER(); 00098 QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1); 00099 QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2); 00100 QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3); 00101 QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4); 00102 QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5); 00103 QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6); 00104 QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7); 00105 QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8); 00106 QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9); 00107 try { R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7, p8, p9); if (ret) { (* ret) = boost::any(retTmp); } } 00108 QX_FUNCTION_CATCH_AND_RETURN_INVOKE(); 00109 } 00110 }; 00111 00112 }; 00113 00114 template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9> 00115 class QxFunction_9<void, R, P1, P2, P3, P4, P5, P6, P7, P8, P9> : public IxFunction 00116 { 00117 00118 public: 00119 00120 typedef boost::function<R (P1, P2, P3, P4, P5, P6, P7, P8, P9)> type_fct; 00121 typedef typename qx::trait::remove_attr<P1, false>::type type_P1; 00122 typedef typename qx::trait::remove_attr<P2, false>::type type_P2; 00123 typedef typename qx::trait::remove_attr<P3, false>::type type_P3; 00124 typedef typename qx::trait::remove_attr<P4, false>::type type_P4; 00125 typedef typename qx::trait::remove_attr<P5, false>::type type_P5; 00126 typedef typename qx::trait::remove_attr<P6, false>::type type_P6; 00127 typedef typename qx::trait::remove_attr<P7, false>::type type_P7; 00128 typedef typename qx::trait::remove_attr<P8, false>::type type_P8; 00129 typedef typename qx::trait::remove_attr<P9, false>::type type_P9; 00130 QX_FUNCTION_CLASS_FCT(QxFunction_9); 00131 00132 virtual qx_bool isValidParams(const QString & params) const { Q_UNUSED(params); return true; } 00133 virtual qx_bool isValidParams(const type_any_params & params) const { Q_UNUSED(params); return true; } 00134 00135 private: 00136 00137 template <class T, bool bReturnValue /* = false */> 00138 struct QxInvokerFct 00139 { 00140 static inline qx_bool invoke(const T & params, boost::any * ret, const QxFunction_9 * pThis) 00141 { 00142 QX_FUNCTION_INVOKE_START_WITHOUT_OWNER(); 00143 QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1); 00144 QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2); 00145 QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3); 00146 QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4); 00147 QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5); 00148 QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6); 00149 QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7); 00150 QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8); 00151 QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9); 00152 try { pThis->m_fct(p1, p2, p3, p4, p5, p6, p7, p8, p9); } 00153 QX_FUNCTION_CATCH_AND_RETURN_INVOKE(); 00154 } 00155 }; 00156 00157 template <class T> 00158 struct QxInvokerFct<T, true> 00159 { 00160 static inline qx_bool invoke(const T & params, boost::any * ret, const QxFunction_9 * pThis) 00161 { 00162 QX_FUNCTION_INVOKE_START_WITHOUT_OWNER(); 00163 QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1); 00164 QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2); 00165 QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3); 00166 QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4); 00167 QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5); 00168 QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6); 00169 QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7); 00170 QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8); 00171 QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9); 00172 try { R retTmp = pThis->m_fct(p1, p2, p3, p4, p5, p6, p7, p8, p9); if (ret) { (* ret) = boost::any(retTmp); } } 00173 QX_FUNCTION_CATCH_AND_RETURN_INVOKE(); 00174 } 00175 }; 00176 00177 }; 00178 00179 namespace function { 00180 00181 template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9> 00182 IxFunction_ptr bind_fct_9(const typename QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>::type_fct & fct) 00183 { 00184 typedef boost::is_same<Owner, void> qx_verify_owner_tmp; 00185 BOOST_STATIC_ASSERT(qx_verify_owner_tmp::value); 00186 IxFunction_ptr ptr; ptr.reset(new QxFunction_9<void, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>(fct)); 00187 return ptr; 00188 } 00189 00190 template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9> 00191 IxFunction_ptr bind_member_fct_9(const typename QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>::type_fct & fct) 00192 { 00193 typedef boost::is_same<Owner, void> qx_verify_owner_tmp; 00194 BOOST_STATIC_ASSERT(! qx_verify_owner_tmp::value); 00195 IxFunction_ptr ptr; ptr.reset(new QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>(fct)); 00196 return ptr; 00197 } 00198 00199 } // namespace function 00200 } // namespace qx 00201 00202 #endif // _QX_FUNCTION_9_H_