Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

id_table.h
Go to the documentation of this file.
1 #ifndef RUBY_ID_TABLE_H
2 #define RUBY_ID_TABLE_H 1
3 #include "ruby/ruby.h"
4
5 struct rb_id_table;
6
7 /* compatible with ST_* */
8 enum rb_id_table_iterator_result {
9 ID_TABLE_CONTINUE = ST_CONTINUE,
10 ID_TABLE_STOP = ST_STOP,
11 ID_TABLE_DELETE = ST_DELETE,
12 ID_TABLE_REPLACE = ST_REPLACE,
13 ID_TABLE_ITERATOR_RESULT_END
14 };
15
16 struct rb_id_table *rb_id_table_create(size_t size);
17 void rb_id_table_free(struct rb_id_table *tbl);
18 void rb_id_table_clear(struct rb_id_table *tbl);
19
20 size_t rb_id_table_size(const struct rb_id_table *tbl);
21 size_t rb_id_table_memsize(const struct rb_id_table *tbl);
22
23 int rb_id_table_insert(struct rb_id_table *tbl, ID id, VALUE val);
24 int rb_id_table_lookup(struct rb_id_table *tbl, ID id, VALUE *valp);
25 int rb_id_table_delete(struct rb_id_table *tbl, ID id);
26
27 typedef enum rb_id_table_iterator_result rb_id_table_update_callback_func_t(ID *id, VALUE *val, void *data, int existing);
28 typedef enum rb_id_table_iterator_result rb_id_table_foreach_func_t(ID id, VALUE val, void *data);
29 typedef enum rb_id_table_iterator_result rb_id_table_foreach_values_func_t(VALUE val, void *data);
30 void rb_id_table_foreach(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, void *data);
31 void rb_id_table_foreach_with_replace(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, rb_id_table_update_callback_func_t *replace, void *data);
32 void rb_id_table_foreach_values(struct rb_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data);
33
34 #endif /* RUBY_ID_TABLE_H */
ID
unsigned long ID
Definition: ruby.h:103
rb_id_table_foreach_values
void rb_id_table_foreach_values(struct rb_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
Definition: id_table.c:311
rb_id_table_update_callback_func_t
enum rb_id_table_iterator_result rb_id_table_update_callback_func_t(ID *id, VALUE *val, void *data, int existing)
rb_id_table_insert
int rb_id_table_insert(struct rb_id_table *tbl, ID id, VALUE val)
Definition: id_table.c:256
ST_STOP
@ ST_STOP
Definition: st.h:99
rb_id_table_foreach_with_replace
void rb_id_table_foreach_with_replace(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, rb_id_table_update_callback_func_t *replace, void *data)
Definition: id_table.c:270
ID_TABLE_STOP
@ ID_TABLE_STOP
Definition: id_table.h:10
VALUE
unsigned long VALUE
Definition: ruby.h:102
rb_id_table_memsize
size_t rb_id_table_memsize(const struct rb_id_table *tbl)
Definition: id_table.c:123
rb_id_table_iterator_result
rb_id_table_iterator_result
Definition: id_table.h:8
rb_id_table
Definition: id_table.c:40
ID_TABLE_ITERATOR_RESULT_END
@ ID_TABLE_ITERATOR_RESULT_END
Definition: id_table.h:13
ST_DELETE
@ ST_DELETE
Definition: st.h:99
rb_id_table_delete
int rb_id_table_delete(struct rb_id_table *tbl, ID id)
Definition: id_table.c:262
ruby.h
ST_REPLACE
@ ST_REPLACE
Definition: st.h:99
rb_id_table_foreach_func_t
enum rb_id_table_iterator_result rb_id_table_foreach_func_t(ID id, VALUE val, void *data)
ID_TABLE_REPLACE
@ ID_TABLE_REPLACE
Definition: id_table.h:12
rb_id_table_lookup
int rb_id_table_lookup(struct rb_id_table *tbl, ID id, VALUE *valp)
Definition: id_table.c:226
rb_id_table_clear
void rb_id_table_clear(struct rb_id_table *tbl)
Definition: id_table.c:109
size
int size
Definition: encoding.c:58
rb_id_table_create
struct rb_id_table * rb_id_table_create(size_t size)
Definition: id_table.c:95
rb_id_table_foreach
void rb_id_table_foreach(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
Definition: id_table.c:292
ST_CONTINUE
@ ST_CONTINUE
Definition: st.h:99
rb_id_table_free
void rb_id_table_free(struct rb_id_table *tbl)
Definition: id_table.c:102
rb_id_table_size
size_t rb_id_table_size(const struct rb_id_table *tbl)
Definition: id_table.c:117
rb_id_table_foreach_values_func_t
enum rb_id_table_iterator_result rb_id_table_foreach_values_func_t(VALUE val, void *data)
ID_TABLE_CONTINUE
@ ID_TABLE_CONTINUE
Definition: id_table.h:9
ID_TABLE_DELETE
@ ID_TABLE_DELETE
Definition: id_table.h:11