1
0

pargv.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * pargv.h
  3. */
  4. /**
  5. \ingroup clish
  6. \defgroup clish_pargv pargv
  7. @{
  8. \brief This class represents a vector of command line arguments.
  9. */
  10. #ifndef _clish_pargv_h
  11. #define _clish_pargv_h
  12. typedef enum {
  13. CLISH_LINE_OK,
  14. CLISH_LINE_PARTIAL,
  15. CLISH_BAD_CMD,
  16. CLISH_BAD_PARAM,
  17. CLISH_BAD_HISTORY
  18. } clish_pargv_status_t;
  19. typedef struct clish_pargv_s clish_pargv_t;
  20. typedef struct clish_parg_s clish_parg_t;
  21. #include "clish/ptype.h"
  22. #include "clish/command.h"
  23. #include "clish/param.h"
  24. /*=====================================
  25. * PARGV INTERFACE
  26. *===================================== */
  27. /*-----------------
  28. * meta functions
  29. *----------------- */
  30. clish_pargv_t *clish_pargv_new(const clish_command_t * cmd,
  31. const char *viewid,
  32. const char *line,
  33. size_t offset,
  34. clish_pargv_status_t * status);
  35. /*-----------------
  36. * methods
  37. *----------------- */
  38. clish_pargv_t *clish_pargv_create(void);
  39. void clish_pargv_delete(clish_pargv_t * instance);
  40. const clish_parg_t *clish_pargv_find_arg(clish_pargv_t * instance,
  41. const char *name);
  42. int clish_pargv_insert(clish_pargv_t * instance,
  43. const clish_param_t * param, const char *value);
  44. clish_pargv_status_t clish_pargv_parse(clish_pargv_t * instance,
  45. const clish_command_t * cmd,
  46. const char *viewid,
  47. clish_paramv_t * paramv,
  48. const lub_argv_t * argv,
  49. unsigned *idx,
  50. clish_pargv_t * last,
  51. unsigned need_index);
  52. void clish_pargv_dump(const clish_pargv_t * instance);
  53. /*-----------------
  54. * attributes
  55. *----------------- */
  56. unsigned clish_pargv__get_count(clish_pargv_t * instance);
  57. clish_parg_t *clish_pargv__get_parg(clish_pargv_t * instance, unsigned index);
  58. const clish_param_t *clish_pargv__get_param(clish_pargv_t * instance,
  59. unsigned index);
  60. /*=====================================
  61. * PARG INTERFACE
  62. *===================================== */
  63. /*-----------------
  64. * meta functions
  65. *----------------- */
  66. /*-----------------
  67. * methods
  68. *----------------- */
  69. void clish_parg_dump(const clish_parg_t * instance);
  70. /*-----------------
  71. * attributes
  72. *----------------- */
  73. const char *clish_parg__get_name(const clish_parg_t * instance);
  74. const char *clish_parg__get_value(const clish_parg_t * instance);
  75. const clish_ptype_t *clish_parg__get_ptype(const clish_parg_t * instance);
  76. #endif /* _clish_pargv_h */
  77. /** @} clish_pargv */