first commit
This commit is contained in:
161
include/QxFunction/IxFunction.h
Normal file
161
include/QxFunction/IxFunction.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _IX_FUNCTION_H_
|
||||
#define _IX_FUNCTION_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file IxFunction.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Common interface for all functions registered into QxOrm context (used by introspection engine)
|
||||
*/
|
||||
|
||||
#include <QxCommon/QxAny.h>
|
||||
#include <QxCommon/QxBool.h>
|
||||
#include <QxCommon/QxPropertyBag.h>
|
||||
|
||||
#include <QxCollection/QxCollection.h>
|
||||
|
||||
#include <QxFunction/QxFunctionError.h>
|
||||
#include <QxFunction/QxFunctionMacro.h>
|
||||
|
||||
#include <QxTraits/remove_attr.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::IxFunction : common interface for all functions registered into QxOrm context (used by introspection engine)
|
||||
*/
|
||||
class IxFunction : public qx::QxPropertyBag
|
||||
{
|
||||
|
||||
protected:
|
||||
QString m_sKey; //!< Function key
|
||||
QString m_sSeparator; //!< Separator character(s) for 'QString' parameters type
|
||||
QString m_sDescription; //!< Function description
|
||||
|
||||
public:
|
||||
typedef std::vector<qx::any> type_any_params;
|
||||
|
||||
IxFunction() : qx::QxPropertyBag(), m_sSeparator("|") { ; }
|
||||
virtual ~IxFunction() { ; }
|
||||
|
||||
QString getKey() const { return m_sKey; }
|
||||
QString getSeparator() const { return m_sSeparator; }
|
||||
QString getDescription() const { return m_sDescription; }
|
||||
|
||||
void setKey(const QString &s) { m_sKey = s; }
|
||||
void setSeparator(const QString &s) { m_sSeparator = s; }
|
||||
void setDescription(const QString &s) { m_sDescription = s; }
|
||||
|
||||
virtual int getParamCount() const = 0;
|
||||
|
||||
virtual qx_bool invoke(const QString ¶ms = QString(), qx::any *ret = NULL) const = 0;
|
||||
virtual qx_bool invoke(const type_any_params ¶ms, qx::any *ret = NULL) const = 0;
|
||||
virtual qx_bool invoke(void *pOwner, const QString ¶ms = QString(), qx::any *ret = NULL) const = 0;
|
||||
virtual qx_bool invoke(void *pOwner, const type_any_params ¶ms, qx::any *ret = NULL) const = 0;
|
||||
|
||||
virtual qx_bool isValidFct() const = 0;
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const = 0;
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const = 0;
|
||||
|
||||
template <class T>
|
||||
qx_bool isValidOwner(void *pOwner, T *dummy) const
|
||||
{
|
||||
Q_UNUSED(dummy);
|
||||
typedef std::is_same<T, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
if (!pOwner)
|
||||
{
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_NULL_OWNER);
|
||||
}
|
||||
#ifndef _QX_NO_RTTI
|
||||
if (!dynamic_cast<T *>(static_cast<T *>(pOwner)))
|
||||
{
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_INVALID_OWNER);
|
||||
}
|
||||
#endif // _QX_NO_RTTI
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
qx_bool isValid(const T ¶ms) const
|
||||
{
|
||||
qx_bool bValid = isValidFct();
|
||||
if (!bValid)
|
||||
{
|
||||
return bValid;
|
||||
};
|
||||
bValid = isValidParams(params);
|
||||
if (!bValid)
|
||||
{
|
||||
return bValid;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
qx_bool isValid(void *pOwner, const T ¶ms, U *dummy) const
|
||||
{
|
||||
Q_UNUSED(dummy);
|
||||
qx_bool bValid = isValidFct();
|
||||
if (!bValid)
|
||||
{
|
||||
return bValid;
|
||||
};
|
||||
bValid = isValidParams(params);
|
||||
if (!bValid)
|
||||
{
|
||||
return bValid;
|
||||
};
|
||||
bValid = isValidOwner<U>(pOwner, NULL);
|
||||
if (!bValid)
|
||||
{
|
||||
return bValid;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IxFunction> IxFunction_ptr;
|
||||
typedef QxCollection<QString, IxFunction_ptr> IxFunctionX;
|
||||
typedef std::shared_ptr<IxFunctionX> IxFunctionX_ptr;
|
||||
|
||||
} // namespace qx
|
||||
|
||||
#endif // _IX_FUNCTION_H_
|
||||
57
include/QxFunction/QxFunctionError.h
Normal file
57
include/QxFunction/QxFunctionError.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_ERROR_H_
|
||||
#define _QX_FUNCTION_ERROR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunctionError.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Define all messages when an error occured using QxFunction module of QxOrm library
|
||||
*/
|
||||
|
||||
#define QX_FUNCTION_ERR_NUMBER_PARAMS "Incorrect parameters count"
|
||||
#define QX_FUNCTION_ERR_INVALID_PARAM "Invalid parameter at position 'XXX'"
|
||||
#define QX_FUNCTION_ERR_INVALID_FCT "Invalid function"
|
||||
#define QX_FUNCTION_ERR_EMPTY_FCT "Empty function"
|
||||
#define QX_FUNCTION_ERR_INVALID_MEMBER_FCT "Invalid member function"
|
||||
#define QX_FUNCTION_ERR_EMPTY_MEMBER_FCT "Empty member function"
|
||||
#define QX_FUNCTION_ERR_INVALID_OWNER "Invalid owner"
|
||||
#define QX_FUNCTION_ERR_NULL_OWNER "NULL owner"
|
||||
#define QX_FUNCTION_ERR_INVALID_INVOKE_CALL "Invalid 'invoke()' call"
|
||||
#define QX_FUNCTION_ERR_UNKNOWN_ERROR "Unknown error calling function"
|
||||
|
||||
#endif // _QX_FUNCTION_ERROR_H_
|
||||
51
include/QxFunction/QxFunctionInclude.h
Normal file
51
include/QxFunction/QxFunctionInclude.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_INCLUDE_H_
|
||||
#define _QX_FUNCTION_INCLUDE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxFunction_0.h>
|
||||
#include <QxFunction/QxFunction_1.h>
|
||||
#include <QxFunction/QxFunction_2.h>
|
||||
#include <QxFunction/QxFunction_3.h>
|
||||
#include <QxFunction/QxFunction_4.h>
|
||||
#include <QxFunction/QxFunction_5.h>
|
||||
#include <QxFunction/QxFunction_6.h>
|
||||
#include <QxFunction/QxFunction_7.h>
|
||||
#include <QxFunction/QxFunction_8.h>
|
||||
#include <QxFunction/QxFunction_9.h>
|
||||
|
||||
#endif // _QX_FUNCTION_INCLUDE_H_
|
||||
210
include/QxFunction/QxFunctionMacro.h
Normal file
210
include/QxFunction/QxFunctionMacro.h
Normal file
@@ -0,0 +1,210 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_MACRO_H_
|
||||
#define _QX_FUNCTION_MACRO_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxConvert/QxConvert.h>
|
||||
|
||||
#define QX_FUNCTION_CLASS_FCT(className) \
|
||||
public: \
|
||||
type_fct m_fct; \
|
||||
className(type_fct fct) : IxFunction(), m_fct(fct) { ; }; \
|
||||
virtual ~className() { ; }; \
|
||||
virtual qx_bool invoke(const QString ¶ms = QString(), qx::any *ret = NULL) const \
|
||||
{ \
|
||||
return QxInvokerFct<QString, !std::is_same<R, void>::value>::invoke(params, ret, this); \
|
||||
} \
|
||||
virtual qx_bool invoke(const type_any_params ¶ms, qx::any *ret = NULL) const \
|
||||
{ \
|
||||
return QxInvokerFct<type_any_params, !std::is_same<R, void>::value>::invoke(params, ret, this); \
|
||||
} \
|
||||
virtual qx_bool invoke(void *pOwner, const QString ¶ms = QString(), qx::any *ret = NULL) const \
|
||||
{ \
|
||||
Q_UNUSED(pOwner); \
|
||||
Q_UNUSED(params); \
|
||||
Q_UNUSED(ret); \
|
||||
qAssert(false); \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_INVALID_INVOKE_CALL); \
|
||||
} \
|
||||
virtual qx_bool invoke(void *pOwner, const type_any_params ¶ms, qx::any *ret = NULL) const \
|
||||
{ \
|
||||
Q_UNUSED(pOwner); \
|
||||
Q_UNUSED(params); \
|
||||
Q_UNUSED(ret); \
|
||||
qAssert(false); \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_INVALID_INVOKE_CALL); \
|
||||
} \
|
||||
virtual qx_bool isValidFct() const \
|
||||
{ \
|
||||
return ((!m_fct) ? qx_bool(false, 0, QX_FUNCTION_ERR_EMPTY_FCT) : qx_bool(true)); \
|
||||
}
|
||||
|
||||
#define QX_FUNCTION_CLASS_MEMBER_FCT(className) \
|
||||
public: \
|
||||
type_fct m_fct; \
|
||||
className(type_fct fct) : IxFunction(), m_fct(fct) { ; }; \
|
||||
virtual ~className() { ; }; \
|
||||
virtual qx_bool invoke(void *pOwner, const QString ¶ms = QString(), qx::any *ret = NULL) const \
|
||||
{ \
|
||||
return QxInvokerFct<QString, !std::is_same<R, void>::value>::invoke(pOwner, params, ret, this); \
|
||||
} \
|
||||
virtual qx_bool invoke(void *pOwner, const type_any_params ¶ms, qx::any *ret = NULL) const \
|
||||
{ \
|
||||
return QxInvokerFct<type_any_params, !std::is_same<R, void>::value>::invoke(pOwner, params, ret, this); \
|
||||
} \
|
||||
virtual qx_bool invoke(const QString ¶ms = QString(), qx::any *ret = NULL) const \
|
||||
{ \
|
||||
Q_UNUSED(params); \
|
||||
Q_UNUSED(ret); \
|
||||
qAssert(false); \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_INVALID_INVOKE_CALL); \
|
||||
} \
|
||||
virtual qx_bool invoke(const type_any_params ¶ms, qx::any *ret = NULL) const \
|
||||
{ \
|
||||
Q_UNUSED(params); \
|
||||
Q_UNUSED(ret); \
|
||||
qAssert(false); \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_INVALID_INVOKE_CALL); \
|
||||
} \
|
||||
virtual qx_bool isValidFct() const \
|
||||
{ \
|
||||
return ((!m_fct) ? qx_bool(false, 0, QX_FUNCTION_ERR_EMPTY_MEMBER_FCT) : qx_bool(true)); \
|
||||
}
|
||||
|
||||
#define QX_FUNCTION_CATCH_AND_RETURN_INVOKE() \
|
||||
catch (const std::exception &e) { bValid = qx_bool(false, 0, e.what()); } \
|
||||
catch (...) { bValid = qx_bool(false, 0, QX_FUNCTION_ERR_UNKNOWN_ERROR); } \
|
||||
if (!bValid) \
|
||||
{ \
|
||||
QString sMsgDebug = bValid.getDesc(); \
|
||||
qDebug("[QxOrm] %s", qPrintable(sMsgDebug)); \
|
||||
qAssert(false); \
|
||||
} \
|
||||
return bValid;
|
||||
|
||||
#define QX_FUNCTION_INVOKE_START_WITH_OWNER() \
|
||||
if (ret) \
|
||||
{ \
|
||||
(*ret) = qx::any(); \
|
||||
} \
|
||||
qx_bool bValid = pThis->isValid<T, Owner>(pOwner, params, NULL); \
|
||||
if (!bValid) \
|
||||
{ \
|
||||
QString sMsgDebug = bValid.getDesc(); \
|
||||
qDebug("[QxOrm] %s", qPrintable(sMsgDebug)); \
|
||||
qAssert(false); \
|
||||
return bValid; \
|
||||
}
|
||||
|
||||
#define QX_FUNCTION_INVOKE_START_WITHOUT_OWNER() \
|
||||
if (ret) \
|
||||
{ \
|
||||
(*ret) = qx::any(); \
|
||||
} \
|
||||
qx_bool bValid = pThis->isValid(params); \
|
||||
if (!bValid) \
|
||||
{ \
|
||||
QString sMsgDebug = bValid.getDesc(); \
|
||||
qDebug("[QxOrm] %s", qPrintable(sMsgDebug)); \
|
||||
qAssert(false); \
|
||||
return bValid; \
|
||||
}
|
||||
|
||||
#define QX_FUNCTION_FETCH_PARAM(TYPE, VALUE, FCT) \
|
||||
typename std::remove_const<TYPE>::type VALUE; \
|
||||
{ \
|
||||
qx_bool bTmp = qx::function::detail::FCT(params, VALUE, pThis); \
|
||||
if (!bTmp) \
|
||||
{ \
|
||||
QString sMsgDebug = bTmp.getDesc(); \
|
||||
qDebug("[QxOrm] %s", qPrintable(sMsgDebug)); \
|
||||
qAssert(false); \
|
||||
return bTmp; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define QX_FUNCTION_GET_PARAM_TYPE_ANY(PARAMCOUNT) \
|
||||
Q_UNUSED(qx_fct); \
|
||||
if (params.size() < PARAMCOUNT) \
|
||||
{ \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_NUMBER_PARAMS); \
|
||||
} \
|
||||
qx_bool bValid = true; \
|
||||
try \
|
||||
{ \
|
||||
p = qx::any_cast<P>(params[PARAMCOUNT - 1]); \
|
||||
} \
|
||||
catch (...) \
|
||||
{ \
|
||||
bValid = qx_bool(false, 0, QString(QX_FUNCTION_ERR_INVALID_PARAM).replace("XXX", QString::number(PARAMCOUNT))); \
|
||||
} \
|
||||
return bValid;
|
||||
|
||||
#define QX_FUNCTION_GET_PARAM_TYPE_STRING(PARAMCOUNT) \
|
||||
if (!qx_fct) \
|
||||
{ \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_UNKNOWN_ERROR); \
|
||||
} \
|
||||
QStringList lst = params.split(qx_fct->getSeparator()); \
|
||||
if (lst.size() < PARAMCOUNT) \
|
||||
{ \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_NUMBER_PARAMS); \
|
||||
} \
|
||||
qx_bool bValid = true; \
|
||||
try \
|
||||
{ \
|
||||
bValid = qx::cvt::from_string(lst.at(PARAMCOUNT - 1), p); \
|
||||
} \
|
||||
catch (...) \
|
||||
{ \
|
||||
bValid = qx_bool(false, 0, QString(QX_FUNCTION_ERR_INVALID_PARAM).replace("XXX", QString::number(PARAMCOUNT))); \
|
||||
} \
|
||||
return bValid;
|
||||
|
||||
#define QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(PARAMCOUNT) \
|
||||
if (!qx_fct) \
|
||||
{ \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_UNKNOWN_ERROR); \
|
||||
} \
|
||||
QStringList lst = params.split(qx_fct->getSeparator()); \
|
||||
if (lst.size() < PARAMCOUNT) \
|
||||
{ \
|
||||
return qx_bool(false, 0, QX_FUNCTION_ERR_NUMBER_PARAMS); \
|
||||
} \
|
||||
p = lst.at(PARAMCOUNT - 1); \
|
||||
return true;
|
||||
|
||||
#endif // _QX_FUNCTION_MACRO_H_
|
||||
188
include/QxFunction/QxFunction_0.h
Normal file
188
include/QxFunction/QxFunction_0.h
Normal file
@@ -0,0 +1,188 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_0_H_
|
||||
#define _QX_FUNCTION_0_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_0.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context without parameter
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_0<Owner, R> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and without parameter
|
||||
*/
|
||||
template <class Owner, typename R>
|
||||
class QxFunction_0 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *)> type_fct;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_0);
|
||||
|
||||
virtual int getParamCount() const { return 0; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_0 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner));
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_0 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner));
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
class QxFunction_0<void, R> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R()> type_fct;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_0);
|
||||
|
||||
virtual int getParamCount() const { return 0; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_0 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
try
|
||||
{
|
||||
pThis->m_fct();
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_0 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct();
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R>
|
||||
IxFunction_ptr bind_fct_0(const typename QxFunction_0<Owner, R>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_0<void, R>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R>
|
||||
IxFunction_ptr bind_member_fct_0(const typename QxFunction_0<Owner, R>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_0<Owner, R>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_0_H_
|
||||
194
include/QxFunction/QxFunction_1.h
Normal file
194
include/QxFunction/QxFunction_1.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_1_H_
|
||||
#define _QX_FUNCTION_1_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_1.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 1 parameter
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_1<Owner, R, P1> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 1 parameter P1
|
||||
*/
|
||||
template <class Owner, typename R, typename P1>
|
||||
class QxFunction_1 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_1);
|
||||
|
||||
virtual int getParamCount() const { return 1; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_1 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_1 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1>
|
||||
class QxFunction_1<void, R, P1> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_1);
|
||||
|
||||
virtual int getParamCount() const { return 1; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_1 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_1 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1>
|
||||
IxFunction_ptr bind_fct_1(const typename QxFunction_1<Owner, R, P1>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_1<void, R, P1>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1>
|
||||
IxFunction_ptr bind_member_fct_1(const typename QxFunction_1<Owner, R, P1>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_1<Owner, R, P1>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_1_H_
|
||||
200
include/QxFunction/QxFunction_2.h
Normal file
200
include/QxFunction/QxFunction_2.h
Normal file
@@ -0,0 +1,200 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_2_H_
|
||||
#define _QX_FUNCTION_2_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_2.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 2 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_2<Owner, R, P1, P2> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 2 parameters P1, P2
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2>
|
||||
class QxFunction_2 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_2);
|
||||
|
||||
virtual int getParamCount() const { return 2; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_2 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_2 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2>
|
||||
class QxFunction_2<void, R, P1, P2> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_2);
|
||||
|
||||
virtual int getParamCount() const { return 2; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_2 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_2 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2>
|
||||
IxFunction_ptr bind_fct_2(const typename QxFunction_2<Owner, R, P1, P2>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_2<void, R, P1, P2>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2>
|
||||
IxFunction_ptr bind_member_fct_2(const typename QxFunction_2<Owner, R, P1, P2>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_2<Owner, R, P1, P2>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_2_H_
|
||||
206
include/QxFunction/QxFunction_3.h
Normal file
206
include/QxFunction/QxFunction_3.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_3_H_
|
||||
#define _QX_FUNCTION_3_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_3.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 3 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_3<Owner, R, P1, P2, P3> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 3 parameters P1, P2, P3
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3>
|
||||
class QxFunction_3 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_3);
|
||||
|
||||
virtual int getParamCount() const { return 3; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_3 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_3 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3>
|
||||
class QxFunction_3<void, R, P1, P2, P3> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_3);
|
||||
|
||||
virtual int getParamCount() const { return 3; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_3 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_3 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3>
|
||||
IxFunction_ptr bind_fct_3(const typename QxFunction_3<Owner, R, P1, P2, P3>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_3<void, R, P1, P2, P3>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3>
|
||||
IxFunction_ptr bind_member_fct_3(const typename QxFunction_3<Owner, R, P1, P2, P3>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_3<Owner, R, P1, P2, P3>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_3_H_
|
||||
212
include/QxFunction/QxFunction_4.h
Normal file
212
include/QxFunction/QxFunction_4.h
Normal file
@@ -0,0 +1,212 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_4_H_
|
||||
#define _QX_FUNCTION_4_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_4.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 4 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_4<Owner, R, P1, P2, P3, P4> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 4 parameters P1, P2, P3, P4
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4>
|
||||
class QxFunction_4 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3, P4)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_4);
|
||||
|
||||
virtual int getParamCount() const { return 4; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_4 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_4 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3, typename P4>
|
||||
class QxFunction_4<void, R, P1, P2, P3, P4> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3, P4)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_4);
|
||||
|
||||
virtual int getParamCount() const { return 4; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_4 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3, p4);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_4 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3, p4);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4>
|
||||
IxFunction_ptr bind_fct_4(const typename QxFunction_4<Owner, R, P1, P2, P3, P4>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_4<void, R, P1, P2, P3, P4>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4>
|
||||
IxFunction_ptr bind_member_fct_4(const typename QxFunction_4<Owner, R, P1, P2, P3, P4>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_4<Owner, R, P1, P2, P3, P4>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_4_H_
|
||||
218
include/QxFunction/QxFunction_5.h
Normal file
218
include/QxFunction/QxFunction_5.h
Normal file
@@ -0,0 +1,218 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_5_H_
|
||||
#define _QX_FUNCTION_5_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_5.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 5 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_5<Owner, R, P1, P2, P3, P4, P5> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 5 parameters P1, P2, P3, P4, P5
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
||||
class QxFunction_5 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3, P4, P5)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_5);
|
||||
|
||||
virtual int getParamCount() const { return 5; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_5 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_5 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
||||
class QxFunction_5<void, R, P1, P2, P3, P4, P5> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3, P4, P5)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_5);
|
||||
|
||||
virtual int getParamCount() const { return 5; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_5 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3, p4, p5);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_5 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3, p4, p5);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
||||
IxFunction_ptr bind_fct_5(const typename QxFunction_5<Owner, R, P1, P2, P3, P4, P5>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_5<void, R, P1, P2, P3, P4, P5>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
||||
IxFunction_ptr bind_member_fct_5(const typename QxFunction_5<Owner, R, P1, P2, P3, P4, P5>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_5<Owner, R, P1, P2, P3, P4, P5>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_5_H_
|
||||
224
include/QxFunction/QxFunction_6.h
Normal file
224
include/QxFunction/QxFunction_6.h
Normal file
@@ -0,0 +1,224 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_6_H_
|
||||
#define _QX_FUNCTION_6_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_6.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 6 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_6<Owner, R, P1, P2, P3, P4, P5, P6> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 6 parameters P1, P2, P3, P4, P5, P6
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
||||
class QxFunction_6 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3, P4, P5, P6)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_6);
|
||||
|
||||
virtual int getParamCount() const { return 6; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_6 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_6 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
||||
class QxFunction_6<void, R, P1, P2, P3, P4, P5, P6> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3, P4, P5, P6)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_6);
|
||||
|
||||
virtual int getParamCount() const { return 6; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_6 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_6 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3, p4, p5, p6);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
||||
IxFunction_ptr bind_fct_6(const typename QxFunction_6<Owner, R, P1, P2, P3, P4, P5, P6>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_6<void, R, P1, P2, P3, P4, P5, P6>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
||||
IxFunction_ptr bind_member_fct_6(const typename QxFunction_6<Owner, R, P1, P2, P3, P4, P5, P6>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_6<Owner, R, P1, P2, P3, P4, P5, P6>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_6_H_
|
||||
230
include/QxFunction/QxFunction_7.h
Normal file
230
include/QxFunction/QxFunction_7.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_7_H_
|
||||
#define _QX_FUNCTION_7_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_7.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 7 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 7 parameters P1, P2, P3, P4, P5, P6, P7
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
||||
class QxFunction_7 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3, P4, P5, P6, P7)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_7);
|
||||
|
||||
virtual int getParamCount() const { return 7; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_7 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_7 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
||||
class QxFunction_7<void, R, P1, P2, P3, P4, P5, P6, P7> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3, P4, P5, P6, P7)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_7);
|
||||
|
||||
virtual int getParamCount() const { return 7; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_7 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_7 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3, p4, p5, p6, p7);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
||||
IxFunction_ptr bind_fct_7(const typename QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_7<void, R, P1, P2, P3, P4, P5, P6, P7>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
||||
IxFunction_ptr bind_member_fct_7(const typename QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_7<Owner, R, P1, P2, P3, P4, P5, P6, P7>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_7_H_
|
||||
236
include/QxFunction/QxFunction_8.h
Normal file
236
include/QxFunction/QxFunction_8.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_8_H_
|
||||
#define _QX_FUNCTION_8_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_8.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 8 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_8<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 8 parameters P1, P2, P3, P4, P5, P6, P7, P8
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
||||
class QxFunction_8 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3, P4, P5, P6, P7, P8)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
|
||||
typedef typename qx::trait::remove_attr<P8, false>::type type_P8;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_8);
|
||||
|
||||
virtual int getParamCount() const { return 8; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_8 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_8 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
||||
class QxFunction_8<void, R, P1, P2, P3, P4, P5, P6, P7, P8> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3, P4, P5, P6, P7, P8)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
|
||||
typedef typename qx::trait::remove_attr<P8, false>::type type_P8;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_8);
|
||||
|
||||
virtual int getParamCount() const { return 8; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_8 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_8 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
||||
IxFunction_ptr bind_fct_8(const typename QxFunction_8<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_8<void, R, P1, P2, P3, P4, P5, P6, P7, P8>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
||||
IxFunction_ptr bind_member_fct_8(const typename QxFunction_8<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_8<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_8_H_
|
||||
242
include/QxFunction/QxFunction_9.h
Normal file
242
include/QxFunction/QxFunction_9.h
Normal file
@@ -0,0 +1,242 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_FUNCTION_9_H_
|
||||
#define _QX_FUNCTION_9_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxFunction_9.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief Concrete function class registered into QxOrm context with 9 parameters
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
#include <QxFunction/QxParameters.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9> : concrete function registered into QxOrm context defined into class Owner, returning an object of type R and with 9 parameters P1, P2, P3, P4, P5, P6, P7, P8, P9
|
||||
*/
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
||||
class QxFunction_9 : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(Owner *, P1, P2, P3, P4, P5, P6, P7, P8, P9)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
|
||||
typedef typename qx::trait::remove_attr<P8, false>::type type_P8;
|
||||
typedef typename qx::trait::remove_attr<P9, false>::type type_P9;
|
||||
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_9);
|
||||
|
||||
virtual int getParamCount() const { return 9; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_9 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(void *pOwner, const T ¶ms, qx::any *ret, const QxFunction_9 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITH_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
||||
class QxFunction_9<void, R, P1, P2, P3, P4, P5, P6, P7, P8, P9> : public IxFunction
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::function<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)> type_fct;
|
||||
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
|
||||
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
|
||||
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
|
||||
typedef typename qx::trait::remove_attr<P4, false>::type type_P4;
|
||||
typedef typename qx::trait::remove_attr<P5, false>::type type_P5;
|
||||
typedef typename qx::trait::remove_attr<P6, false>::type type_P6;
|
||||
typedef typename qx::trait::remove_attr<P7, false>::type type_P7;
|
||||
typedef typename qx::trait::remove_attr<P8, false>::type type_P8;
|
||||
typedef typename qx::trait::remove_attr<P9, false>::type type_P9;
|
||||
QX_FUNCTION_CLASS_FCT(QxFunction_9);
|
||||
|
||||
virtual int getParamCount() const { return 9; }
|
||||
virtual qx_bool isValidParams(const QString ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
virtual qx_bool isValidParams(const type_any_params ¶ms) const
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T, bool bReturnValue /* = false */>
|
||||
struct QxInvokerFct
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_9 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9);
|
||||
try
|
||||
{
|
||||
pThis->m_fct(p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QxInvokerFct<T, true>
|
||||
{
|
||||
static inline qx_bool invoke(const T ¶ms, qx::any *ret, const QxFunction_9 *pThis)
|
||||
{
|
||||
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
|
||||
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P4, p4, get_param_4);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P5, p5, get_param_5);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P6, p6, get_param_6);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P7, p7, get_param_7);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P8, p8, get_param_8);
|
||||
QX_FUNCTION_FETCH_PARAM(type_P9, p9, get_param_9);
|
||||
try
|
||||
{
|
||||
R retTmp = pThis->m_fct(p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
if (ret)
|
||||
{
|
||||
(*ret) = qx::any(retTmp);
|
||||
}
|
||||
}
|
||||
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
||||
IxFunction_ptr bind_fct_9(const typename QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(qx_verify_owner_tmp::value, "qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_9<void, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class Owner, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
||||
IxFunction_ptr bind_member_fct_9(const typename QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>::type_fct &fct)
|
||||
{
|
||||
typedef std::is_same<Owner, void> qx_verify_owner_tmp;
|
||||
static_assert(!qx_verify_owner_tmp::value, "! qx_verify_owner_tmp::value");
|
||||
IxFunction_ptr ptr = std::make_shared<QxFunction_9<Owner, R, P1, P2, P3, P4, P5, P6, P7, P8, P9>>(fct);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_FUNCTION_9_H_
|
||||
140
include/QxFunction/QxParameters.h
Normal file
140
include/QxFunction/QxParameters.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QX_PARAMETERS_H_
|
||||
#define _QX_PARAMETERS_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxParameters.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxFunction
|
||||
* \brief qx::function::detail::get_param_X() : provide some helper functions to retrieve parameters for all qx::IxFunction registered into QxOrm context
|
||||
*/
|
||||
|
||||
#include <QxFunction/IxFunction.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace function
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_1(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(1); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_2(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(2); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_3(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(3); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_4(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(4); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_5(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(5); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_6(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(6); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_7(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(7); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_8(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(8); }
|
||||
|
||||
template <class T, typename P>
|
||||
inline qx_bool get_param_9(const T ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_ANY(9); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_1(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(1); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_2(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(2); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_3(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(3); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_4(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(4); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_5(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(5); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_6(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(6); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_7(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(7); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_8(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(8); }
|
||||
|
||||
template <typename P>
|
||||
inline qx_bool get_param_9(const QString ¶ms, P &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING(9); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_1(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(1); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_2(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(2); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_3(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(3); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_4(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(4); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_5(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(5); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_6(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(6); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_7(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(7); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_8(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(8); }
|
||||
|
||||
template <>
|
||||
inline qx_bool get_param_9(const QString ¶ms, QString &p, const qx::IxFunction *qx_fct) { QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(9); }
|
||||
|
||||
} // namespace detail
|
||||
} // namespace function
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_PARAMETERS_H_
|
||||
Reference in New Issue
Block a user