* Added command line tool example similar to 'sopranocmd'
[kdebindings.git] / ruby / krossruby / rubyinterpreter.h
blob22e1368bb3bbbe98e6f989e66e983f44eae9bb36
1 /***************************************************************************
2 * rubyinterpreter.h
3 * This file is part of the KDE project
4 * copyright (C)2005 by Cyrille Berger (cberger@cberger.net)
5 * copyright (C)2006 by Sebastian Sauer (mail@dipe.org)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this program; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 ***************************************************************************/
21 #ifndef KROSS_RUBYRUBYINTERPRETER_H
22 #define KROSS_RUBYRUBYINTERPRETER_H
24 #include "rubyconfig.h"
26 #include <kross/core/krossconfig.h>
27 #include <kross/core/interpreter.h>
29 #include <QPointer>
31 namespace Kross {
33 class RubyModule;
34 class RubyInterpreterPrivate;
36 /**
37 * This class is the bridget between Kross and Ruby.
38 * @author Cyrille Berger
40 class RubyInterpreter : public Kross::Interpreter
42 public:
44 /**
45 * Constructor
47 * @param info The \a Kross::InterpreterInfo instance
48 * that describes this \a RubyInterpreter .
50 explicit RubyInterpreter(Kross::InterpreterInfo* info);
52 /**
53 * Destructor.
55 virtual ~RubyInterpreter();
57 /**
58 * Factory method to create and return a new \a RubyScript instance.
60 virtual Kross::Script* createScript(Kross::Action* action);
62 /**
63 * @return the hash of \a RubyModule instances we know about.
65 QHash<QString, QPointer<RubyModule> > modules() const;
66 public:
67 /**
68 * @return the ruby object with the module Kross, this module holds class
69 * definition used by kross, and scripts object. All kross specific objects
70 * should be member of that module.
72 static VALUE krossModule();
74 private:
75 /// Initialize the ruby interpreter.
76 void initRuby();
77 /// Finalize the ruby interpreter.
78 void finalizeRuby();
79 /// Load an external plugin / module.
80 static VALUE require (VALUE, VALUE);
81 private:
82 /// Private d-pointer.
83 static RubyInterpreterPrivate * d;
88 #endif