2 Copyright (C) 2001-2009, Parrot Foundation.
7 src/pmc/hashiteratorkey.pmc - accessor for single value during hash iteration.
11 Single (key,value) pair.
22 /* HEADERIZER HFILE: none */
23 /* HEADERIZER BEGIN: static */
24 /* HEADERIZER END: static */
26 pmclass HashIteratorKey no_ro auto_attrs {
27 ATTR Hash *parrot_hash; /* Underlying parrot's hash */
28 ATTR HashBucket *bucket; /* Current bucket from HashItertor */
39 VTABLE PMC* get_pmc() {
40 Parrot_HashIteratorKey_attributes *attrs =
41 PARROT_HASHITERATORKEY(SELF);
43 /* TT #1080 & TT #1081 Wallpapering problem with NULL attributes */
44 if (!attrs->parrot_hash || !attrs->bucket)
47 return hash_key_to_pmc(INTERP, attrs->parrot_hash, attrs->bucket->key);
51 PMC *ret = SELF.get_pmc();
56 Parrot_HashIteratorKey_attributes *attrs =
57 PARROT_HASHITERATORKEY(SELF);
58 PMC *ret = hash_value_to_pmc(INTERP, attrs->parrot_hash, attrs->bucket->value);
63 VTABLE INTVAL get_integer() {
67 VTABLE STRING* get_string() {
68 Parrot_HashIteratorKey_attributes *attrs =
69 PARROT_HASHITERATORKEY(SELF);
71 /* TT #1080 & TT #1081 Wallpapering problem with NULL attributes */
72 if (!attrs->parrot_hash || !attrs->bucket)
73 return CONST_STRING(INTERP, "");
75 return hash_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key);
80 =item C<set_pointer_keyed_int()>
82 Set pointers to Hash and HashBucket. Not really part of public API.
87 VTABLE void set_pointer_keyed_int(INTVAL key, void *value) {
88 Parrot_HashIteratorKey_attributes *attrs =
89 PARROT_HASHITERATORKEY(SELF);
91 PARROT_ASSERT_MSG(value, "Can't set NULL pointer into HashIteratorKey");
94 attrs->parrot_hash = (Hash*)value;
97 attrs->bucket = (HashBucket*)value;
113 * c-file-style: "parrot"
115 * vim: expandtab shiftwidth=4: