view.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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_e;
  21. #include "lub/list.h"
  22. #include "clish/command.h"
  23. #include "clish/nspace.h"
  24. #include "clish/var.h"
  25. clish_view_t *clish_view_new(const char *name, const char *prompt);
  26. int clish_view_bt_compare(const void *clientnode, const void *clientkey);
  27. void clish_view_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  28. size_t clish_view_bt_offset(void);
  29. void clish_view_delete(clish_view_t * instance);
  30. clish_command_t *clish_view_new_command(clish_view_t * instance,
  31. const char *name, const char *text);
  32. clish_command_t *clish_view_find_command(clish_view_t * instance,
  33. const char *name, bool_t inherit);
  34. const clish_command_t *clish_view_find_next_completion(clish_view_t * instance,
  35. const char *iter_cmd, const char *line,
  36. clish_nspace_visibility_e field, bool_t inherit);
  37. clish_command_t *clish_view_resolve_command(clish_view_t * instance,
  38. const char *line, bool_t inherit);
  39. clish_command_t *clish_view_resolve_prefix(clish_view_t * instance,
  40. const char *line, bool_t inherit);
  41. void clish_view_dump(clish_view_t * instance);
  42. void clish_view_insert_nspace(clish_view_t * instance, clish_nspace_t * nspace);
  43. void clish_view_clean_proxy(clish_view_t * instance);
  44. int clish_view_insert_hotkey(const clish_view_t *instance, const char *key, const char *cmd);
  45. const char *clish_view_find_hotkey(const clish_view_t *instance, int code);
  46. _CLISH_GET(view, lub_list_t *, nspaces);
  47. _CLISH_GET_STR(view, name);
  48. _CLISH_SET_STR_ONCE(view, prompt);
  49. _CLISH_GET_STR(view, prompt);
  50. _CLISH_SET_STR(view, access);
  51. _CLISH_GET_STR(view, access);
  52. _CLISH_SET(view, unsigned int, depth);
  53. _CLISH_GET(view, unsigned int, depth);
  54. _CLISH_SET(view, clish_view_restore_e, restore);
  55. _CLISH_GET(view, clish_view_restore_e, restore);
  56. lub_bintree_t * clish_view__get_tree(clish_view_t *instance);
  57. #endif /* _clish_view_h */
  58. /** @} clish_view */