nspace.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * nspace.h
  3. * Namespace instances are assocated with a view to make view's commands available
  4. * within current view.
  5. */
  6. #ifndef _clish_nspace_h
  7. #define _clish_nspace_h
  8. typedef struct clish_nspace_s clish_nspace_t;
  9. typedef enum {
  10. CLISH_NSPACE_NONE,
  11. CLISH_NSPACE_HELP,
  12. CLISH_NSPACE_COMPLETION,
  13. CLISH_NSPACE_CHELP
  14. } clish_nspace_visibility_e;
  15. #include <regex.h>
  16. #include "clish/macros.h"
  17. #include "clish/view.h"
  18. clish_nspace_t *clish_nspace_new(const char *view_name);
  19. void clish_nspace_delete(clish_nspace_t * instance);
  20. const clish_command_t *clish_nspace_find_next_completion(clish_nspace_t *
  21. instance, const char *iter_cmd, const char *line,
  22. clish_nspace_visibility_e field);
  23. clish_command_t *clish_nspace_find_command(clish_nspace_t * instance, const char *name);
  24. void clish_nspace_dump(const clish_nspace_t * instance);
  25. clish_command_t * clish_nspace_create_prefix_cmd(clish_nspace_t * instance,
  26. const char * name, const char * help);
  27. void clish_nspace_clean_proxy(clish_nspace_t * instance);
  28. _CLISH_SET(nspace, bool_t, help);
  29. _CLISH_GET(nspace, bool_t, help);
  30. _CLISH_SET(nspace, bool_t, completion);
  31. _CLISH_GET(nspace, bool_t, completion);
  32. _CLISH_SET(nspace, bool_t, context_help);
  33. _CLISH_GET(nspace, bool_t, context_help);
  34. _CLISH_SET(nspace, bool_t, inherit);
  35. _CLISH_GET(nspace, bool_t, inherit);
  36. _CLISH_SET(nspace, clish_view_t *, view);
  37. _CLISH_GET(nspace, clish_view_t *, view);
  38. _CLISH_SET_STR(nspace, view_name);
  39. _CLISH_GET_STR(nspace, view_name);
  40. _CLISH_SET_STR(nspace, access);
  41. _CLISH_GET_STR(nspace, access);
  42. _CLISH_SET_STR_ONCE(nspace, prefix);
  43. _CLISH_GET_STR(nspace, prefix);
  44. _CLISH_GET(nspace, const regex_t *, prefix_regex);
  45. bool_t clish_nspace__get_visibility(const clish_nspace_t * instance,
  46. clish_nspace_visibility_e field);
  47. #endif /* _clish_nspace_h */