1
0

pargv.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_BAD_CMD,
  15. CLISH_BAD_PARAM,
  16. CLISH_BAD_HISTORY
  17. } clish_pargv_status_t;
  18. typedef struct clish_pargv_s clish_pargv_t;
  19. typedef struct clish_parg_s clish_parg_t;
  20. #include "clish/ptype.h"
  21. #include "clish/command.h"
  22. #include "clish/param.h"
  23. /*=====================================
  24. * PARGV INTERFACE
  25. *===================================== */
  26. /*-----------------
  27. * meta functions
  28. *----------------- */
  29. clish_pargv_t *clish_pargv_new(const clish_command_t * cmd,
  30. const char *line, size_t offset, clish_pargv_status_t * status);
  31. /*-----------------
  32. * methods
  33. *----------------- */
  34. clish_pargv_t *clish_pargv_create(void);
  35. void clish_pargv_delete(clish_pargv_t * instance);
  36. const clish_parg_t *clish_pargv_find_arg(clish_pargv_t * instance,
  37. const char *name);
  38. int clish_pargv_insert(clish_pargv_t * instance,
  39. const clish_param_t * param, const char *value);
  40. clish_pargv_status_t clish_pargv_parse(clish_pargv_t * instance,
  41. const clish_command_t * cmd,
  42. clish_paramv_t * paramv,
  43. const lub_argv_t * argv,
  44. unsigned *idx, clish_pargv_t * last, unsigned need_index);
  45. void clish_pargv_dump(const clish_pargv_t * instance);
  46. /*-----------------
  47. * attributes
  48. *----------------- */
  49. unsigned clish_pargv__get_count(clish_pargv_t * instance);
  50. clish_parg_t *clish_pargv__get_parg(clish_pargv_t * instance, unsigned index);
  51. const clish_param_t *clish_pargv__get_param(clish_pargv_t * instance,
  52. unsigned index);
  53. /*=====================================
  54. * PARG INTERFACE
  55. *===================================== */
  56. /*-----------------
  57. * meta functions
  58. *----------------- */
  59. /*-----------------
  60. * methods
  61. *----------------- */
  62. void clish_parg_dump(const clish_parg_t * instance);
  63. /*-----------------
  64. * attributes
  65. *----------------- */
  66. const char *clish_parg__get_name(const clish_parg_t * instance);
  67. const char *clish_parg__get_value(const clish_parg_t * instance);
  68. const clish_ptype_t *clish_parg__get_ptype(const clish_parg_t * instance);
  69. #endif /* _clish_pargv_h */
  70. /** @} clish_pargv */