You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.8 KiB

  1. /**
  2. * @file labeled_int_list.h
  3. * @brief list structure which binds ints to labels
  4. * @license GNU General Public License 3.0 - see LICENSE.txt
  5. */
  6. #ifndef LABELED_INT_LIST_H
  7. #define LABELED_INT_LIST_H
  8. #include "dynamic_api.h"
  9. #include "stringpair.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @struct labeled_int_list_t
  15. *
  16. * @brief TODO
  17. *
  18. */
  19. typedef struct _labeled_int_list_t {
  20. int value;
  21. char* label; // UTF-8 string, null-terminated
  22. struct _labeled_int_list_t *next; // this is a single linked list
  23. } labeled_int_list_t;
  24. DYNAMIC_API labeled_int_list_t *new_labeled_int_list(int value, const char* label);
  25. /**
  26. * <!-- free_labeled_int_list() -->
  27. *
  28. * @brief TODO
  29. *
  30. * @param[in] labeled_int_list labeled_int_list_t*
  31. *
  32. */
  33. DYNAMIC_API void free_labeled_int_list(labeled_int_list_t *labeled_int_list);
  34. /**
  35. * <!-- labeled_int_list_dup() -->
  36. *
  37. * @brief TODO
  38. *
  39. * @param[in] src const labeled_int_list_t*
  40. *
  41. */
  42. DYNAMIC_API labeled_int_list_t *labeled_int_list_dup(const labeled_int_list_t *src);
  43. /**
  44. * <!-- labeled_int_list_add() -->
  45. *
  46. * @brief TODO
  47. *
  48. * @param[in] labeled_int_list labeled_int_list_t*
  49. * @param[in] value int
  50. * @param[in] label const char*
  51. *
  52. */
  53. DYNAMIC_API labeled_int_list_t *labeled_int_list_add(labeled_int_list_t *labeled_int_list, int value, const char* label);
  54. /**
  55. * <!-- labeled_int_list_length() -->
  56. *
  57. * @brief TODO
  58. *
  59. * @param[in] labeled_int_list const labeled_int_list_t*
  60. *
  61. */
  62. DYNAMIC_API int labeled_int_list_length(const labeled_int_list_t *labeled_int_list);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif