mruby/c Hash class
More...
#include "mrubyc.h"
#include "_autogen_class_hash.h"
Go to the source code of this file.
|
| mrbc_value | mrbc_hash_new (struct VM *vm, int size) |
| void | mrbc_hash_delete (mrbc_value *hash) |
| mrbc_value * | mrbc_hash_search (const mrbc_value *hash, const mrbc_value *key) |
| mrbc_value * | mrbc_hash_search_by_id (const mrbc_value *hash, mrbc_sym sym_id) |
| int | mrbc_hash_set (mrbc_value *hash, mrbc_value *key, mrbc_value *val) |
| mrbc_value | mrbc_hash_get (const mrbc_value *hash, const mrbc_value *key) |
| mrbc_value * | mrbc_hash_get_p (const mrbc_value *hash, const mrbc_value *key) |
| mrbc_value | mrbc_hash_remove (mrbc_value *hash, const mrbc_value *key) |
| mrbc_value | mrbc_hash_remove_by_id (mrbc_value *hash, mrbc_sym sym_id) |
| void | mrbc_hash_clear (mrbc_value *hash) |
| int | mrbc_hash_compare (const mrbc_value *v1, const mrbc_value *v2) |
| mrbc_value | mrbc_hash_dup (struct VM *vm, mrbc_value *src) |
mruby/c Hash class
Copyright (C) 2015- Kyushu Institute of Technology.
Copyright (C) 2015- Shimane IT Open-Innovation Center.
This file is distributed under BSD 3-Clause License.
Function summary
(constructor)
mrbc_hash_new()
(destructor)
mrbc_hash_delete()
(setter)
--[name]------------------[arg]--[ret]-[note]------------------------
mrbc_hash_set() *K,*V int
(getter)
--[name]------------------[arg]--[ret]-[note]------------------------
mrbc_hash_get() *K V Data remains in the container
mrbc_hash_get_p() *K *V Data remains in the container
mrbc_hash_search() *K *K Data remains in the container
mrbc_hash_search_by_id() SymID *K Data remains in the container
mrbc_hash_remove() *K V Data does not remain in the container
mrbc_hash_remove_by_id() SymID V Data does not remain in the container
(iterator)
--[name]------------------[arg]--[ret]-[note]------------------------
mrbc_hash_iterator_new() *V I
mrbc_hash_i_has_next() *I bool
mrbc_hash_i_next() *I *V Getter. Data remains in the container
(others)
mrbc_hash_size()
mrbc_hash_resize()
mrbc_hash_clear()
mrbc_hash_compare()
mrbc_hash_dup()
Definition in file c_hash.c.
◆ mrbc_hash_clear()
clear all
- Parameters
-
| hash | pointer to target hash |
Definition at line 276 of file c_hash.c.
◆ mrbc_hash_compare()
compare
- Parameters
-
- Return values
-
Definition at line 292 of file c_hash.c.
◆ mrbc_hash_delete()
destructor
- Parameters
-
| hash | pointer to target value |
Definition at line 108 of file c_hash.c.
◆ mrbc_hash_dup()
duplicate
- Parameters
-
| vm | pointer to VM. |
| src | pointer to target hash. |
Definition at line 313 of file c_hash.c.
◆ mrbc_hash_get()
getter
- Parameters
-
| hash | pointer to target hash |
| key | pointer to key value |
- Returns
- mrbc_value data at key position or Nil.
Definition at line 197 of file c_hash.c.
◆ mrbc_hash_get_p()
getter
- Parameters
-
| hash | pointer to target hash |
| key | pointer to key value |
- Returns
- pointer to mrbc_value or NULL
Definition at line 211 of file c_hash.c.
◆ mrbc_hash_new()
constructor
- Parameters
-
| vm | pointer to VM. |
| size | initial size |
- Returns
- hash object
Definition at line 77 of file c_hash.c.
◆ mrbc_hash_remove()
remove a data
- Parameters
-
| hash | pointer to target hash |
| key | pointer to key value |
- Returns
- removed data or Nil
Definition at line 225 of file c_hash.c.
◆ mrbc_hash_remove_by_id()
remove a data by symbol ID.
- Parameters
-
| hash | pointer to target hash |
| sym_id | symbol ID |
- Returns
- removed data.
-
TT_EMPTY, if not found.
- Note
- for use with OP_KARG.
Definition at line 253 of file c_hash.c.
◆ mrbc_hash_search()
search by key
- Parameters
-
| hash | pointer to target hash |
| key | pointer to key value |
- Returns
- pointer to found key or NULL(not found).
Definition at line 123 of file c_hash.c.
◆ mrbc_hash_search_by_id()
search by symbol ID
- Parameters
-
| hash | pointer to target hash |
| sym_id | symbol ID |
- Returns
- pointer to found key or NULL(not found).
- Note
- for use with OP_KEY_P.
Definition at line 145 of file c_hash.c.
◆ mrbc_hash_set()
setter
- Parameters
-
| hash | pointer to target hash |
| key | pointer to key value |
| val | pointer to value |
- Returns
- mrbc_error_code
Definition at line 168 of file c_hash.c.