view.h 2.1 KB

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