1
0

view.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * view.h
  3. */
  4. /**
  5. \ingroup clish
  6. \defgroup clish_view view
  7. @{
  8. \brief This class is a container of commands.
  9. A particular CLI session may contain a number of different views. Each
  10. view may contain its own specific commands as well as those available at
  11. a global scope.
  12. */
  13. #ifndef _clish_view_h
  14. #define _clish_view_h
  15. typedef struct clish_view_s clish_view_t;
  16. typedef enum {
  17. CLISH_RESTORE_NONE,
  18. CLISH_RESTORE_DEPTH,
  19. CLISH_RESTORE_VIEW
  20. } clish_view_restore_t;
  21. #include "clish/command.h"
  22. #include "clish/nspace.h"
  23. /*=====================================
  24. * VIEW INTERFACE
  25. *===================================== */
  26. /*-----------------
  27. * meta functions
  28. *----------------- */
  29. clish_view_t *clish_view_new(const char *name, const char *prompt);
  30. int clish_view_bt_compare(const void *clientnode, const void *clientkey);
  31. void clish_view_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  32. size_t clish_view_bt_offset(void);
  33. /*-----------------
  34. * methods
  35. *----------------- */
  36. void clish_view_delete(clish_view_t * instance);
  37. clish_command_t *clish_view_new_command(clish_view_t * instance,
  38. const char *name, const char *text);
  39. clish_command_t *clish_view_find_command(clish_view_t * instance,
  40. const char *name, bool_t inherit);
  41. const clish_command_t *clish_view_find_next_completion(clish_view_t * instance,
  42. const char *iter_cmd, const char *line,
  43. clish_nspace_visibility_t field, bool_t inherit);
  44. clish_command_t *clish_view_resolve_command(clish_view_t * instance,
  45. const char *line, bool_t inherit);
  46. clish_command_t *clish_view_resolve_prefix(clish_view_t * instance,
  47. const char *line, bool_t inherit);
  48. void clish_view_dump(clish_view_t * instance);
  49. void clish_view_insert_nspace(clish_view_t * instance, clish_nspace_t * nspace);
  50. void clish_view_clean_proxy(clish_view_t * instance);
  51. /*-----------------
  52. * attributes
  53. *----------------- */
  54. const char *clish_view__get_name(const clish_view_t * instance);
  55. void clish_view__set_prompt(clish_view_t * instance, const char *prompt);
  56. char *clish_view__get_prompt(const clish_view_t * instance, const char *viewid);
  57. const unsigned clish_view__get_nspace_count(const clish_view_t * instance);
  58. clish_nspace_t *clish_view__get_nspace(const clish_view_t * instance,
  59. unsigned index);
  60. void clish_view__set_depth(clish_view_t * instance, unsigned depth);
  61. unsigned clish_view__get_depth(const clish_view_t * instance);
  62. void clish_view__set_restore(clish_view_t * instance,
  63. clish_view_restore_t restore);
  64. clish_view_restore_t clish_view__get_restore(const clish_view_t * instance);
  65. #endif /* _clish_view_h */
  66. /** @} clish_view */