00001 /* 00002 * $Id: Console.h 562 2007-12-02 08:04:16Z mindstorm2600 $ 00003 * 00004 * X-VR2 00005 * 00006 * Copyright (C) Juan V. Guerrero 2007 00007 * 00008 * Juan V. Guerrero <mindstorm2600@users.sourceforge.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License Version 2. See the LICENSE file 00012 * at the top of the source tree. 00013 */ 00014 #ifndef __XVR2_CONSOLE_H__ 00015 #define __XVR2_CONSOLE_H__ 00016 #include<xvr2/Unix.h> 00017 #include<xvr2/TextOutput.h> 00018 #include<xvr2/TextInput.h> 00019 #include<xvr2/CoreExceptions.h> 00020 00021 namespace xvr2{ 00022 00027 class Console:public Unix{ 00028 protected: 00030 TextOutput *err; 00032 TextOutput *out; 00034 TextInput *in; 00038 bool using_builtin_out; 00042 bool using_builtin_err; 00046 bool using_builtin_in; 00047 public: 00052 Console(); 00057 ~Console(); 00060 void setOutput(TextOutput *to = 0); 00063 void setInput(TextInput *ti = 0); 00066 void setErrorOutput(TextOutput *te = 0); 00070 void outWrite(const void *buf, UInt32 siz); 00074 void outWrite(const String &text) const; 00078 void outWriteLine(const void *buf, UInt32 siz); 00082 void outWriteLine(const String &text); 00086 void errWrite(const void *buf, UInt32 siz); 00089 void errWrite(const String &text) const; 00093 void errWriteLine(const void *buf, UInt32 siz); 00097 void errWriteLine(const String &text); 00101 void read(void *buf, UInt32 size); 00105 void readLine(String &line); 00106 //const Console &operator<<(const std::string &s) const; 00107 const Console &operator<<(const String &s) const; 00108 const Console &operator<<(const Object &s) const; 00109 }; 00110 } 00111 00112 #endif