kview.h 832 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** @file view.h
  2. *
  3. * @brief Klish scheme's "view" entry
  4. */
  5. #ifndef _klish_kview_h
  6. #define _klish_kview_h
  7. #include <faux/faux.h>
  8. #include <klish/kcommand.h>
  9. typedef struct kview_s kview_t;
  10. typedef struct iview_s {
  11. char *name;
  12. icommand_t * (*commands)[];
  13. } iview_t;
  14. typedef enum {
  15. KVIEW_ERROR_OK,
  16. KVIEW_ERROR_INTERNAL,
  17. KVIEW_ERROR_ALLOC,
  18. KVIEW_ERROR_ATTR_NAME,
  19. } kview_error_e;
  20. C_DECL_BEGIN
  21. kview_t *kview_new(const iview_t *info, kview_error_e *error);
  22. void kview_free(kview_t *view);
  23. bool_t kview_parse(kview_t *view, const iview_t *info, kview_error_e *error);
  24. const char *kview_strerror(kview_error_e error);
  25. const char *kview_name(const kview_t *view);
  26. bool_t kview_set_name(kview_t *view, const char *name);
  27. bool_t kview_add_command(kview_t *view, kcommand_t *command);
  28. C_DECL_END
  29. #endif // _klish_kview_h