| QxOrm 1.2.5 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

QxFunction_7.h
Go to the documentation of this file.

    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_FUNCTION_7_H_
    00033 #define _QX_FUNCTION_7_H_
    00034
    00035 #ifdef _MSC_VER
    00036 #pragma once
    00037 #endif
    00038
    00046 #include <QxFunction/IxFunction.h>
    00047 #include <QxFunction/QxParameters.h>
    00048
    00049 namespace qx {
    00050
    00055 template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
    00056 class QxFunction_7 : public IxFunction
    00057 {
    00058
    00059 public:
    00060
    00061    typedef boost::function<R (Owner *, P1, P2, P3, P4, P5, P6, P7)> type_fct;
    00062    typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
    00063    typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
    00064    typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
    00065    typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
    00066    typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
    00067    typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
    00068    typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
    00069    QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_7);
    00070
    00071    virtual qx_bool isValidParams(const QString & params) const          { Q_UNUSED(params); return true; }
    00072    virtual qx_bool isValidParams(const type_any_params & params) const  { Q_UNUSED(params); return true; }
    00073
    00074 private:
    00075
    00076    template <class T, bool bReturnValue /* = false */>
    00077    struct QxInvokerFct
    00078    {
    00079       static inline qx_bool invoke(void * pOwner, const T & params, boost::any * ret, const QxFunction_7 * pThis)
    00080       {
    00081          QX_FUNCTION_INVOKE_START_WITH_OWNER();
    00082          QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
    00083          QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
    00084          QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
    00085          QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
    00086          QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
    00087          QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
    00088          QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
    00089          try { pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7); }
    00090          QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
    00091       }
    00092    };
    00093
    00094    template <class T>
    00095    struct QxInvokerFct<T, true>
    00096    {
    00097       static inline qx_bool invoke(void * pOwner, const T & params, boost::any * ret, const QxFunction_7 * pThis)
    00098       {
    00099          QX_FUNCTION_INVOKE_START_WITH_OWNER();
    00100          QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
    00101          QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
    00102          QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
    00103          QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
    00104          QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
    00105          QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
    00106          QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
    00107          try { R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7); 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>
    00115 class QxFunction_7<void, R, P1, P2, P3, P4, P5, P6, P7> : public IxFunction
    00116 {
    00117
    00118 public:
    00119
    00120    typedef boost::function<R (P1, P2, P3, P4, P5, P6, P7)> 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    QX_FUNCTION_CLASS_FCT(QxFunction_7);
    00129
    00130    virtual qx_bool isValidParams(const QString & params) const          { Q_UNUSED(params); return true; }
    00131    virtual qx_bool isValidParams(const type_any_params & params) const  { Q_UNUSED(params); return true; }
    00132
    00133 private:
    00134
    00135    template <class T, bool bReturnValue /* = false */>
    00136    struct QxInvokerFct
    00137    {
    00138       static inline qx_bool invoke(const T & params, boost::any * ret, const QxFunction_7 * pThis)
    00139       {
    00140          QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
    00141          QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
    00142          QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
    00143          QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
    00144          QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
    00145          QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
    00146          QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
    00147          QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
    00148          try { pThis->m_fct(p1, p2, p3, p4, p5, p6, p7); }
    00149          QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
    00150       }
    00151    };
    00152
    00153    template <class T>
    00154    struct QxInvokerFct<T, true>
    00155    {
    00156       static inline qx_bool invoke(const T & params, boost::any * ret, const QxFunction_7 * pThis)
    00157       {
    00158          QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
    00159          QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
    00160          QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
    00161          QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
    00162          QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
    00163          QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
    00164          QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
    00165          QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
    00166          try { R retTmp = pThis->m_fct(p1, p2, p3, p4, p5, p6, p7); if (ret) { (* ret) = boost::any(retTmp); } }
    00167          QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
    00168       }
    00169    };
    00170
    00171 };
    00172
    00173 namespace function {
    00174
    00175 template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
    00176 IxFunction_ptr bind_fct_7(const typename QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7>::type_fct & fct)
    00177 {
    00178    typedef boost::is_same<Owner, void> qx_verify_owner_tmp;
    00179    BOOST_STATIC_ASSERT(qx_verify_owner_tmp::value);
    00180    IxFunction_ptr ptr; ptr.reset(new QxFunction_7<void, R, P1, P2, P3, P4, P5, P6, P7>(fct));
    00181    return ptr;
    00182 }
    00183
    00184 template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
    00185 IxFunction_ptr bind_member_fct_7(const typename QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7>::type_fct & fct)
    00186 {
    00187    typedef boost::is_same<Owner, void> qx_verify_owner_tmp;
    00188    BOOST_STATIC_ASSERT(! qx_verify_owner_tmp::value);
    00189    IxFunction_ptr ptr; ptr.reset(new QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7>(fct));
    00190    return ptr;
    00191 }
    00192
    00193 } // namespace function
    00194 } // namespace qx
    00195
    00196 #endif // _QX_FUNCTION_7_H_