From: Mikko Rasa Date: Mon, 14 Oct 2013 19:19:16 +0000 (+0300) Subject: Add get_handle to Console X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=8091a3071918d4cd30f2b9ab903e1d73d12dcb36;p=libs%2Fcore.git Add get_handle to Console This is needed to e.g. redirect cerr to cout. --- 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);