| 1 | /*************************************************************************** |
| 2 | CConsole.cpp - description |
| 3 | ------------------- |
| 4 | begin : December 31th, 2008 |
| 5 | copyright : (C) 2008 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: CConsole.cpp 424 2009-11-01 15:59:02Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | // Do not include "extern Console Terminal" |
| 21 | #define _SPF_SYSTEM_CCONSOLE_CPP_ 1 |
| 22 | |
| 23 | // Framework headers |
| 24 | #include "CConsole.h" // System::Console class |
| 25 | #include "CString.h" // System::String class |
| 26 | |
| 27 | // Standard C++ headers |
| 28 | #include <iostream> // cout, cerr, cin |
| 29 | |
| 30 | |
| 31 | SPF_NAMESPACE_BEGIN(System) |
| 32 | |
| 33 | |
| 34 | Console Terminal; |
| 35 | |
| 36 | |
| 37 | /*=====================================================================*/ |
| 38 | Console::Console() {} |
| 39 | |
| 40 | |
| 41 | Console::~Console() {} |
| 42 | |
| 43 | |
| 44 | /*=====================================================================*/ |
| 45 | void Console::Write(const Object& value) |
| 46 | { |
| 47 | std::cout << value.ToString(); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | void Console::Write(const String& value) |
| 52 | { |
| 53 | std::cout << value; |
| 54 | } |
| 55 | |
| 56 | |
| 57 | /*=====================================================================*/ |
| 58 | String Console::ToString() const |
| 59 | { |
| 60 | return String("System::Console"); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /*=====================================================================*/ |
| 65 | Console& Console::operator<<(const Object& value) |
| 66 | { |
| 67 | std::cout << value.ToString(); |
| 68 | return *this; |
| 69 | } |
| 70 | |
| 71 | |
| 72 | /*=====================================================================*/ |
| 73 | Console& Console::operator<<(const char* const s) |
| 74 | { |
| 75 | std::cout << s; |
| 76 | return *this; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | Console& Console::operator<<(const int i) |
| 81 | { |
| 82 | std::cout << i; |
| 83 | return *this; |
| 84 | } |
| 85 | |
| 86 | |
| 87 | SPF_NAMESPACE_END |