X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fconsole.h;h=5cb5f178e07f4279a465629dde4219ce514c833b;hp=6d6c788780f70887de6d0571cb15ece611dfaf0f;hb=609c9a508cfdc7b42c46c4f21d17639204165a00;hpb=d16185720fa344263367dbd50c61bfc8183d99a4 diff --git a/source/io/console.h b/source/io/console.h index 6d6c788..5cb5f17 100644 --- a/source/io/console.h +++ b/source/io/console.h @@ -14,10 +14,20 @@ instead. */ class Console: public EventObject { +public: + enum Stream + { + CIN = 0, + COUT = 1, + CERR = 2 + }; + private: + Stream stream; Handle handle; - Console(unsigned); + Console(Stream); + void platform_init(); public: ~Console(); @@ -37,6 +47,11 @@ public: Console. */ void get_size(unsigned &rows, unsigned &cols); + /** Redirects input from or output to another I/O object. This performs a + system-level redirect. Closing the other object won't affect the + redirection. */ + void redirect(Base &); + protected: virtual unsigned do_write(const char *, unsigned); virtual unsigned do_read(char *, unsigned); @@ -44,7 +59,7 @@ protected: public: virtual const Handle &get_event_handle() { return handle; } - static Console &instance(unsigned); + static Console &instance(Stream); }; extern Console &cin;