19 template <
class Elem =
char,
class Tr = std::
char_traits<Elem>>
21 typedef void (*cb_func_ptr)(
const Elem*, std::streamsize
count,
void*
data);
27 : stream_(stream), cb_func_(cb_func), data_(
data) {
28 buf_ = stream_.rdbuf(
this);
33 std::streamsize
xsputn(
const Elem* ptr, std::streamsize
count) {
34 cb_func_(ptr,
count, data_);
38 typename Tr::int_type
overflow(
typename Tr::int_type v) {
39 Elem ch = Tr::to_char_type(v);
40 cb_func_(&ch, 1, data_);
41 return Tr::not_eof(v);
45 std::basic_ostream<Elem, Tr>& stream_;
53 LogWidget(QWidget* parent,
const int max_num_blocks = 100000);
56 void Append(
const std::string& text);
61 static void Update(
const char* text,
62 std::streamsize
count,
68 std::string text_queue_;
69 QPlainTextEdit* text_box_;
70 std::ofstream log_file_;
std::streamsize xsputn(const Elem *ptr, std::streamsize count)
Tr::int_type overflow(typename Tr::int_type v)
StandardOutputRedirector(std::ostream &stream, cb_func_ptr cb_func, void *data)
~StandardOutputRedirector()