#ifndef INCLUDE_NCURSES_BASIC_WINBUF_HPP_ #define INCLUDE_NCURSES_BASIC_WINBUF_HPP_ #include #include #include #include namespace NCURSES_CPP_NAMESPACE { template > class basic_winbuf final : public std::basic_streambuf { public: using Base = std::basic_streambuf; using typename Base::char_type; using typename Base::int_type; using typename Base::off_type; using typename Base::pos_type; explicit basic_winbuf(window &win) : win_(win), x_pos_(0), y_pos_(0) {} /*int_type uflow() override {}*/ /*int_type underflow() override {}*/ int_type overflow(int_type ch = Traits::eof()) override {} std::streamsize xsputn(const char_type *s, std::streamsize n) override { // TODO: change to call to new trait's callback for each supported type // for char/wchar_t/other_chars use wadd(w)nstr // for curs_char/curs_wchar use for loop of wadd(w)ch waddnstr(static_cast(win_), s, n); } // TODO: overload << operator with full_attrs to do attr_on, etc... void pos(int y_pos, int x_pos) NCURSES_CPP_NOEXCEPT { y_pos_ = y_pos; x_pos_ = x_pos; } private: window &win_; int x_pos_; int y_pos_; }; } // namespace NCURSES_CPP_NAMESPACE #endif // INCLUDE_NCURSES_BASIC_WINBUF_HPP_