Inheritance diagram for ConsoleReader:
Public Attributes | |
FileConduit | conduit |
Private Types | |
typedef AbstractReader get | get |
Private Member Functions | |
this (int device) | |
IReader | get (inout char[] x, uint elements=uint.max) |
IReader | get (inout wchar[] x, uint elements=uint.max) |
IReader | get (inout dchar[] x, uint elements=uint.max) |
this (IBuffer buffer, ITokenizer tokenizer=Tokenizers.line) | |
this (IConduit conduit, ITokenizer tokenizer=Tokenizers.line) | |
this (IBuffer buffer) | |
uint | int1 (void *src, uint count) |
uint | int8 (void *src, uint count) |
uint | int16 (void *src, uint count) |
uint | int32 (void *src, uint count) |
uint | int64 (void *src, uint count) |
uint | float32 (void *src, uint count) |
uint | float64 (void *src, uint count) |
uint | float80 (void *src, uint count) |
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 131 of file Stdin.d.
|
Definition at line 57 of file TextReader.d. |
|
Prohibit instantiation of this class Definition at line 148 of file Stdin.d. References FileConduit. |
|
Reimplemented from AbstractReader. Definition at line 234 of file TextReader.d. References Token::toString(). |
|
Reimplemented from AbstractReader. Definition at line 248 of file TextReader.d. References assert(). |
|
Reimplemented from AbstractReader. Definition at line 261 of file TextReader.d. References assert(). |
|
Construct a TextReader on the provided buffer, using the specified Tokenizer instead of the default one. Definition at line 72 of file TextReader.d. References TextReader::tokenizer. |
|
Construct a TextReader upon the buffer associated with the given conduit. Definition at line 100 of file TextReader.d. References TextReader::tokenizer. |
|
Return the buffer associated with this reader Reimplemented in HttpReader, EndianReader, and Reader. Definition at line 176 of file AbstractReader.d. References AbstractReader::setAllocator(). |
|
Definition at line 122 of file TextReader.d. References Token::toString(). |
|
Definition at line 136 of file TextReader.d. References Token::toInt(). |
|
Definition at line 150 of file TextReader.d. References Token::toInt(). |
|
Definition at line 164 of file TextReader.d. References Token::toInt(). |
|
Definition at line 178 of file TextReader.d. References Token::toLong(). |
|
Definition at line 192 of file TextReader.d. References Token::toReal(). |
|
Definition at line 206 of file TextReader.d. References Token::toReal(). |
|
Definition at line 220 of file TextReader.d. References Token::toReal(). |
|
Standard output conduit. This is inside the namespace to reduce clutter |