nspace.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * nspace.h
  3. */
  4. /**
  5. \ingroup clish
  6. \defgroup clish_nspace nspace
  7. @{
  8. \brief This class represents an instance of a namespace type.
  9. Namespace instances are assocated with a view to make view's commands available
  10. within current view.
  11. */
  12. #ifndef _clish_nspace_h
  13. #define _clish_nspace_h
  14. typedef struct clish_nspace_s clish_nspace_t;
  15. typedef enum {
  16. CLISH_NSPACE_NONE,
  17. CLISH_NSPACE_HELP,
  18. CLISH_NSPACE_COMPLETION,
  19. CLISH_NSPACE_CHELP
  20. } clish_nspace_visibility_e;
  21. #include <regex.h>
  22. #include "clish/view.h"
  23. /*=====================================
  24. * NSPACE INTERFACE
  25. *===================================== */
  26. /*-----------------
  27. * meta functions
  28. *----------------- */
  29. clish_nspace_t *clish_nspace_new(const char *view_name);
  30. /*-----------------
  31. * methods
  32. *----------------- */
  33. void clish_nspace_delete(clish_nspace_t * instance);
  34. const clish_command_t *clish_nspace_find_next_completion(clish_nspace_t *
  35. instance, const char *iter_cmd, const char *line,
  36. clish_nspace_visibility_e field);
  37. clish_command_t *clish_nspace_find_command(clish_nspace_t * instance, const char *name);
  38. void clish_nspace_dump(const clish_nspace_t * instance);
  39. clish_command_t * clish_nspace_create_prefix_cmd(clish_nspace_t * instance,
  40. const char * name, const char * help);
  41. void clish_nspace_clean_proxy(clish_nspace_t * instance);
  42. /*-----------------
  43. * attributes
  44. *----------------- */
  45. void clish_nspace__set_view(clish_nspace_t *instance, clish_view_t *view);
  46. clish_view_t *clish_nspace__get_view(const clish_nspace_t * instance);
  47. void clish_nspace__set_view_name(clish_nspace_t *instance, const char *view_name);
  48. const char * clish_nspace__get_view_name(const clish_nspace_t *instance);
  49. const char *clish_nspace__get_prefix(const clish_nspace_t * instance);
  50. const regex_t *clish_nspace__get_prefix_regex(const clish_nspace_t * instance);
  51. bool_t clish_nspace__get_help(const clish_nspace_t * instance);
  52. bool_t clish_nspace__get_completion(const clish_nspace_t * instance);
  53. bool_t clish_nspace__get_context_help(const clish_nspace_t * instance);
  54. bool_t clish_nspace__get_inherit(const clish_nspace_t * instance);
  55. bool_t clish_nspace__get_visibility(const clish_nspace_t * instance,
  56. clish_nspace_visibility_e field);
  57. void clish_nspace__set_prefix(clish_nspace_t * instance, const char *prefix);
  58. void clish_nspace__set_help(clish_nspace_t * instance, bool_t help);
  59. void clish_nspace__set_completion(clish_nspace_t * instance, bool_t help);
  60. void clish_nspace__set_context_help(clish_nspace_t * instance, bool_t help);
  61. void clish_nspace__set_inherit(clish_nspace_t * instance, bool_t inherit);
  62. void clish_nspace__set_access(clish_nspace_t *instance, const char *access);
  63. char *clish_nspace__get_access(const clish_nspace_t *instance);
  64. #endif /* _clish_nspace_h */
  65. /** @} clish_nspace */