Rice  1.5.2
 All Classes Files Functions Variables Typedefs Friends Pages
Module_defn.hpp
1 #ifndef Rice__Module_defn__hpp_
2 #define Rice__Module_defn__hpp_
3 
4 #include "Object_defn.hpp"
5 #include "Module_impl.hpp"
6 #include "to_from_ruby_defn.hpp"
7 #include <memory>
8 
9 namespace Rice
10 {
11 
12 class Array;
13 class Class;
14 class String;
15 
17 
23 class Module
24  // TODO: we can't inherit from Builtin_Object, because Class needs
25  // type T_CLASS and Module needs type T_MODULE
26  : public Module_impl<Module_base, Module>
27 {
28 public:
30  Module();
31 
33  Module(VALUE v);
34 
36  String name() const;
37 
39  void swap(Module & other);
40 
42 
44  Array ancestors() const;
45 
47 
49  Class singleton_class() const;
50 };
51 
53 
56 Module define_module_under(
57  Object module,
58  char const * name);
59 
61 
63 Module define_module(
64  char const * name);
65 
67 
69 Module anonymous_module();
70 
71 } // namespace Rice
72 
73 template<>
74 inline
75 Rice::Module from_ruby<Rice::Module>(Rice::Object x)
76 {
77  return Rice::Module(x);
78 }
79 
80 template<>
81 inline
82 Rice::Object to_ruby<Rice::Module>(Rice::Module const & x)
83 {
84  return x;
85 }
86 
87 #endif // Rice__Module_defn__hpp_
88 
Definition: Module_impl.hpp:47
Class singleton_class() const
Return the module&#39;s singleton class.
A Wraper for the ruby String class.
Definition: String.hpp:23
String name() const
Return the name of the module.
Module()
Default construct a Module and initialize it to rb_cObject.
A helper for defining a Module and its methods.
Definition: Module_defn.hpp:23
A helper for defining a Class and its methods.
Definition: Class_defn.hpp:21
The base class for all Objects.
Definition: Object_defn.hpp:23
Array ancestors() const
Return an array containing the Module&#39;s ancestors.
void swap(Module &other)
Swap with another Module.
A wrapper for the ruby Array class.
Definition: Array.hpp:22