#include #include #include #include #include int main(void) { fx_hashtable *ht = fx_hashtable_create(); fx_hashtable_put(ht, &FX_INT(32), &FX_INT(64)); fx_hashtable_put(ht, &FX_CSTR("hello"), &FX_INT(128)); const fx_value *v = fx_hashtable_get(ht, &FX_INT(32)); if (v) { printf("32= "); fx_value_to_string(v, fx_stdout, NULL); printf("\n"); } else { printf("no value\n"); } fx_iterator *it = fx_hashtable_begin(ht); fx_foreach(val, it) { fx_hashtable_item *item = NULL; fx_value_get_object(&val, &item); printf("item %p\n", item); fx_value key, value; key = fx_hashtable_item_get_key(item); value = fx_hashtable_item_get_value(item); fx_iterator *prop_it = fx_type_get_properties( fx_type_get_by_id(FX_TYPE_HASHTABLE_ITEM)); fx_foreach(prop_val, prop_it) { fx_property *prop; fx_value_get_object(&prop_val, &prop); printf("%s = ", fx_property_get_name(prop)); fx_value value = FX_VALUE_EMPTY; fx_property_get_value(prop, &val, &value); fx_value_to_string(&value, fx_stdout, NULL); printf("\n"); } fx_iterator_unref(prop_it); } fx_iterator_unref(it); return 0; }