Inheritance diagram for Reader:
Public Member Functions | |
this (IBuffer buffer) | |
this (IConduit conduit) | |
uint | read (void *dst, uint count) |
Private Types | |
typedef get | opShr |
typedef get | opCall |
Private Member Functions | |
IBuffer | getBuffer () |
IArrayAllocator | getAllocator () |
void | setAllocator (IArrayAllocator memory) |
void | setDecoder (IDecoder d) |
void | wait () |
IReader | get (IReadable x) |
IReader | get (inout bool x) |
IReader | get (inout ubyte x) |
IReader | get (inout byte x) |
IReader | get (inout ushort x) |
IReader | get (inout short x) |
IReader | get (inout uint x) |
IReader | get (inout int x) |
IReader | get (inout ulong x) |
IReader | get (inout long x) |
IReader | get (inout float x) |
IReader | get (inout double x) |
IReader | get (inout real x) |
IReader | get (inout char x) |
IReader | get (inout wchar x) |
IReader | get (inout dchar x) |
IReader | get (inout ubyte[] x, uint elements=uint.max) |
IReader | get (inout byte[] x, uint elements=uint.max) |
IReader | get (inout ushort[] x, uint elements=uint.max) |
IReader | get (inout short[] x, uint elements=uint.max) |
IReader | get (inout uint[] x, uint elements=uint.max) |
IReader | get (inout int[] x, uint elements=uint.max) |
IReader | get (inout ulong[] x, uint elements=uint.max) |
IReader | get (inout long[] x, uint elements=uint.max) |
IReader | get (inout float[] x, uint elements=uint.max) |
IReader | get (inout double[] x, uint elements=uint.max) |
IReader | get (inout real[] x, uint elements=uint.max) |
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) |
Private Attributes | |
IBuffer | buffer |
Decoder | decode |
Readers support both a C++ iostream type syntax, along with a get() syntax. Operations may be chained back-to-back.
All readers support the full set of native data types, plus a selection of array types. The latter can be configured to produce either a copy (.dup) of the buffer content, or a slice. See class SimpleAllocator, BufferAllocator and SliceAllocator for more on this topic.
The code below illustrates basic operation upon a memory buffer:
Buffer buf = new Buffer (256); // map same buffer into both reader and writer IReader r = new Reader(buf); IWriter w = new Writer(buf); int i = 10; long j = 20; double d = 3.14159; char[] c = "fred"; // write data types out w << c << i << j << d; // read them back again r >> c >> i >> j >> d; // reset buf.clear(); // same thing again, but using get() syntax instead w.put(c).put(i).put(j).put(d); r.get(c).get(i).get(j).get(d);
Readers may also be used with any class implementing the IReadable interface. See PickleReader for an example of how this can be put to good use.
Definition at line 93 of file Reader.d.
|
Reimplemented from IReader. Definition at line 129 of file AbstractReader.d. |
|
Reimplemented from IReader. Definition at line 130 of file AbstractReader.d. |
|
Construct a reader on the provided buffer. Reimplemented from AbstractReader. Reimplemented in HttpReader, and EndianReader. |
|
Construct a reader on the buffer belonging to the given conduit. |
|
Definition at line 138 of file Reader.d. References IBuffer::get(), and IBuffer::readable(). Referenced by EndianReader::bits16(), EndianReader::bits32(), EndianReader::bits64(), and EndianReader::bits80(). |
|
Return the buffer associated with this reader Reimplemented from IReader. Definition at line 188 of file AbstractReader.d. |
|
Return the allocator associated with this reader.See ArrayAllocator for more information. Reimplemented from IReader. Definition at line 200 of file AbstractReader.d. References AbstractReader::memory. |
|
Set the allocator to use for array management. Arrays are always allocated by the IReader. That is, you cannot read data into an array slice (for example). Instead, a number of IArrayAllocator classes are available to manage memory allocation when reading array content. By default, an IReader will allocate each array from the heap. You can change that behavior by calling this method with an IArrayAllocator of choice. For instance, there is a BufferAllocator which will slice an array directly from the buffer where possible. Also available is the record-oriented SliceAllocator, which slices memory from within a pre-allocated heap area, and should be reset by the client code after each record has been read (to avoid unnecessary growth). See ArrayAllocator for more information. Reimplemented from IReader. Definition at line 227 of file AbstractReader.d. References IArrayAllocator::bind(). Referenced by AbstractReader::this(). |
|
Bind an IDecoder to the writer. Decoders are intended to be used as a conversion mechanism between various character representations (encodings), or the translation of any data type from one representation to another. Each data type may be configured with a distinct decoder, covering all native types (15 in total). An appropriate decoder set should be attached to each IReader, and thus be available for subsequent use. A raw binary implementation is attached by default (no encoding). See module mango.icu.UMango for an example of decoder implementation -- those classes bind the ICU converters to this IO package. Reimplemented from IReader. Definition at line 252 of file AbstractReader.d. References IDecoder::bind(), AbstractReader::decode, AbstractReader::Decoder::decoders, and IDecoder::type(). |
|
Wait for something to arrive in the buffer. This may stall the current thread forever, although usage of SocketConduit will take advantage of the timeout facilities provided there. Reimplemented from IReader. Definition at line 279 of file AbstractReader.d. References IBuffer::get(). |
|
Extract a readable class from the current read-position Reimplemented from IReader. Definition at line 290 of file AbstractReader.d. References assert(), and IReadable::read(). Referenced by AbstractReader::count(). |
|
Extract a boolean value from the current read-position Reimplemented from IReader. Definition at line 303 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int1. |
|
Extract an unsigned byte value from the current read-position Reimplemented from IReader. Definition at line 315 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int8u. |
|
Extract a byte value from the current read-position Reimplemented from IReader. Definition at line 327 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int8. |
|
Extract an unsigned short value from the current read-position Reimplemented from IReader. Definition at line 339 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int16u. |
|
Extract a short value from the current read-position Reimplemented from IReader. Definition at line 351 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int16. |
|
Extract a unsigned int value from the current read-position Reimplemented from IReader. Definition at line 363 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int32u. |
|
Extract an int value from the current read-position Reimplemented from IReader. Definition at line 375 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int32. |
|
Extract an unsigned long value from the current read-position Reimplemented from IReader. Definition at line 387 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int64u. |
|
Extract a long value from the current read-position Reimplemented from IReader. Definition at line 399 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::int64. |
|
Extract a float value from the current read-position Reimplemented from IReader. Definition at line 411 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::float32. |
|
Extract a double value from the current read-position Reimplemented from IReader. Definition at line 423 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::float64. |
|
Extract a real value from the current read-position Reimplemented from IReader. Definition at line 435 of file AbstractReader.d. References AbstractReader::decode, and AbstractReader::Decoder::float80. |
|
Extract a char value from the current read-position Reimplemented from IReader. Definition at line 447 of file AbstractReader.d. References AbstractReader::Decoder::char8, and AbstractReader::decode. |
|
Extract a wide char value from the current read-position Reimplemented from IReader. Definition at line 459 of file AbstractReader.d. References AbstractReader::Decoder::char16, and AbstractReader::decode. |
|
Extract a double char value from the current read-position Reimplemented from IReader. Definition at line 471 of file AbstractReader.d. References AbstractReader::Decoder::char32, and AbstractReader::decode. |
|
Extract an unsigned byte value from the current read-position Reimplemented from IReader. Definition at line 483 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int8u, and AbstractReader::memory. |
|
Extract a byte value from the current read-position Reimplemented from IReader. Definition at line 495 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int8, and AbstractReader::memory. |
|
Extract an unsigned short value from the current read-position Reimplemented from IReader. Definition at line 507 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int16u, and AbstractReader::memory. |
|
Extract a short value from the current read-position Reimplemented from IReader. Definition at line 519 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int16, and AbstractReader::memory. |
|
Extract a unsigned int value from the current read-position Reimplemented from IReader. Definition at line 531 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int32u, and AbstractReader::memory. |
|
Extract an int value from the current read-position Reimplemented from IReader. Definition at line 543 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int32, and AbstractReader::memory. |
|
Extract an unsigned long value from the current read-position Reimplemented from IReader. Definition at line 555 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int64u, and AbstractReader::memory. |
|
Extract a long value from the current read-position Reimplemented from IReader. Definition at line 567 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::int64, and AbstractReader::memory. |
|
Extract a float value from the current read-position Reimplemented from IReader. Definition at line 579 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::float32, and AbstractReader::memory. |
|
Extract a double value from the current read-position Reimplemented from IReader. Definition at line 591 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::float64, and AbstractReader::memory. |
|
Extract a real value from the current read-position Reimplemented from IReader. Definition at line 603 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::count(), AbstractReader::decode, AbstractReader::Decoder::float80, and AbstractReader::memory. |
|
Reimplemented from IReader. Reimplemented in TextReader. Definition at line 613 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::Decoder::char8, AbstractReader::count(), AbstractReader::decode, and AbstractReader::memory. |
|
Reimplemented from IReader. Reimplemented in TextReader. Definition at line 623 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::Decoder::char16, AbstractReader::count(), AbstractReader::decode, and AbstractReader::memory. |
|
Reimplemented from IReader. Reimplemented in TextReader. Definition at line 633 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::Decoder::char32, AbstractReader::count(), AbstractReader::decode, and AbstractReader::memory. |
|
Definition at line 162 of file AbstractReader.d. |
|
Definition at line 165 of file AbstractReader.d. Referenced by AbstractReader::get(), and AbstractReader::setDecoder(). |