Ruby: include/ruby/internal/intern/class.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

class.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_CLASS_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_CLASS_H
23#include "ruby/internal/dllexport.h"
24#include "ruby/internal/value.h"
25#include "ruby/backward/2/stdarg.h"
26
27 RBIMPL_SYMBOL_EXPORT_BEGIN()
28
29/* class.c */
30
31
38 VALUE rb_class_new(VALUE super);
39
49 VALUE rb_mod_init_copy(VALUE clone, VALUE orig);
50
59void rb_check_inheritable(VALUE super);
60
71 VALUE rb_define_class_id(ID id, VALUE super);
72
94 VALUE rb_define_class_id_under(VALUE outer, ID id, VALUE super);
95
101 VALUE rb_module_new(void);
102
103
109 VALUE rb_refinement_new(void);
110
118 VALUE rb_define_module_id(ID id);
119
133 VALUE rb_define_module_id_under(VALUE outer, ID id);
134
144 VALUE rb_mod_included_modules(VALUE mod);
145
158 VALUE rb_mod_include_p(VALUE child, VALUE parent);
159
175 VALUE rb_mod_ancestors(VALUE mod);
176
188 VALUE rb_class_descendants(VALUE klass);
189
201 VALUE rb_class_subclasses(VALUE klass);
202
203
213 VALUE rb_class_attached_object(VALUE klass);
214
228 VALUE rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod);
229
243 VALUE rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod);
244
258 VALUE rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod);
259
273 VALUE rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod);
274
288 VALUE rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj);
289
301void rb_define_method_id(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int arity);
302
303/* vm_method.c */
304
324void rb_undef(VALUE mod, ID mid);
325
326/* class.c */
327
328 RBIMPL_ATTR_NONNULL(())
339void rb_define_protected_method(VALUE klass, const char *mid, VALUE (*func)(ANYARGS), int arity);
340
341 RBIMPL_ATTR_NONNULL(())
352void rb_define_private_method(VALUE klass, const char *mid, VALUE (*func)(ANYARGS), int arity);
353
354 RBIMPL_ATTR_NONNULL(())
365void rb_define_singleton_method(VALUE obj, const char *mid, VALUE(*func)(ANYARGS), int arity);
366
390 VALUE rb_singleton_class(VALUE obj);
391
392 RBIMPL_SYMBOL_EXPORT_END()
393
394#endif /* RBIMPL_INTERN_CLASS_H */
rb_define_method_id
#define rb_define_method_id(klass, mid, func, arity)
Defines klass#mid.
Definition cxxanyargs.hpp:673
rb_define_singleton_method
#define rb_define_singleton_method(klass, mid, func, arity)
Defines klass.mid.
Definition cxxanyargs.hpp:685
rb_define_protected_method
#define rb_define_protected_method(klass, mid, func, arity)
Defines klass#mid and makes it protected.
Definition cxxanyargs.hpp:681
rb_define_private_method
#define rb_define_private_method(klass, mid, func, arity)
Defines klass#mid and makes it private.
Definition cxxanyargs.hpp:677
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:106
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:97
rb_class_protected_instance_methods
VALUE rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
Identical to rb_class_instance_methods(), except it returns names of methods that are protected only.
Definition class.c:1859
rb_refinement_new
VALUE rb_refinement_new(void)
Creates a new, anonymous refinement.
Definition class.c:1025
rb_class_new
VALUE rb_class_new(VALUE super)
Creates a new, anonymous class.
Definition class.c:325
rb_class_subclasses
VALUE rb_class_subclasses(VALUE klass)
Queries the class's direct descendants.
Definition class.c:1639
rb_singleton_class
VALUE rb_singleton_class(VALUE obj)
Finds or creates the singleton class of the passed object.
Definition class.c:2241
rb_class_attached_object
VALUE rb_class_attached_object(VALUE klass)
Returns the attached object for a singleton class.
Definition class.c:1662
rb_obj_singleton_methods
VALUE rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
Identical to rb_class_instance_methods(), except it returns names of singleton methods instead of ins...
Definition class.c:2036
rb_module_new
VALUE rb_module_new(void)
Creates a new, anonymous module.
Definition class.c:1019
rb_class_instance_methods
VALUE rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod)
Generates an array of symbols, which are the list of method names defined in the passed class.
Definition class.c:1844
rb_check_inheritable
void rb_check_inheritable(VALUE super)
Asserts that the given class can derive a child class.
Definition class.c:310
rb_class_public_instance_methods
VALUE rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
Identical to rb_class_instance_methods(), except it returns names of methods that are public only.
Definition class.c:1897
rb_define_module_id_under
VALUE rb_define_module_id_under(VALUE outer, ID id)
Identical to rb_define_module_under(), except it takes the name in ID instead of C's string.
Definition class.c:1068
rb_mod_included_modules
VALUE rb_mod_included_modules(VALUE mod)
Queries the list of included modules.
Definition class.c:1457
rb_define_class_id_under
VALUE rb_define_class_id_under(VALUE outer, ID id, VALUE super)
Identical to rb_define_class_under(), except it takes the name in ID instead of C's string.
Definition class.c:994
rb_mod_ancestors
VALUE rb_mod_ancestors(VALUE mod)
Queries the module's ancestors.
Definition class.c:1525
rb_mod_include_p
VALUE rb_mod_include_p(VALUE child, VALUE parent)
Queries if the passed module is included by the module.
Definition class.c:1493
rb_class_private_instance_methods
VALUE rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod)
Identical to rb_class_instance_methods(), except it returns names of methods that are private only.
Definition class.c:1882
rb_mod_init_copy
VALUE rb_mod_init_copy(VALUE clone, VALUE orig)
The comment that comes with this function says :nodoc:.
Definition class.c:498
rb_define_module_id
VALUE rb_define_module_id(ID id)
This is a very badly designed API that creates an anonymous module.
Definition class.c:1032
rb_define_class_id
VALUE rb_define_class_id(ID id, VALUE super)
This is a very badly designed API that creates an anonymous class.
Definition class.c:893
rb_undef
void rb_undef(VALUE mod, ID mid)
Inserts a method entry that hides previous method definition of the given name.
Definition vm_method.c:1757
rb_class_descendants
VALUE rb_class_descendants(VALUE klass)
Queries the class's descendants.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition nonnull.h:30
stdarg.h
Defines old _.
ANYARGS
#define ANYARGS
Functions declared using this macro take arbitrary arguments, including void.
Definition stdarg.h:64
value.h
Defines VALUE and ID.
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40