pargv.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_e;
  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. clish_pargv_t *clish_pargv_clone(const clish_pargv_t *src);
  40. void clish_pargv_dump(const clish_pargv_t * instance);
  41. /*-----------------
  42. * attributes
  43. *----------------- */
  44. unsigned clish_pargv__get_count(clish_pargv_t * instance);
  45. clish_parg_t *clish_pargv__get_parg(clish_pargv_t * instance, unsigned index);
  46. const clish_param_t *clish_pargv__get_param(clish_pargv_t * instance,
  47. unsigned index);
  48. /*=====================================
  49. * PARG INTERFACE
  50. *===================================== */
  51. /*-----------------
  52. * meta functions
  53. *----------------- */
  54. /*-----------------
  55. * methods
  56. *----------------- */
  57. void clish_parg_dump(const clish_parg_t * instance);
  58. /*-----------------
  59. * attributes
  60. *----------------- */
  61. const char *clish_parg__get_name(const clish_parg_t * instance);
  62. const char *clish_parg__get_value(const clish_parg_t * instance);
  63. const clish_ptype_t *clish_parg__get_ptype(const clish_parg_t * instance);
  64. #endif /* _clish_pargv_h */
  65. /** @} clish_pargv */