// // tape.hpp // cli // // Created by Sam Jaffe on 7/23/24. // Copyright © 2024 Sam Jaffe. All rights reserved. // #pragma once #include #include #include namespace cli { struct Tape { public: using callback_type = std::function; using value_type = std::string; using char_type = char; private: size_t negative_offset_{0}; size_t cursor_offset_{0}; std::vector elements_{""}; callback_type callback_; public: explicit Tape(callback_type const &callback) : Tape(1, callback) {} Tape(size_t n, callback_type const &callback); value_type const &get() const; void readch(); private: value_type &get(); void down(); void up(); void left(); void right(); void insert(char_type value); void erase(); void clear(); }; }