X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fio%2Fconsole.h;h=1200086014e4dae5a82196dd48667c31dfe551a3;hb=c8bf2d6c15893ccc9dbc4e04611b7229029f4808;hp=5b4158fc90b533a96d7399da08d41d45b7887b30;hpb=33bfa130254370803efc6882a29a0f0c9f2b6d28;p=libs%2Fcore.git diff --git a/source/io/console.h b/source/io/console.h index 5b4158f..1200086 100644 --- a/source/io/console.h +++ b/source/io/console.h @@ -17,9 +17,9 @@ class Console: public EventObject public: enum Stream { - INPUT = 0, - OUTPUT = 1, - ERROR = 2 + CIN = 0, + COUT = 1, + CERR = 2 }; private: @@ -27,10 +27,12 @@ private: Handle handle; Console(Stream); + void platform_init(); public: ~Console(); virtual void set_block(bool); + virtual void set_inherit(bool); /** If local echo is enabled, characters will appear on the console as they are typed. Can only be used on an input Console. */ @@ -46,11 +48,17 @@ 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); + virtual std::size_t do_write(const char *, std::size_t); + virtual std::size_t do_read(char *, std::size_t); public: + virtual const Handle &get_handle(Mode); virtual const Handle &get_event_handle() { return handle; } static Console &instance(Stream);