mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
parent
522e74982e
commit
d1d81c8a07
@ -86,11 +86,27 @@ class GHashPrinter:
|
||||
"Prints a GHashTable"
|
||||
|
||||
class _iterator:
|
||||
class _pointer_array:
|
||||
def __init__(self, ptr, big_items):
|
||||
self._big_items = big_items
|
||||
self._gpointer_type = gdb.lookup_type("gpointer")
|
||||
item_type = self._gpointer_type if self._big_items else gdb.lookup_type("guint")
|
||||
|
||||
self._items = ptr.cast(item_type.pointer())
|
||||
|
||||
def __getitem__(self, item):
|
||||
item = self._items[item]
|
||||
|
||||
if not self._big_items:
|
||||
item = item.cast(self._gpointer_type)
|
||||
|
||||
return item
|
||||
|
||||
def __init__(self, ht, keys_are_strings):
|
||||
self.ht = ht
|
||||
if ht != 0:
|
||||
self.keys = ht["keys"]
|
||||
self.values = ht["values"]
|
||||
self.keys = self._pointer_array(ht["keys"], ht["have_big_keys"])
|
||||
self.values = self._pointer_array(ht["values"], ht["have_big_values"])
|
||||
self.hashes = ht["hashes"]
|
||||
self.size = ht["size"]
|
||||
self.pos = 0
|
||||
|
Loading…
Reference in New Issue
Block a user