tree.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * conf.h
  3. */
  4. /**
  5. \ingroup clish
  6. \defgroup clish_conf config
  7. @{
  8. \brief This class is a config in memory container.
  9. Use it to implement config in memory.
  10. */
  11. #ifndef _konf_tree_h
  12. #define _konf_tree_h
  13. #include <stdio.h>
  14. #include "lub/types.h"
  15. #include "lub/bintree.h"
  16. typedef struct konf_tree_s konf_tree_t;
  17. /*=====================================
  18. * CONF INTERFACE
  19. *===================================== */
  20. /*-----------------
  21. * meta functions
  22. *----------------- */
  23. konf_tree_t *konf_tree_new(const char * line, unsigned short priority);
  24. int konf_tree_bt_compare(const void *clientnode, const void *clientkey);
  25. void konf_tree_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  26. size_t konf_tree_bt_offset(void);
  27. /*-----------------
  28. * methods
  29. *----------------- */
  30. void konf_tree_delete(konf_tree_t * instance);
  31. void konf_tree_fprintf(konf_tree_t * instance, FILE * stream,
  32. const char *pattern,
  33. int depth, unsigned char prev_pri_hi);
  34. konf_tree_t *konf_tree_new_conf(konf_tree_t * instance,
  35. const char *line, unsigned short priority);
  36. konf_tree_t *konf_tree_find_conf(konf_tree_t * instance,
  37. const char *line, unsigned short priority);
  38. void konf_tree_del_pattern(konf_tree_t *this,
  39. const char *pattern);
  40. /*-----------------
  41. * attributes
  42. *----------------- */
  43. unsigned konf_tree__get_depth(const konf_tree_t * instance);
  44. unsigned short konf_tree__get_priority(const konf_tree_t * instance);
  45. unsigned char konf_tree__get_priority_hi(const konf_tree_t * instance);
  46. unsigned char konf_tree__get_priority_lo(const konf_tree_t * instance);
  47. bool_t konf_tree__get_splitter(const konf_tree_t * instance);
  48. void konf_tree__set_splitter(konf_tree_t *instance, bool_t splitter);
  49. #endif /* _konf_tree_h */
  50. /** @} clish_conf */