pargv.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * pargv.h
  3. * This class represents a vector of command line arguments.
  4. */
  5. #ifndef _clish_pargv_h
  6. #define _clish_pargv_h
  7. typedef enum {
  8. CLISH_LINE_OK,
  9. CLISH_LINE_PARTIAL,
  10. CLISH_BAD_CMD,
  11. CLISH_BAD_PARAM,
  12. CLISH_BAD_HISTORY
  13. } clish_pargv_status_e;
  14. typedef struct clish_pargv_s clish_pargv_t;
  15. typedef struct clish_parg_s clish_parg_t;
  16. #include "clish/ptype.h"
  17. #include "clish/command.h"
  18. #include "clish/param.h"
  19. /* Class pargv */
  20. clish_pargv_t *clish_pargv_new(void);
  21. void clish_pargv_delete(clish_pargv_t * instance);
  22. const clish_parg_t *clish_pargv_find_arg(clish_pargv_t * instance,
  23. const char *name);
  24. int clish_pargv_insert(clish_pargv_t * instance,
  25. const clish_param_t * param, const char *value);
  26. clish_pargv_t *clish_pargv_clone(const clish_pargv_t *src);
  27. void clish_pargv_dump(const clish_pargv_t * instance);
  28. unsigned clish_pargv__get_count(clish_pargv_t * instance);
  29. clish_parg_t *clish_pargv__get_parg(clish_pargv_t * instance, unsigned index);
  30. const clish_param_t *clish_pargv__get_param(clish_pargv_t * instance,
  31. unsigned index);
  32. /* Class parg */
  33. void clish_parg_dump(const clish_parg_t * instance);
  34. _CLISH_GET_STR(parg, value);
  35. _CLISH_GET_STR(parg, name);
  36. _CLISH_GET(parg, clish_ptype_t *, ptype);
  37. #endif /* _clish_pargv_h */