From 8091a3071918d4cd30f2b9ab903e1d73d12dcb36 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 14 Oct 2013 22:19:16 +0300 Subject: [PATCH] Add get_handle to Console This is needed to e.g. redirect cerr to cout. --- source/io/console.cpp | 6 ++++++ source/io/console.h | 1 + 2 files changed, 7 insertions(+) diff --git a/source/io/console.cpp b/source/io/console.cpp index d50d72d..aee02e2 100644 --- a/source/io/console.cpp +++ b/source/io/console.cpp @@ -39,6 +39,12 @@ unsigned Console::do_read(char *buf, unsigned len) return ret; } +const Handle &Console::get_handle(Mode m) +{ + check_access(m); + return handle; +} + Console &Console::instance(Stream s) { static Console in(CIN); diff --git a/source/io/console.h b/source/io/console.h index 5cb5f17..e2b5d53 100644 --- a/source/io/console.h +++ b/source/io/console.h @@ -57,6 +57,7 @@ protected: virtual unsigned do_read(char *, unsigned); public: + virtual const Handle &get_handle(Mode); virtual const Handle &get_event_handle() { return handle; } static Console &instance(Stream); -- 2.45.2