1 /***************************************************************************
3 * This file is part of the KDE project
4 * copyright (C)2006 by Cyrille Berger (cberger@cberger.net)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
20 #ifndef KROSS_RUBYCALLCACHE_H
21 #define KROSS_RUBYCALLCACHE_H
23 #include "rubyconfig.h"
25 #include <QVarLengthArray>
31 struct RubyCallCachePrivate
;
34 * The RubyCallCache class implements a cache for calling functions
35 * within the RubyExtension::callMetaMethod() method.
44 * \param object The QObject that provides the method that
46 * \param methodindex The method-index. The methods are
47 * accessible by there index cause of performance reasons.
48 * \param hasreturnvalue If true then the method does
49 * provide a return-value else the method doesn't provide
50 * anything back (void).
51 * \param ntypes Array of QVariant::Type numbers for the
52 * return-value (index 0) and the arguments (index >=1).
53 * \param nmetatypes Array of QMetaType::Type numbers for the
54 * return-value (index 0) and the arguments (index >=1).
56 RubyCallCache(QObject
* object
, int methodindex
, bool hasreturnvalue
, QVarLengthArray
<int> ntypes
, QVarLengthArray
<int> nmetatypes
);
64 * Execute the method and pass \p argc numbers of
65 * arguments as \p argv array to the method.
67 VALUE
execfunction( int argc
, VALUE
*argv
);
70 * Executes the method using the call-cache.
75 * Static function that executes the method using the call-cache.
77 static VALUE
method_cacheexec(int argc
, VALUE
*argv
, VALUE self
);
80 * Called by Ruby if an call-cache object got destructed.
82 static void delete_object(void* object
);
85 RubyCallCachePrivate
* const d
;