2005/5/9

     
 

class Decoder

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::locale::Decoder Class Reference

#include <Decoder.h>

Inheritance diagram for acdk::locale::Decoder:

acdk::lang::Object acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch acdk::locale::AsciiDecoder acdk::locale::AsciiUtfDecoder acdk::locale::ByteAsciiDecoder acdk::locale::CEscapeDecoder acdk::locale::IsoDecoder acdk::locale::UCS2Decoder acdk::locale::UTF8Decoder acdk::net::URLDecoder List of all members.

Detailed Description

Base class interface for decoding character from bytes.


Public Member Functions

 Decoder (IN(REncoding) encoding, CodingErrorAction onMalformed=ReportCodingError, CodingErrorAction onUnmappable=ReportCodingError)
 Please refer to RDecoder getDecoder(CodingErrorAction onMalformed = ReportCodingError, CodingErrorAction onUnmappable = ReplaceCodingError).

virtual REncoding getEncoding ()
 return the matchin encoder to this decoder

RString getDecodingReplacement ()
 return the bytes which should be written in case of unmappable characters

void setDecodingReplacement (IN(RString) replacement)
 set the replace string for unmappable character

CodingErrorAction malformedInputAction ()
CodingErrorAction unmappableCharacterAction ()
void onUnmappableCharacter (CodingErrorAction newAction)
void onMalformedInput (CodingErrorAction newAction)
int bytesReaded ()
 return the bytes readed by this Decoder

virtual void reset ()
 reset the read byte counter

virtual int decodeToChar (IN(acdk::io::RReader) in)=0
 decodes one char

virtual RString decodeToString (IN(acdk::io::RReader) in, int stopOn=-1)=0
 decodes from a byte stream to a string.

virtual RString decode (IN(RString) str)=0
 decodes a string from one encoding to another

RString handleUnmappable (uc2char ch)
 implementation to handle unmappable character/bytes


Protected Attributes

CodingErrorAction _onMalformedInput
CodingErrorAction _onUnmappableCharacter
RString _decodingReplacement
REncoding _encoding
int _bytesReaded


Constructor & Destructor Documentation

acdk::locale::Decoder::Decoder IN(REncoding encoding,
CodingErrorAction  onMalformed = ReportCodingError,
CodingErrorAction  onUnmappable = ReportCodingError
 

Please refer to RDecoder getDecoder(CodingErrorAction onMalformed = ReportCodingError, CodingErrorAction onUnmappable = ReplaceCodingError).


Member Function Documentation

int acdk::locale::Decoder::bytesReaded  )  [inline]
 

return the bytes readed by this Decoder

virtual RString acdk::locale::Decoder::decode IN(RString str  )  [pure virtual]
 

decodes a string from one encoding to another

Implemented in acdk::locale::AsciiDecoder, acdk::locale::AsciiUtfDecoder, acdk::locale::ByteAsciiDecoder, acdk::locale::CEscapeDecoder, acdk::locale::IsoDecoder, acdk::locale::UCS2Decoder, acdk::locale::UTF8Decoder, and acdk::net::URLDecoder.

virtual int acdk::locale::Decoder::decodeToChar IN(acdk::io::RReader in  )  [pure virtual]
 

decodes one char

Returns:
return ucchar or -1 if end of file, -2 if input is not mappable

Implemented in acdk::locale::AsciiDecoder, acdk::locale::AsciiUtfDecoder, acdk::locale::ByteAsciiDecoder, acdk::locale::CEscapeDecoder, acdk::locale::IsoDecoder, acdk::locale::UCS2Decoder, acdk::locale::UTF8Decoder, and acdk::net::URLDecoder.

virtual RString acdk::locale::Decoder::decodeToString IN(acdk::io::RReader in,
int  stopOn = -1
[pure virtual]
 

decodes from a byte stream to a string.

In normal cases the String contains a Ascii encoding if only 7bit character are in the byte stream.

Parameters:
in reader to read from
stopOn -1 = until end of string -2 = until internal 0 terminating character (normally '' >= 0 character number to write

Implemented in acdk::locale::AsciiDecoder, acdk::locale::AsciiUtfDecoder, acdk::locale::ByteAsciiDecoder, acdk::locale::CEscapeDecoder, acdk::locale::IsoDecoder, acdk::locale::UCS2Decoder, acdk::locale::UTF8Decoder, and acdk::net::URLDecoder.

RString acdk::locale::Decoder::getDecodingReplacement  )  [inline]
 

return the bytes which should be written in case of unmappable characters

REncoding acdk::locale::Decoder::getEncoding  )  [inline, virtual]
 

return the matchin encoder to this decoder

RString acdk::locale::Decoder::handleUnmappable uc2char  ch  ) 
 

implementation to handle unmappable character/bytes

CodingErrorAction acdk::locale::Decoder::malformedInputAction  )  [inline]
 

void acdk::locale::Decoder::onMalformedInput CodingErrorAction  newAction  )  [inline]
 

void acdk::locale::Decoder::onUnmappableCharacter CodingErrorAction  newAction  )  [inline]
 

virtual void acdk::locale::Decoder::reset  )  [inline, virtual]
 

reset the read byte counter

See also:
bytesReaded()

void acdk::locale::Decoder::setDecodingReplacement IN(RString replacement  )  [inline]
 

set the replace string for unmappable character

CodingErrorAction acdk::locale::Decoder::unmappableCharacterAction  )  [inline]
 


Member Data Documentation

int acdk::locale::Decoder::_bytesReaded [protected]
 

RString acdk::locale::Decoder::_decodingReplacement [protected]
 

REncoding acdk::locale::Decoder::_encoding [protected]
 

CodingErrorAction acdk::locale::Decoder::_onMalformedInput [protected]
 

CodingErrorAction acdk::locale::Decoder::_onUnmappableCharacter [protected]