lib

rubyextension.h
1/***************************************************************************
2 * rubyinterpreter.cpp
3 * This file is part of the KDE project
4 * copyright (C)2005 by Cyrille Berger (cberger@cberger.net)
5 *
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 ***************************************************************************/
19#ifndef KROSS_RUBYRUBYEXTENSION_H
20#define KROSS_RUBYRUBYEXTENSION_H
21
22#include <ruby.h>
23
24#include <api/class.h>
25#include <api/dict.h>
26#include <api/list.h>
27#include <api/object.h>
28
29namespace Kross {
30
31namespace Ruby {
32
33class RubyExtensionPrivate;
34
40 friend class RubyInterpreter;
41 friend class RubyModule;
42 friend class RubyScript;
43 public:
55 private:
59 static VALUE method_missing(int argc, VALUE *argv, VALUE self);
66 static VALUE call_method( Kross::Api::Object::Ptr obj, int argc, VALUE *argv);
70 static void delete_object(void* object);
74 static void delete_exception(void* object);
75 private: // Tests
79 static bool isOfExceptionType(VALUE obj);
83 static bool isOfObjectType(VALUE obj);
84 private: //Converting functions
89 static Kross::Api::Exception::Ptr convertToException(VALUE obj);
93 static VALUE convertFromException(Kross::Api::Exception::Ptr exc);
97 static int convertHash_i(VALUE key, VALUE value, VALUE vmap);
103 static Kross::Api::Object::Ptr toObject(VALUE value);
111 static VALUE toVALUE(const TQString& s);
112
118 static VALUE toVALUE(TQStringList list);
119
125 static VALUE toVALUE(TQStringVariantMap map);
126
132 static VALUE toVALUE(TQValueList<TQVariant> list);
138 static VALUE toVALUE(const TQVariant& variant);
139
145 static VALUE toVALUE(Kross::Api::Object::Ptr object);
146
152 static VALUE toVALUE(Kross::Api::List::Ptr list);
153 private:
155 RubyExtensionPrivate* d;
156 };
157
158}
159
160}
161
162#endif
TDESharedPtr< Exception > Ptr
Shared pointer to implement reference-counting.
Definition exception.h:45
TDESharedPtr< List > Ptr
Shared pointer to implement reference-counting.
Definition list.h:44
TDESharedPtr< Object > Ptr
Shared pointer to implement reference-counting.
Definition object.h:57
RubyExtension(Kross::Api::Object::Ptr object)
Constructor.
The Ruby plugin for the Kross scripting framework.
Definition rubyconfig.h:33
The Kross scripting bridge to embed scripting functionality into an application.
Definition callable.h:31