ZStrimR Class Reference
[StrimsUnicode]

Inheritance diagram for ZStrimR:

ZStrimR_Boundary ZStrimR_CRLFRemove ZStrimR_Limited ZStrimR_Null ZStrimR_StreamDecoder ZStrimR_StreamUTF16BE ZStrimR_StreamUTF16LE ZStrimR_StreamUTF32BE ZStrimR_StreamUTF32LE ZStrimR_StreamUTF8 ZStrimR_Tee ZStrimU List of all members.

Read a single code point

bool ReadCP (UTF32 &oCP) const
 Read a single CP, returning false if the end of the strim has been reached.
UTF32 ReadCP () const
 Read a single CP and return it, throwing end of strim if necessary.

Standard library strings

string32 ReadUTF32 (size_t iCountCP) const
string16 ReadUTF16 (size_t iCountCP) const
string8 ReadUTF8 (size_t iCountCP) const

String buffers

void Read (UTF32 *iDest, size_t iCount, size_t *oCount) const

String buffers, limiting and reporting both CU and CP

void Read (UTF16 *iDest, size_t iCountCU, size_t *oCountCU, size_t iCountCP, size_t *oCountCP) const

Copy To

Read code points from this strim and write them to iStrimW.

void CopyAllTo (const ZStrimW &iStrimW) const
 Read data from this strim and write it to iStrimW until this strim reaches its end.
void CopyAllTo (const ZStrimW &iStrimW, size_t *oCountCPRead, size_t *oCountCPWritten) const
 Read data from this strim and write it to iStrimW until one or other strim reaches its end.
void CopyTo (const ZStrimW &iStrimW, size_t iCountCP) const
 Read data from this strim and write it to iStrimW.
void CopyTo (const ZStrimW &iStrimW, size_t iCountCP, size_t *oCountCPRead, size_t *oCountCPWritten) const
 Read data from this strimg and write it to iStrimW.

Skip

Skip over code points from this strim without returning them to the caller.

void Skip (size_t iCountCP) const
 Skip over iCount code points.
void Skip (size_t iCountCP, size_t *oCountCPSkipped) const
 Attempt to skip bytes, return the count actually skipped.
void SkipAll () const
 Skip code points until the end of the strim is reached.
void SkipAll (size_t *oCountCPSkipped) const
 Skip code points until the end of the strim is reached, return the count actually skipped.

Essential overrides

These methods must be overridden by subclasses.

virtual void Imp_ReadUTF32 (UTF32 *iDest, size_t iCount, size_t *oCount)=0

Optional overrides

Default implementations that directly or indirectly call ZStrimR::Imp_ReadUTF32 are provided, but particular subclasses may have more efficient implementations available.

virtual void Imp_ReadUTF16 (UTF16 *iDest, size_t iCountCU, size_t *oCountCU, size_t iCountCP, size_t *oCountCP)
virtual void Imp_ReadUTF8 (UTF8 *iDest, size_t iCountCU, size_t *oCountCU, size_t iCountCP, size_t *oCountCP)
virtual void Imp_CopyToDispatch (const ZStrimW &iStrimW, size_t iCountCP, size_t *oCountCPRead, size_t *oCountCPWritten)
 Invoke iStrimW's Imp_CopyFrom method.
virtual void Imp_CopyTo (const ZStrimW &iStrimW, size_t iCountCP, size_t *oCountCPRead, size_t *oCountCPWritten)
 Actually copy data from this strim to iStrimW.
virtual void Imp_Skip (size_t iCountCP, size_t *oCountCPSkipped)
 Read and discard iCountCP code points.

Canonical Methods

The canonical methods are protected, thus you cannot create, destroy or assign through a ZStrimR reference, you must work with some derived class.

 ZStrimR ()
 ~ZStrimR ()
 ZStrimR (const ZStrimR &)
ZStrimRoperator= (const ZStrimR &)

Detailed Description

See also:
Strims

Unicode


Member Function Documentation

bool ZStrimR::ReadCP ( UTF32 &  oCP  )  const

Read a single CP, returning false if the end of the strim has been reached.

Read a single CP from the strim and place it in oCP. If the CP was successfully read then true is returned, otherwise false is returned and the value of oCP is undefined.

string32 ZStrimR::ReadUTF32 ( size_t  iCountCP  )  const

Read iCountCP code points and return them in a string32. May throw an end of read strim exception.

string16 ZStrimR::ReadUTF16 ( size_t  iCountCP  )  const

Read iCountCP code points and return them in a string16. May throw an end of read strim exception.

string8 ZStrimR::ReadUTF8 ( size_t  iCountCP  )  const

Read iCountCP code points and return them in a string. May throw an end of read strim exception.

