Ruby
3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
|
Routines to manipulate struct RHash. More...
#include "ruby/internal/config.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
#include "ruby/backward.h"
Go to the source code of this file.
Macros | |
#define | RHASH_TBL(h) rb_hash_tbl(h, __FILE__, __LINE__) |
Retrieves the internal table. More... | |
#define | RHASH_IFNONE(h) rb_hash_ifnone(h) |
#define | RHASH_SIZE(h) rb_hash_size_num(h) |
Queries the size of the hash. More... | |
#define | RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0) |
Checks if the hash is empty. More... | |
#define | RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone) |
Destructively updates the default value of the hash. More... | |
Functions | |
size_t | rb_hash_size_num (VALUE hash) |
This is the implementation detail of RHASH_SIZE. More... | |
struct st_table * | rb_hash_tbl (VALUE hash, const char *file, int line) |
This is the implementation detail of RHASH_TBL. More... | |
VALUE | rb_hash_set_ifnone (VALUE hash, VALUE ifnone) |
This is the implementation detail of RHASH_SET_IFNONE. More... | |
Routines to manipulate struct RHash.
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 rhash.h.
#define RHASH_EMPTY_P | ( | h | ) | (RHASH_SIZE(h) == 0) |
Checks if the hash is empty.
[in] | h | An instance of RHash. |
h
must be of RUBY_T_HASH. true | It is. |
false | It isn't. |
#define RHASH_IFNONE | ( | h | ) | rb_hash_ifnone(h) |
Exists here for backwards compatibility only. You can safely forget about it.
#define RHASH_SET_IFNONE | ( | h, | |
ifnone | |||
) | rb_hash_set_ifnone((VALUE)h, ifnone) |
Destructively updates the default value of the hash.
[out] | h | An instance of RHash. |
[in] | ifnone | Arbitrary default value. |
h
must be of RUBY_T_HASH. #define RHASH_SIZE | ( | h | ) | rb_hash_size_num(h) |
Queries the size of the hash.
Size here means the number of keys that the hash stores.
[in] | h | An instance of RHash. |
h
must be of RUBY_T_HASH. #define RHASH_TBL | ( | h | ) | rb_hash_tbl(h, __FILE__, __LINE__) |
Retrieves the internal table.
[in] | h | An instance of RHash. |
h
must be of RUBY_T_HASH. This is the implementation detail of RHASH_SET_IFNONE.
People don't call this directly.
[out] | hash | An instance of RHash. |
[in] | ifnone | Arbitrary default value. |
hash
must be of RUBY_T_HASH. size_t rb_hash_size_num | ( | VALUE | hash | ) |
This is the implementation detail of RHASH_SIZE.
People don't call this directly.
[in] | hash | An instance of RHash. |
hash
must be of RUBY_T_HASH. This is the implementation detail of RHASH_TBL.
People don't call this directly.
[in] | hash | An instance of RHash. |
[in] | file | The __FILE__ . |
[in] | line | The __LINE__ . |
hash
must be of RUBY_T_HASH.