1
0

view.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #include "clish/var.h"
  24. /*=====================================
  25. * VIEW INTERFACE
  26. *===================================== */
  27. /*-----------------
  28. * meta functions
  29. *----------------- */
  30. clish_view_t *clish_view_new(const char *name, const char *prompt);
  31. int clish_view_bt_compare(const void *clientnode, const void *clientkey);
  32. void clish_view_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  33. size_t clish_view_bt_offset(void);
  34. /*-----------------
  35. * methods
  36. *----------------- */
  37. void clish_view_delete(clish_view_t * instance);
  38. clish_command_t *clish_view_new_command(clish_view_t * instance,
  39. const char *name, const char *text);
  40. clish_command_t *clish_view_find_command(clish_view_t * instance,
  41. const char *name, bool_t inherit);
  42. const clish_command_t *clish_view_find_next_completion(clish_view_t * instance,
  43. const char *iter_cmd, const char *line,
  44. clish_nspace_visibility_t field, bool_t inherit);
  45. clish_command_t *clish_view_resolve_command(clish_view_t * instance,
  46. const char *line, bool_t inherit);
  47. clish_command_t *clish_view_resolve_prefix(clish_view_t * instance,
  48. const char *line, bool_t inherit);
  49. void clish_view_dump(clish_view_t * instance);
  50. void clish_view_insert_nspace(clish_view_t * instance, clish_nspace_t * nspace);
  51. void clish_view_clean_proxy(clish_view_t * instance);
  52. /*-----------------
  53. * attributes
  54. *----------------- */
  55. const char *clish_view__get_name(const clish_view_t * instance);
  56. void clish_view__set_prompt(clish_view_t * instance, const char *prompt);
  57. char *clish_view__get_prompt(const clish_view_t *instance);
  58. unsigned int clish_view__get_nspace_count(const clish_view_t * instance);
  59. clish_nspace_t *clish_view__get_nspace(const clish_view_t * instance,
  60. unsigned index);
  61. void clish_view__set_depth(clish_view_t * instance, unsigned depth);
  62. unsigned clish_view__get_depth(const clish_view_t * instance);
  63. void clish_view__set_restore(clish_view_t * instance,
  64. clish_view_restore_t restore);
  65. clish_view_restore_t clish_view__get_restore(const clish_view_t * instance);
  66. #endif /* _clish_view_h */
  67. /** @} clish_view */