X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcontrib%2Fqxt%2Fqxtboundcfunction.h;fp=src%2Fcontrib%2Fqxt%2Fqxtboundcfunction.h;h=02ba5961cc6d3e9baebb79f0773822b4d1178759;hp=0000000000000000000000000000000000000000;hb=06a03c2c69ee934aaeec83512bae2fffee83a340;hpb=08da449f9620e7fcb5898e9a5a048467b6d99bff diff --git a/src/contrib/qxt/qxtboundcfunction.h b/src/contrib/qxt/qxtboundcfunction.h new file mode 100644 index 00000000..02ba5961 --- /dev/null +++ b/src/contrib/qxt/qxtboundcfunction.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) Qxt Foundation. Some rights reserved. +** +** This file is part of the QxtCore module of the Qt eXTension library +** +** This library is free software; you can redistribute it and/or modify it +** under the terms of th Common Public License, version 1.0, as published by +** IBM. +** +** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY +** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR +** FITNESS FOR A PARTICULAR PURPOSE. +** +** You should have received a copy of the CPL along with this file. +** See the LICENSE file and the cpl1.0.txt file included with the source +** distribution for more information. If you did not receive a copy of the +** license, contact the Qxt Foundation. +** +** +** +****************************************************************************/ + +#ifndef QXTBOUNDCFUNCTION_H +#define QXTBOUNDCFUNCTION_H + +#include +#include +#include +#include +#include +#include +#include +/* +template +class QxtBoundCFunction : public QxtBoundFunctionBase { +public: + FUNCTION funcPtr; + + QxtBoundCFunction(QObject* parent, FUNCTION funcPointer, QGenericArgument* params[argc], QByteArray types[argc]) : QxtBoundFunctionBase(parent, params, types), funcPtr(funcPointer) { + // initializers only, thanks to template magic + } + + virtual bool invokeImpl(Qt::ConnectionType type, QGenericReturnArgument returnValue, QXT_IMPL_10ARGS(QGenericArgument)) { + return qxt_invoke_cfunction_return(funcPtr, returnValue, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); + } +}; + +template +class QxtBoundCFunction : public QxtBoundFunctionBase { +public: + FUNCTION funcPtr; + + QxtBoundCFunction(QObject* parent, FUNCTION funcPointer, QGenericArgument* params[argc], QByteArray types[argc]) : QxtBoundFunctionBase(parent, params, types), funcPtr(funcPointer) { + // initializers only, thanks to template magic + } + + virtual bool invokeImpl(Qt::ConnectionType type, QGenericReturnArgument returnValue, QXT_IMPL_10ARGS(QGenericArgument)) { + return qxt_invoke_cfunction(funcPtr, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); + } +}; + +QGenericArgument* qbcfP[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +QByteArray types[10] = { "", "", "", "", "", "", "", "", "", "" }; + +void testFunction(int a) { a++; return; } +template < typename FP > QxtBoundFunction* testBind(FP fn) { return new QxtBoundCFunction(0, fn, qbcfP, types); } +QxtBoundCFunction qbcf(0, testFunction, qbcfP, types); +QxtBoundFunction* qbf = testBind(testFunction); +*/ +#endif