kview.h 975 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <faux/error.h>
  9. #include <klish/iview.h>
  10. #include <klish/kcommand.h>
  11. typedef struct kview_s kview_t;
  12. typedef enum {
  13. KVIEW_ERROR_OK,
  14. KVIEW_ERROR_INTERNAL,
  15. KVIEW_ERROR_ALLOC,
  16. KVIEW_ERROR_ATTR_NAME,
  17. } kview_error_e;
  18. C_DECL_BEGIN
  19. // kview_t
  20. kview_t *kview_new(const iview_t *info, kview_error_e *error);
  21. void kview_free(kview_t *view);
  22. bool_t kview_parse(kview_t *view, const iview_t *info, kview_error_e *error);
  23. const char *kview_strerror(kview_error_e error);
  24. const char *kview_name(const kview_t *view);
  25. bool_t kview_set_name(kview_t *view, const char *name);
  26. bool_t kview_add_command(kview_t *view, kcommand_t *command);
  27. bool_t kview_nested_from_iview(kview_t *kview, iview_t *iview,
  28. faux_error_t *error_stack);
  29. kview_t *kview_from_iview(iview_t *iview, faux_error_t *error_stack);
  30. C_DECL_END
  31. #endif // _klish_kview_h