A generic header-only data structure library for C.
This library of common data structure, functions, services and more, is meant to serve and fill the immediate need of programs that require them. It is often common to be in need of a simple data structure to serve an immediate need without the need to expand, compile or build external code and programs in your code. Handy will come in "handy" during those times.
Handy has a simple and straightforward object-oriented API, this means objects have functions which are the property of the object and operates on them.
Handy is modular, i.e can be copied and used on the go.
All you need to do is copy the header and implementation file for the container or services from the include directory to your project directory.
First thing first, create an object of the container to be used.
Here is a simple usage of handy_list: list container:
NOTE. Always call the property free on the object to clean up some memory and finally free the object itself.
handy_list my_list = handy_create_list(); // create a handy_list
my_list->add_front( my_list, "Hello, world" ); // add first item at front of list
my_list->add_front( my_list, 'A' ); // add another item at front of list
printf( "Item at front: %c\n", my_list->get_front(my_list) ); // expect a char, prints 'A'
printf( "Item at back: %s\n", my_list->get_back(my_list) ); // expect char *, prints "Hello, world"
my_list->free( my_list ); // free item(s) in list
free( my_list ); // free my_list itself
- handy_list ( list ): Dynamically sized list of generic items.
- handy_hashtbl ( hashtable ): A dictionary, map: a collection of key-value pairs.
- handy_stack ( stack ): Dynamically sized, ordered collection of generic items that afford stack operations.
- handy_queue ( queue ): Dynamically sized, ordered collection of generic items that afford queue operations.
- handy_string ( string ): A structure for string manipulations.
- handy_vector ( vector ): Dynamically sized collection of generic items with constant insertion and deletion.
- handy_btree ( btree ): A container for working with binary trees.
- handy_argparser ( argparser ): Utility for parsing command line arguments.
- handy_time ( time ): A structure for time keeping.
- handy_serialize ( serialize ): Reading and writing generic data to disk.
- handy_numeric ( numeric ): For working with all types of numeric data eg decimal, binary, hexadecimal, octal etc.
- handy_sick ( sockets ): sick - Socket Interface Communication Kit.
Run make
in the test directory to compile all tests. An executable "AllTest" is generated, run "AllTest" to see test results.
I commit to handy as a hobby, if you like to see a feature or you found a defect, feel free to raise an issue for them and if you feel further motivated submit a pull request for them. Contributions are highly welcome.