Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

TextReader Class Reference

Inheritance diagram for TextReader:

AbstractReader ConsoleReader List of all members.

Public Types

typedef AbstractReader get get

Public Member Functions

 this (IBuffer buffer, ITokenizer tokenizer=Tokenizers.line)
 this (IConduit conduit, ITokenizer tokenizer=Tokenizers.line)
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)
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 Types

typedef get opShr
typedef get opCall

Private Member Functions

final Token next ()
 this (IBuffer buffer)
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)

Private Attributes

Token token
ITokenizer tokenizer
IBuffer buffer
Decoder decode

Detailed Description

Grok readable input from a stream. All input is tokenized from the associated buffer, and converted as necessary into the destination location. A SpaceTokenizer is used by default, but you can choose an alternative (such as a comma-delimiting tokenizer).

Definition at line 55 of file TextReader.d.


Member Typedef Documentation

typedef AbstractReader get get
 

Definition at line 57 of file TextReader.d.

typedef get opShr [inherited]
 

Reimplemented from IReader.

Definition at line 129 of file AbstractReader.d.

typedef get opCall [inherited]
 

Reimplemented from IReader.

Definition at line 130 of file AbstractReader.d.


Member Function Documentation

this IBuffer  buffer,
ITokenizer  tokenizer = Tokenizers.line
[inline]
 

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 tokenizer.

this IConduit  conduit,
ITokenizer  tokenizer = Tokenizers.line
[inline]
 

Construct a TextReader upon the buffer associated with the given conduit.

Definition at line 100 of file TextReader.d.

References tokenizer.

final Token next  )  [inline, private]
 

Internal method to isolate the next token.

Definition at line 111 of file TextReader.d.

References Token::getLength(), ITokenizer::next(), and tokenizer.

uint int1 void *  src,
uint  count
[inline]
 

Definition at line 122 of file TextReader.d.

References Token::toString().

uint int8 void *  src,
uint  count
[inline]
 

Definition at line 136 of file TextReader.d.

References Token::toInt().

uint int16 void *  src,
uint  count
[inline]
 

Definition at line 150 of file TextReader.d.

References Token::toInt().

uint int32 void *  src,
uint  count
[inline]
 

Definition at line 164 of file TextReader.d.

References Token::toInt().

uint int64 void *  src,
uint  count
[inline]
 

Definition at line 178 of file TextReader.d.

References Token::toLong().

uint float32 void *  src,
uint  count
[inline]
 

Definition at line 192 of file TextReader.d.

References Token::toReal().

uint float64 void *  src,
uint  count
[inline]
 

Definition at line 206 of file TextReader.d.

References Token::toReal().

uint float80 void *  src,
uint  count
[inline]
 

Definition at line 220 of file TextReader.d.

References Token::toReal().

IReader get inout char[]  x,
uint  elements = uint.max
[inline]
 

Reimplemented from AbstractReader.

Definition at line 234 of file TextReader.d.

References Token::toString().

IReader get inout wchar[]  x,
uint  elements = uint.max
[inline]
 

Todo:
  • Tokenizer needs to handle wchar[] before this will operate correctly

Reimplemented from AbstractReader.

Definition at line 248 of file TextReader.d.

References assert().

IReader get inout dchar[]  x,
uint  elements = uint.max
[inline]
 

Todo:
  • Tokenizer needs to handle dchar[] before this will operate correctly

Reimplemented from AbstractReader.

Definition at line 261 of file TextReader.d.

References assert().

this IBuffer  buffer  )  [inline, inherited]
 

Return the buffer associated with this reader

Reimplemented in HttpReader, EndianReader, and Reader.

Definition at line 176 of file AbstractReader.d.

References AbstractReader::setAllocator().

IBuffer getBuffer  )  [inline, inherited]
 

Return the buffer associated with this reader

Reimplemented from IReader.

Definition at line 188 of file AbstractReader.d.

IArrayAllocator getAllocator  )  [inline, inherited]
 

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.

void setAllocator IArrayAllocator  memory  )  [inline, inherited]
 

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().

void setDecoder IDecoder  d  )  [inline, inherited]
 

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().

void wait  )  [inline, inherited]
 

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().

IReader get IReadable  x  )  [inline, inherited]
 

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().

IReader get inout bool  x  )  [inline, inherited]
 

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.

IReader get inout ubyte  x  )  [inline, inherited]
 

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.

IReader get inout byte  x  )  [inline, inherited]
 

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.

IReader get inout ushort  x  )  [inline, inherited]
 

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.

IReader get inout short  x  )  [inline, inherited]
 

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.

IReader get inout uint  x  )  [inline, inherited]
 

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.

IReader get inout int  x  )  [inline, inherited]
 

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.

IReader get inout ulong  x  )  [inline, inherited]
 

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.

IReader get inout long  x  )  [inline, inherited]
 

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.

IReader get inout float  x  )  [inline, inherited]
 

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.

IReader get inout double  x  )  [inline, inherited]
 

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.

IReader get inout real  x  )  [inline, inherited]
 

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.

IReader get inout char  x  )  [inline, inherited]
 

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.

IReader get inout wchar  x  )  [inline, inherited]
 

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.

IReader get inout dchar  x  )  [inline, inherited]
 

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.

IReader get inout ubyte[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout byte[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout ushort[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout short[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout uint[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout int[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout ulong[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout long[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout float[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout double[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.

IReader get inout real[]  x,
uint  elements = uint.max
[inline, inherited]
 

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.


Member Data Documentation

Token token [private]
 

Definition at line 60 of file TextReader.d.

ITokenizer tokenizer [private]
 

Definition at line 63 of file TextReader.d.

Referenced by next(), and this().

IBuffer buffer [protected, inherited]
 

Definition at line 162 of file AbstractReader.d.

Decoder decode [protected, inherited]
 

Definition at line 165 of file AbstractReader.d.

Referenced by AbstractReader::get(), and AbstractReader::setDecoder().


The documentation for this class was generated from the following file:
Generated on Sun Mar 6 00:31:15 2005 for Mango by doxygen 1.3.6