|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/io/Console.h"
Class module providing access to the standard console i/o streams: In (stdin), Out (stdout) and Err (stderr).
It cannot be instantiated - all methods are static.
Method Summary | |
static PrintWriter& |
cerr() Returns a raw C++ reference to the PrintWriter which is connected to the stderr file handle. |
static InputStreamReader& |
cin() Returns a raw C++ reference to the InputStreamReader which is connected to the stdin file handle. |
static PrintWriter& |
cout() Returns a raw C++ reference to the PrintWriter which is connected to the stdout file handle. |
static RefPtr< PrintWriter > |
Err() Returns a PrintWriter connected to the stderr file handle. |
static RefPtr< InputStreamReader > |
In() Returns an InputStreamReader connected to the stdin file handle. |
static RefPtr< PrintWriter > |
Out() Returns a PrintWriter connected to the stdout file handle. |
Method Detail |
static PrintWriter& cerr()
try { ... } catch(Exception& e) { Console::cerr() << e.toString() << endl; }
It is unusual for a OpenTop function to return a raw C++ reference to a ManagedObject. However, in this case, OpenTop will ensure that the PrintWriter object exists for the lifetime of the application, thereby removing the need for application code to maintain the reference count.
This function is also remarkable because it deviates from the OpenTop convention of starting static member functions with upper case. This is to be consistent with the standard C++ ostream called cerr.
static InputStreamReader& cin()
This function is also remarkable because it deviates from the OpenTop convention of starting static member functions with upper case. This is to be consistent with the standard C++ ostream called cin.
static PrintWriter& cout()
int age = 5; Console::cout() << OT_T("I am ") << age << OT_T(" years old") << endl;
It is unusual for a OpenTop function to return a raw C++ reference to a ManagedObject. However, in this case, OpenTop will ensure that the PrintWriter object exists for the lifetime of the application, thereby removing the need for application code to maintain the reference count.
This function is also remarkable because it deviates from the OpenTop convention of starting static member functions with upper case. This is to be consistent with the standard C++ ostream called cout.
static RefPtr< PrintWriter > Err()
static RefPtr< InputStreamReader > In()
static RefPtr< PrintWriter > Out()
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |