byte_input_vm.cpp 828 B

1234567891011121314151617181920212223242526272829303132
  1. #include "byte_input_vm.h"
  2. ByteInputVM::ByteInputVM() {
  3. byte_input = byte_input_alloc();
  4. }
  5. ByteInputVM::~ByteInputVM() {
  6. byte_input_free(byte_input);
  7. }
  8. View* ByteInputVM::get_view() {
  9. return byte_input_get_view(byte_input);
  10. }
  11. void ByteInputVM::clean() {
  12. byte_input_set_header_text(byte_input, "");
  13. byte_input_set_result_callback(byte_input, NULL, NULL, NULL, NULL, 0);
  14. }
  15. void ByteInputVM::set_result_callback(
  16. ByteInputCallback input_callback,
  17. ByteChangedCallback changed_callback,
  18. void* callback_context,
  19. uint8_t* bytes,
  20. uint8_t bytes_count) {
  21. byte_input_set_result_callback(
  22. byte_input, input_callback, changed_callback, callback_context, bytes, bytes_count);
  23. }
  24. void ByteInputVM::set_header_text(const char* text) {
  25. byte_input_set_header_text(byte_input, text);
  26. }