nspace.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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(void *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(nspace, clish_view_t *, pview);
  39. _CLISH_GET(nspace, clish_view_t *, pview);
  40. _CLISH_SET_STR(nspace, view_name);
  41. _CLISH_GET_STR(nspace, view_name);
  42. _CLISH_SET_STR(nspace, access);
  43. _CLISH_GET_STR(nspace, access);
  44. _CLISH_SET_STR_ONCE(nspace, prefix);
  45. _CLISH_GET_STR(nspace, prefix);
  46. _CLISH_GET(nspace, const regex_t *, prefix_regex);
  47. bool_t clish_nspace__get_visibility(const clish_nspace_t * instance,
  48. clish_nspace_visibility_e field);
  49. #endif /* _clish_nspace_h */