pargv.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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(void);
  31. /*-----------------
  32. * methods
  33. *----------------- */
  34. void clish_pargv_delete(clish_pargv_t * instance);
  35. const clish_parg_t *clish_pargv_find_arg(clish_pargv_t * instance,
  36. const char *name);
  37. int clish_pargv_insert(clish_pargv_t * instance,
  38. const clish_param_t * param, const char *value);
  39. void clish_pargv_dump(const clish_pargv_t * instance);
  40. /*-----------------
  41. * attributes
  42. *----------------- */
  43. unsigned clish_pargv__get_count(clish_pargv_t * instance);
  44. clish_parg_t *clish_pargv__get_parg(clish_pargv_t * instance, unsigned index);
  45. const clish_param_t *clish_pargv__get_param(clish_pargv_t * instance,
  46. unsigned index);
  47. /*=====================================
  48. * PARG INTERFACE
  49. *===================================== */
  50. /*-----------------
  51. * meta functions
  52. *----------------- */
  53. /*-----------------
  54. * methods
  55. *----------------- */
  56. void clish_parg_dump(const clish_parg_t * instance);
  57. /*-----------------
  58. * attributes
  59. *----------------- */
  60. const char *clish_parg__get_name(const clish_parg_t * instance);
  61. const char *clish_parg__get_value(const clish_parg_t * instance);
  62. const clish_ptype_t *clish_parg__get_ptype(const clish_parg_t * instance);
  63. #endif /* _clish_pargv_h */
  64. /** @} clish_pargv */