]> icculus.org git repositories - duncan/yast2-ruby-bindings.git/blob - src/ruby/YRubyNamespace.h
- Lot of fixes and support for the UI!!!
[duncan/yast2-ruby-bindings.git] / src / ruby / YRubyNamespace.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                                                                      |
10 | ruby language support                              (C) Novell Inc.   |
11 \----------------------------------------------------------------------/
12
13 Author: Duncan Mac-Vicar <dmacvicar@suse.de>
14
15 This program is free software; you can redistribute it and/or
16 modify it under the terms of the GNU General Public License
17 as published by the Free Software Foundation; either version
18 2 of the License, or (at your option) any later version.
19
20 */
21
22 #include <ruby.h>
23 #include <y2/Y2Namespace.h>
24 #include <y2/Y2Function.h>
25 #include <ycp/YStatement.h>
26
27 /**
28  * YaST interface to a Ruby module
29  */
30 class YRubyNamespace : public Y2Namespace
31 {
32 private:
33     string m_name;              //! this namespace's name, eg. XML::Writer
34     bool m_all_methods;         //! add the class name to all calls
35 public:
36     /**
37      * Construct an interface. The module must be already loaded
38      * @param name eg "XML::Writer"
39      */
40     YRubyNamespace (string name);
41
42     virtual ~YRubyNamespace ();
43
44     //! what namespace do we implement
45     virtual const string name () const { return m_name; }
46     //! used for error reporting
47     virtual const string filename () const;
48
49     //! unparse. useful  only for YCP namespaces??
50     virtual string toString () const;
51     //! called when evaluating the import statement
52     // constructor is handled separately
53     virtual YCPValue evaluate (bool cse = false);
54
55     virtual Y2Function* createFunctionCall (const string name, constFunctionTypePtr requiredType);
56 private:
57     VALUE _module_instance;
58 };