void ZStrimR::Read ( UTF32 *  iDest,
size_t  iCount,
size_t *  oCount 
) const

Read iCount code units into the memory starting at iDest and extending to iDest + iCount. The number of code units actually read is placed in oCount.

void ZStrimR::Read ( UTF16 *  iDest,
size_t  iCountCU,
size_t *  oCountCU,
size_t  iCountCP,
size_t *  oCountCP 
) const

Read code points into the buffer at iDest. No more than iCountCU code units will be read, and no more code units than make up iCountCP code points will be read. If oCountCU is non-nil then the actual number of code units will be placed in *oCountCU. If oCountCP is non-nil then the actual number of code points will be placed in *oCountCP. Note that some strim implementations generate the number of code points as a natural side effect of their operation, whereas for others its necessary that they examine the read data, adding some overhead. If you don't need to know the number of code points then it is best to pass nil for oCountCP.

void ZStrimR::CopyAllTo ( const ZStrimW iStrimW,
size_t *  oCountCPRead,
size_t *  oCountCPWritten 
) const

Read data from this strim and write it to iStrimW until one or other strim reaches its end.

Parameters:
iStrimW The strim to which the code points should be written.
oCountCPRead (optional output) The number of code points that were actually read.
oCountCPWritten (optional output) The number of code points that were actually written.
oCountCPWritten will be less than or equal to oCountCPRead. If oCountCPWritten is less than oCountCPRead it's a strong indication that iStrimW has reached its end, and a subsequent call to CopyTo or the iStrimW's Write will likely return zero in oCountCPWritten.

void ZStrimR::CopyTo ( const ZStrimW iStrimW,
size_t  iCountCP 
) const

Read data from this strim and write it to iStrimW.

Parameters:
iStrimW The strim to which the data should be written.
iCountCP The number of code points to be read from this strimg and written to iStrimgW.
If iCount bytes could not be read then an end of read strim exception is thrown. If iCount bytes could not be written then an end of write strim exception is thrown.

void ZStrimR::CopyTo ( const ZStrimW iStrimW,
size_t  iCountCP,
size_t *  oCountCPRead,
size_t *  oCountCPWritten 
) const

Read data from this strimg and write it to iStrimW.

Parameters:
iStrimW The strim to which the data should be written.
iCountCP The number of code points to be read from this strim and written to iStrimW.
oCountCPRead (optional output) The number of code points that were actually read.
oCountCPWritten (optional output) The number of code points that were actually written.

void ZStrimR::Skip ( size_t  iCountCP  )  const

Skip over iCount code points.

Parameters:
iCountCP The number of bytes to be skipped over. If the strim reaches its end prematurely then an end of strim exception is thrown.

void ZStrimR::SkipAll ( size_t *  oCountCPSkipped  )  const

Skip code points until the end of the strim is reached, return the count actually skipped.

Parameters:
oCountCPSkipped (optional output) The number of code points actually skipped. If zero is returned then the end of the strim had already been reached.

void ZStrimR::Imp_CopyToDispatch ( const ZStrimW iStrimW,
size_t  iCountCP,
size_t *  oCountCPRead,
size_t *  oCountCPWritten 
) [virtual]

Invoke iStrimW's Imp_CopyFrom method.

The first part of the two-stage dispatch initiated by CopyTo and CopyAllTo. Override this method if your strim's data is in memory and thus can be written to iStrimW by a single call to its Write method.

Reimplemented in ZStrimR_Null, and ZStrimR_Limited.

void ZStrimR::Imp_CopyTo ( const ZStrimW iStrimW,
size_t  iCountCP,
size_t *  oCountCPRead,
size_t *  oCountCPWritten 
) [virtual]

Actually copy data from this strim to iStrimW.

The second part of the two-stage dispatch initiated by CopyTo and CopyAllTo. The default implementation calls sCopyReadToWrite. Override this method if your strim's data is in memory and thus can be written to iStrimW by a single call to its Write method.

See also:
sCopyReadToWrite

Reimplemented in ZStrimR_Null, and ZStrimR_Limited.

void ZStrimR::Imp_Skip ( size_t  iCountCP,
size_t *  oCountCPSkipped 
) [virtual]

Read and discard iCountCP code points.

Override this method if your strim implementation can skip past code points without actually reading them.

Parameters:
iCountCP Count of code points to be skipped.
oCountCPSkipped Number of code points that were actually skipped. If iCountCP is non zero and oCountCPSkipped is set to zero then this indicates that the strim has reached its end.

Reimplemented in ZStrimR_Null, and ZStrimR_Limited.


The documentation for this class was generated from the following files:
Generated on Thu Jul 26 11:22:06 2007 for ZooLib by  doxygen 1.4.7