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

VersionMango::StringDecoder Class Reference

Inheritance diagram for VersionMango::StringDecoder:

IReadable IDecoder VersionMango::StringDecoder16 List of all members.

Public Member Functions

uint read (IBuffer b, wchar[] dst)
uint decoder (void *p, uint capacity)
ConverterType type ()
void setLimit (uint limit)
void setConverter (UConverter cvt)
void reset (uint limit=uint.max)
BufferDecoder bind (IReader reader)

Protected Member Functions

uint toGo ()
void read (IReader r)

Private Member Functions

final void decode (IBuffer buffer, int(*dg)(void[]))

Private Attributes

UConverter cvt
bool done
IBuffer bound
uint limit = uint.max

Detailed Description

Abstract base class for String decoders. These decoders bind the ICU functionality to the Mango.io package, and provide some utility functions such as input streaming.

These decoder classes will always attempt to fill their destination (provided) output array, but may terminate early if (a) a defined read 'limit' on the input stream has been reached or (b) a partial surrogate-pair would be left at the output tail. Each decoder returns a count of how many output elements were actually converted.

Definition at line 70 of file UMango.d.


Member Function Documentation

uint read IBuffer  b,
wchar[]  dst
 

Decoders can be used to convert directly into a provided destination. The converter will try to fill the destination, up to the configured input 'limit', and returns the number of elements thus converted. This returned value will be less than the destination capacity when either the 'limit' was reached, or when a partial surrogate would be placed at the tail.

Reimplemented in VersionMango::StringDecoder16.

uint decoder void *  p,
uint  capacity
 

Signature for BufferDecoder handlers. These decoders are intended to be usable as the default handlers within the reader constructs. Use IReader.setDecoder() to set a decoder as the default handler.

Reimplemented in VersionMango::StringDecoder16.

ConverterType type  ) 
 

Return the type of this decoder

Reimplemented from IDecoder.

Reimplemented in VersionMango::StringDecoder16.

void setLimit uint  limit  )  [inline]
 

Set the limit for this decoder. This will cause the decoder to halt after reading the specified number of bytes from its input. The decoder may also halt before that point if the destination becomes full. Use method toGo() to monitor how much content has been read so far.

Definition at line 123 of file UMango.d.

void setConverter UConverter  cvt  )  [inline]
 

Change the converter used for this decoder.

Definition at line 134 of file UMango.d.

void reset uint  limit = uint.max  )  [inline]
 

Reset the converter and the input limit. The latter defaults to being unlimited, causing the decoder to read until the destination is full.

Definition at line 149 of file UMango.d.

uint toGo  )  [inline, protected]
 

Return the number of bytes yet to be read

Definition at line 161 of file UMango.d.

void read IReader  r  )  [inline, protected]
 

Placeholder for subclasses to do something useful when applied to an IReader. See UString for an example of such usage.

Reimplemented from IReadable.

Definition at line 174 of file UMango.d.

BufferDecoder bind IReader  reader  )  [inline]
 

Bind this StringDecoder to the specified IReader. This is invoked by an IReader to install it as the default handler, and thus be used by all subsequent IReader.get() requests for the subclass type.

Note that the byte limit will be respected if 'limit' has been set, which can be useful when converting an unknown number of elements (a la HTTP).

Reimplemented from IDecoder.

Definition at line 191 of file UMango.d.

References BufferDecoder, and IReader::getBuffer().

final void decode IBuffer  buffer,
int(*  dg)(void[])
[inline, private]
 

Decode IBuffer input until the delegate indicates it is finished. Typically, that occurs when either the destination is full, or the input 'limit' has been reached.

Definition at line 206 of file UMango.d.

References IBuffer::get(), and IBuffer::read().


Member Data Documentation

UConverter cvt [private]
 

Definition at line 72 of file UMango.d.

bool done [private]
 

Definition at line 73 of file UMango.d.

IBuffer bound [private]
 

Definition at line 74 of file UMango.d.

uint limit = uint.max [private]
 

Definition at line 75 of file UMango.d.


The documentation for this class was generated from the following file:
Generated on Tue Jan 25 21:18:45 2005 for Mango by doxygen 1.3.6