• allegro5.a5_display
  • allegro5.a5_file
  • allegro5.a5_font
  • allegro5.a5_image
  • allegro5.a5_joystick
  • allegro5.a5_main
  • allegro5.a5_misc
  • allegro5.a5_opengl
  • allegro5.a5_shader
  • allegro5.a5_sound
  • allegro5.a5_thread
  • allegro5.a5_triangles
  • animation
  • array
  • atlas
  • buffer
  • color
  • common
  • csg.csg_aabb
  • csg.csg
  • csg.csg_octree
  • csg.csg_shapes
  • csg.csg_test
  • data
  • display
  • exception
  • file
  • font
  • glsl
  • grid
  • hash
  • image
  • image_op
  • index
  • ini
  • isometric
  • joystick
  • keyboard
  • land
  • layer
  • list
  • log
  • main
  • map
  • mem
  • mouse
  • net
  • noise
  • openglutil
  • perlin
  • pixelmask
  • plasma
  • pool
  • protobuf
  • queue
  • random
  • runner
  • shader
  • sound
  • sprite
  • thread
  • tilegrid
  • triangles
  • util2d
  • util3d
  • util
  • view
  • voronoi
  • widget.base
  • widget.board
  • widget.book
  • widget.box
  • widget.button
  • widget.checkbox
  • widget.container
  • widget.edit
  • widget.gul
  • widget.hbox
  • widget.layout
  • widget
  • widget.menu
  • widget.mover
  • widget.panel
  • widget.scrollbar
  • widget.scrolling
  • widget.sizer
  • widget.slider
  • widget.spin
  • widget.text
  • widget.theme
  • widget.vbox
  • widget.widget_list
  • yaml.external
  • yaml.internal
  • yaml
  • yaml.xml

land.hash

LandHashEntry

LandHash

A hash stores a number of objects, which can be accessed by a named key.

LandHashIterator

land_hash_count

Parameters: LandHash * self

Returns: int

LandHashIterator_first

Parameters: LandHash * self

Returns: LandHashIterator

LandHashIterator_item

Parameters: LandHash * self, LandHashIterator * i

Returns: void*

LandHashIterator_next

Parameters: LandHash * self, LandHashIterator * i

Returns: bool

land_hash_new_memlog

Parameters: char const * f, int l

Returns: LandHash*

land_hash_destroy_memlog

Parameters: LandHash * self, char const * f, int l

land_hash_new

no parameters

Returns: LandHash*

Create a new LandHash.

land_hash_clear

Parameters: LandHash * self

Clears the hash. Referenced data are not touched though.

land_hash_destroy

Parameters: LandHash * self

Destroy a LandHash. The data inside the hash are not freed (just everything else, like key names and internal data structures).

land_hash_insert

Parameters: LandHash * self, char const * thekey, void * data

Returns: void*

Insert data into a LandHash.

A LandHash simply is a mapping of keys to data pointers - it will never
touch the passed data in any way. E.g. you need to make sure to delete any
pointers you add to a hash. A copy of the passed key is made so you need
not keep it around.

If the key already exists, there will be two entries with the same key
from now on, and it is undefined behavior which one will get returned when
querying for the key.

land_hash_remove

Parameters: LandHash * self, char const * thekey

Returns: void*

Remove the first entry found with the key, and return the associated data.

The returned pointer might need to be destroyed after you remove it from
the hash, if it has no more use.

land_hash_replace

Parameters: LandHash * self, char const * thekey, void * data

Returns: void*

If an association to the given key exists, replace it with the given data, and return the old data. Else, do the same as land_hash_insert, and return None.

land_hash_get

Parameters: LandHash * self, char const * thekey

Returns: void*

Return the data associated with a hash key. If the key exists multiple times, it can be not relied on a certain one being returned. It might always be the same, but it might not be - this is especially true if other entries are added which could lead to a re-hashing when it gets too full.

If the key is not found, None is returned.

land_hash_has

Parameters: LandHash * self, char const * thekey

Returns: int

land_hash_keys

Parameters: LandHash * hash, bool alloc

Returns: LandArray*

Return an array containing all the keys in the hash.

If alloc is true, each key is allocated and must be freed. A
convenient way is to use land_array_destroy_with_strings.

Otherwise the strings are direct pointers into the hash - so you
must not modify or free them, and they will get invalid if the hash
is modifed (even just by adding/removing an unrelated key).

You are responsible for destroying the array with land_array_destroy
when you are done using it.

land_hash_data

Parameters: LandHash * hash

Returns: LandArray*

Return an array with all the data pointers in the hash. If you want to destroy a hash including all its data, this may be a convenient way to do it:

LandArray *data = land_hash_data(hash)
for int i = 0 while i < land_array_count(data) with i++:
    void *entry = land_array_get_nth(data, i)
    land_free(entry)
land_array_destroy(data)
land_hash_destroy(hash)

land_hash_print_stats

Parameters: LandHash * hash

This is an internal function for debugging purposes, which will print out statistics about the hash to the console.


Generated: Thu 27 Feb 2020 10:49:37 PM EST