view.h 2.3 KB

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