QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
QxFunctionMacro.h File Reference

Go to the source code of this file.

Macros

#define QX_FUNCTION_CLASS_FCT(className)
 
#define QX_FUNCTION_CLASS_MEMBER_FCT(className)
 
#define QX_FUNCTION_CATCH_AND_RETURN_INVOKE()
 
#define QX_FUNCTION_INVOKE_START_WITH_OWNER()
 
#define QX_FUNCTION_INVOKE_START_WITHOUT_OWNER()
 
#define QX_FUNCTION_FETCH_PARAM(TYPE, VALUE, FCT)
 
#define QX_FUNCTION_GET_PARAM_TYPE_ANY(PARAMCOUNT)
 
#define QX_FUNCTION_GET_PARAM_TYPE_STRING(PARAMCOUNT)
 
#define QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING(PARAMCOUNT)
 

Macro Definition Documentation

◆ QX_FUNCTION_CATCH_AND_RETURN_INVOKE

#define QX_FUNCTION_CATCH_AND_RETURN_INVOKE ( )
Value:
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;
qx::QxBool qx_bool
Definition QxBool.h:150
#define QX_FUNCTION_ERR_UNKNOWN_ERROR
#define qAssert(x)
Definition QxMacro.h:52

Definition at line 73 of file QxFunctionMacro.h.

◆ QX_FUNCTION_CLASS_FCT

#define QX_FUNCTION_CLASS_FCT ( className)
Value:
public: \
type_fct m_fct; \
className(type_fct fct) : IxFunction(), m_fct(fct) { ; }; \
virtual ~className() { ; }; \
virtual qx_bool invoke(const QString & params = 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 & params, 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 & params = 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 & params, 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_ERR_EMPTY_FCT
#define QX_FUNCTION_ERR_INVALID_INVOKE_CALL
qx_bool : boolean type with code and description message when an error occured
Definition QxBool.h:71

Definition at line 41 of file QxFunctionMacro.h.

◆ QX_FUNCTION_CLASS_MEMBER_FCT

#define QX_FUNCTION_CLASS_MEMBER_FCT ( className)
Value:
public: \
type_fct m_fct; \
className(type_fct fct) : IxFunction(), m_fct(fct) { ; }; \
virtual ~className() { ; }; \
virtual qx_bool invoke(void * pOwner, const QString & params = 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 & params, 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 & params = 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 & params, 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_ERR_EMPTY_MEMBER_FCT

Definition at line 57 of file QxFunctionMacro.h.

◆ QX_FUNCTION_FETCH_PARAM

#define QX_FUNCTION_FETCH_PARAM ( TYPE,
VALUE,
FCT )
Value:
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; } }
QString getDesc() const
Definition QxBool.h:97

Definition at line 89 of file QxFunctionMacro.h.

◆ QX_FUNCTION_GET_PARAM_TYPE_ANY

#define QX_FUNCTION_GET_PARAM_TYPE_ANY ( PARAMCOUNT)
Value:
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_ERR_INVALID_PARAM
#define QX_FUNCTION_ERR_NUMBER_PARAMS
ValueType * any_cast(any *)
Definition QxAny.h:133

Definition at line 94 of file QxFunctionMacro.h.

◆ QX_FUNCTION_GET_PARAM_TYPE_STRING

#define QX_FUNCTION_GET_PARAM_TYPE_STRING ( PARAMCOUNT)
Value:
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;
qx_bool from_string(const QString &s, T &t, const QString &format=QString(), int index=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
Definition QxConvert.h:78

Definition at line 102 of file QxFunctionMacro.h.

◆ QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING

#define QX_FUNCTION_GET_PARAM_TYPE_STRING_TO_QSTRING ( PARAMCOUNT)
Value:
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;

Definition at line 111 of file QxFunctionMacro.h.

◆ QX_FUNCTION_INVOKE_START_WITH_OWNER

#define QX_FUNCTION_INVOKE_START_WITH_OWNER ( )
Value:
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; }

Definition at line 79 of file QxFunctionMacro.h.

◆ QX_FUNCTION_INVOKE_START_WITHOUT_OWNER

#define QX_FUNCTION_INVOKE_START_WITHOUT_OWNER ( )
Value:
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; }

Definition at line 84 of file QxFunctionMacro.h.