Inheritance diagram for ConsoleWriter:
Public Attributes | |
FileConduit | conduit |
Private Types | |
typedef DisplayWriter put | put |
Private Member Functions | |
this (int device) | |
IWriter | put (IWritable x) |
this (IBuffer buffer) | |
this (IConduit conduit) | |
Static Private Member Functions | |
this () |
An alternative is to use put() notation like so:
char[] msg = "on the console"; Stdout.put ("print ") .put (1) .put (' ') .put ("message ") .put (msg) .put (CR);
Another alternative is to use the C++ iostream operators like so:
Since console idioms are based upon FileConduit, you can use them as direct targets for Conduit operations. For example, the code:
copies a text file directly to the console. Likewise, you can copy console input directly to a FileConduit or a SocketConduit. Input via Stdin is similar in nature, but uses the Token classes to isolate and parse each token on an input line:
Note that Stdin awaits a carriage-return before parsing the input into the targets. Note also that the Stdout and Stderr are not written to be thread-safe. As such you may find that output from two threads intersect across each other. If this is a problem you should wrap a synchronized block around the offending entity, like so:
Alternatively, please consider using the mango.log (Logger) package to provide detailed runtime diagnostics from your application. The functionality exposed there is likely sufficient for most application needs.
Redirecting the standard IO handles (via a shell) operates as one would expect.
Definition at line 128 of file Stdout.d.
|
Definition at line 391 of file DisplayWriter.d. |
|
Prohibit instantiation of this class Definition at line 145 of file Stdout.d. References FileConduit. |
|
Intercept the IWritable method to catch newlines, and flush the buffer whenever one is emitted Reimplemented from AbstractWriter. Definition at line 422 of file DisplayWriter.d. References AbstractWriter::flush(), and IWriter::put(). |
|
Construct a FlushWriter upon the specified IBuffer Reimplemented from DisplayWriter. Definition at line 399 of file DisplayWriter.d. |
|
Construct a FlushWriter upon the specified IConduit Reimplemented from DisplayWriter. Definition at line 410 of file DisplayWriter.d. |
|
Construct some static exception instances Reimplemented in ColumnWriter. Definition at line 162 of file AbstractWriter.d. References AbstractWriter::ovf. |
|
Standard output conduits. These are inside the namespace to reduce clutter |