view.h 2.4 KB

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