pargv.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. const char *clish_pargv_find_value(clish_pargv_t * instance,
  25. const char *name);
  26. int clish_pargv_insert(clish_pargv_t * instance,
  27. const clish_param_t * param, const char *value);
  28. clish_pargv_t *clish_pargv_clone(const clish_pargv_t *src);
  29. void clish_pargv_dump(const clish_pargv_t * instance);
  30. unsigned clish_pargv__get_count(clish_pargv_t * instance);
  31. clish_parg_t *clish_pargv__get_parg(clish_pargv_t * instance, unsigned index);
  32. const clish_param_t *clish_pargv__get_param(clish_pargv_t * instance,
  33. unsigned index);
  34. /* Class parg */
  35. void clish_parg_dump(const clish_parg_t * instance);
  36. _CLISH_GET_STR(parg, value);
  37. _CLISH_GET_STR(parg, name);
  38. _CLISH_GET(parg, clish_ptype_t *, ptype);
  39. #endif /* _clish_pargv_h */