Ruby 3.2.2p53 (2023-03-30 revision e51014f9c05aa65cbf203442d37fef7c12390015)
|
Defines enum ruby_value_type. More...
#include "ruby/internal/assume.h"
#include "ruby/internal/attr/artificial.h"
#include "ruby/internal/attr/cold.h"
#include "ruby/internal/attr/enum_extensibility.h"
#include "ruby/internal/attr/forceinline.h"
#include "ruby/internal/attr/pure.h"
#include "ruby/internal/cast.h"
#include "ruby/internal/constant_p.h"
#include "ruby/internal/core/rbasic.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/error.h"
#include "ruby/internal/has/builtin.h"
#include "ruby/internal/special_consts.h"
#include "ruby/internal/stdbool.h"
#include "ruby/internal/value.h"
#include "ruby/assert.h"
Go to the source code of this file.
Enumerations | |
enum | ruby_value_type { RUBY_T_NONE = 0x00 , RUBY_T_OBJECT = 0x01 , RUBY_T_CLASS = 0x02 , RUBY_T_MODULE = 0x03 , RUBY_T_FLOAT = 0x04 , RUBY_T_STRING = 0x05 , RUBY_T_REGEXP = 0x06 , RUBY_T_ARRAY = 0x07 , RUBY_T_HASH = 0x08 , RUBY_T_STRUCT = 0x09 , RUBY_T_BIGNUM = 0x0a , RUBY_T_FILE = 0x0b , RUBY_T_DATA = 0x0c , RUBY_T_MATCH = 0x0d , RUBY_T_COMPLEX = 0x0e , RUBY_T_RATIONAL = 0x0f , RUBY_T_NIL = 0x11 , RUBY_T_TRUE = 0x12 , RUBY_T_FALSE = 0x13 , RUBY_T_SYMBOL = 0x14 , RUBY_T_FIXNUM = 0x15 , RUBY_T_UNDEF = 0x16 , RUBY_T_IMEMO = 0x1a , RUBY_T_NODE = 0x1b , RUBY_T_ICLASS = 0x1c , RUBY_T_ZOMBIE = 0x1d , RUBY_T_MOVED = 0x1e , RUBY_T_MASK = 0x1f } |
C-level type of an object. More... | |
Functions | |
static enum ruby_value_type | RB_BUILTIN_TYPE (VALUE obj) |
Queries the type of the object. | |
static bool | rb_integer_type_p (VALUE obj) |
Queries if the object is an instance of rb_cInteger. | |
static enum ruby_value_type | rb_type (VALUE obj) |
Identical to RB_BUILTIN_TYPE(), except it can also accept special constants. | |
static bool | RB_FLOAT_TYPE_P (VALUE obj) |
Queries if the object is an instance of rb_cFloat. | |
static bool | RB_DYNAMIC_SYM_P (VALUE obj) |
Queries if the object is a dynamic symbol. | |
static bool | RB_SYMBOL_P (VALUE obj) |
Queries if the object is an instance of rb_cSymbol. | |
static bool | RB_TYPE_P (VALUE obj, enum ruby_value_type t) |
Queries if the given object is of given type. | |
static void | Check_Type (VALUE v, enum ruby_value_type t) |
Identical to RB_TYPE_P(), except it raises exceptions on predication failure. | |
Defines enum ruby_value_type.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file value_type.h.
#define rb_type_p RB_TYPE_P |
Just another name of RB_TYPE_P.
Definition at line 89 of file value_type.h.
enum ruby_value_type |
C-level type of an object.
Enumerator | |
---|---|
RUBY_T_NONE | Non-object (swept etc.) |
RUBY_T_OBJECT |
|
RUBY_T_CLASS | |
RUBY_T_MODULE |
|
RUBY_T_FLOAT |
|
RUBY_T_STRING |
|
RUBY_T_REGEXP |
|
RUBY_T_ARRAY |
|
RUBY_T_HASH |
|
RUBY_T_STRUCT |
|
RUBY_T_BIGNUM |
|
RUBY_T_FILE |
|
RUBY_T_DATA |
|
RUBY_T_MATCH |
|
RUBY_T_COMPLEX |
|
RUBY_T_RATIONAL |
|
RUBY_T_NIL |
|
RUBY_T_TRUE |
|
RUBY_T_FALSE |
|
RUBY_T_SYMBOL |
|
RUBY_T_FIXNUM | Integers formerly known as Fixnums. |
RUBY_T_UNDEF |
|
RUBY_T_IMEMO |
|
RUBY_T_NODE |
|
RUBY_T_ICLASS | Hidden classes known as IClasses. |
RUBY_T_ZOMBIE |
|
RUBY_T_MOVED |
|
RUBY_T_MASK | Bitmask of ruby_value_type. |
Definition at line 110 of file value_type.h.
|
inlinestatic |
Identical to RB_TYPE_P(), except it raises exceptions on predication failure.
[in] | v | An object. |
[in] | t | A type. |
rb_eTypeError | `obj` is not of type `t`. |
rb_eFatal | `obj` is corrupt. |
obj
is guaranteed to have type t
. Definition at line 432 of file value_type.h.
|
inlinestatic |
Queries the type of the object.
[in] | obj | Object in question. |
obj
must not be a special constant. obj
. Definition at line 181 of file value_type.h.
|
inlinestatic |
Queries if the object is a dynamic symbol.
[in] | obj | Object in question. |
true | It is. |
false | It isn't. |
Definition at line 286 of file value_type.h.
|
inlinestatic |
Queries if the object is an instance of rb_cFloat.
[in] | obj | Object in question. |
true | It is. |
false | It isn't. |
Definition at line 263 of file value_type.h.
|
inlinestatic |
Queries if the object is an instance of rb_cInteger.
[in] | obj | Object in question. |
true | It is. |
false | It isn't. |
Definition at line 203 of file value_type.h.
|
inlinestatic |
Queries if the object is an instance of rb_cSymbol.
[in] | obj | Object in question. |
true | It is. |
false | It isn't. |
Definition at line 306 of file value_type.h.
|
inlinestatic |
Identical to RB_BUILTIN_TYPE(), except it can also accept special constants.
[in] | obj | Object in question. |
obj
. Definition at line 224 of file value_type.h.
Referenced by RB_TYPE_P().
|
inlinestatic |
Queries if the given object is of given type.
[in] | obj | An object. |
[in] | t | A type. |
true | obj is of type t . |
false | Otherwise. |
Definition at line 375 of file value_type.h.