nspace.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_t;
  21. #include "clish/view.h"
  22. /*=====================================
  23. * NSPACE INTERFACE
  24. *===================================== */
  25. /*-----------------
  26. * meta functions
  27. *----------------- */
  28. clish_nspace_t *clish_nspace_new(clish_view_t * view);
  29. /*-----------------
  30. * methods
  31. *----------------- */
  32. void clish_nspace_delete(clish_nspace_t * instance);
  33. const clish_command_t *clish_nspace_find_next_completion(clish_nspace_t *
  34. instance, const char *iter_cmd, const char *line,
  35. clish_nspace_visibility_t field);
  36. clish_command_t *clish_nspace_find_command(clish_nspace_t * instance, const char *name);
  37. void clish_nspace_dump(const clish_nspace_t * instance);
  38. clish_command_t * clish_nspace_create_prefix_cmd(clish_nspace_t * instance,
  39. const char * name, const char * help);
  40. /*-----------------
  41. * attributes
  42. *----------------- */
  43. const char *clish_nspace__get_prefix(const clish_nspace_t * instance);
  44. bool_t clish_nspace__get_help(const clish_nspace_t * instance);
  45. bool_t clish_nspace__get_completion(const clish_nspace_t * instance);
  46. bool_t clish_nspace__get_context_help(const clish_nspace_t * instance);
  47. bool_t clish_nspace__get_inherit(const clish_nspace_t * instance);
  48. bool_t
  49. clish_nspace__get_visibility(const clish_nspace_t * instance,
  50. clish_nspace_visibility_t field);
  51. clish_view_t *clish_nspace__get_view(const clish_nspace_t * instance);
  52. void clish_nspace__set_prefix(clish_nspace_t * instance, const char *prefix);
  53. void clish_nspace__set_help(clish_nspace_t * instance, bool_t help);
  54. void clish_nspace__set_completion(clish_nspace_t * instance, bool_t help);
  55. void clish_nspace__set_context_help(clish_nspace_t * instance, bool_t help);
  56. void clish_nspace__set_inherit(clish_nspace_t * instance, bool_t inherit);
  57. #endif /* _clish_nspace_h */
  58. /** @} clish_nspace */