2005/5/9

     
 

class Encoder

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

acdk::locale::Encoder Class Reference

#include <Encoder.h>

Inheritance diagram for acdk::locale::Encoder:

acdk::lang::Object acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch acdk::locale::AsciiEncoder acdk::locale::AsciiUtfEncoder acdk::locale::ByteAsciiEncoder acdk::locale::CEscapeEncoder acdk::locale::IsoEncoder acdk::locale::UCS2Encoder acdk::locale::UTF8Encoder acdk::net::URLEncoder List of all members.

Detailed Description

Base interface to encode a character into a byte sequence.


Public Member Functions

 Encoder (IN(REncoding) encoding, CodingErrorAction onMalformed=ReportCodingError, CodingErrorAction onUnmappable=ReplaceCodingError)
 Please refer to REncoder getEncoder(CodingErrorAction onMalformed = ReportCodingError, CodingErrorAction onUnmappable = ReplaceCodingError).

virtual REncoding getEncoding ()
 return the encoding for this Encoder

RbyteArray getEncodingReplacement ()
 return the bytes which should be written in case of unmappable characters The returned bytes must be valid encodable/decodable

void setEncodingReplacement (IN(RbyteArray) replacement)
 set the replace byte sequence for unmappable characters

CodingErrorAction malformedInputAction ()
CodingErrorAction unmappableCharacterAction ()
void onUnmappableCharacter (CodingErrorAction newAction)
void onMalformedInput (CodingErrorAction newAction)
int bytesWritten ()
 return the bytes written by this Encoder

virtual void reset ()
 resets the counter for the bytes written by this Encoder

virtual void encode (IN(acdk::io::RWriter) out, IN(RString) str, int stopOn=-1)=0
virtual void encode (IN(acdk::io::RWriter) out, uc2char ch)=0
 Encode one character to writer.

virtual RString encode (IN(RString) str)=0
 encode the current string into this encoding

void handleUnmappable (IN(acdk::io::RWriter) out, uc2char ch)
 in case an Encoder cannot map an character this method will be called, which performces the CodingErrorAction


Protected Attributes

REncoding _encoding
CodingErrorAction _onMalformedInput
CodingErrorAction _onUnmappableCharacter
RbyteArray _encodingReplacement
int _bytesWritten


Constructor & Destructor Documentation

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

Please refer to REncoder getEncoder(CodingErrorAction onMalformed = ReportCodingError, CodingErrorAction onUnmappable = ReplaceCodingError).


Member Function Documentation

int acdk::locale::Encoder::bytesWritten  )  [inline]
 

return the bytes written by this Encoder

virtual RString acdk::locale::Encoder::encode IN(RString str  )  [pure virtual]
 

encode the current string into this encoding

Implemented in acdk::locale::AsciiEncoder, acdk::locale::AsciiUtfEncoder, acdk::locale::ByteAsciiEncoder, acdk::locale::CEscapeEncoder, acdk::locale::IsoEncoder, acdk::locale::UCS2Encoder, acdk::locale::UTF8Encoder, and acdk::net::URLEncoder.

virtual void acdk::locale::Encoder::encode IN(acdk::io::RWriter out,
uc2char  ch
[pure virtual]
 

Encode one character to writer.

Implemented in acdk::locale::AsciiUtfEncoder, and acdk::net::URLEncoder.

virtual void acdk::locale::Encoder::encode IN(acdk::io::RWriter out,
IN(RString str,
int  stopOn = -1
[pure virtual]
 

Parameters:
target writer
the string to encode
stopOn -1 = until end of string -2 = until internal 0 terminating character (normally '' >= 0 character number to write

Implemented in acdk::locale::AsciiEncoder, acdk::locale::AsciiUtfEncoder, acdk::locale::ByteAsciiEncoder, acdk::locale::CEscapeEncoder, acdk::locale::IsoEncoder, acdk::locale::UCS2Encoder, acdk::locale::UTF8Encoder, and acdk::net::URLEncoder.

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

return the encoding for this Encoder

RbyteArray acdk::locale::Encoder::getEncodingReplacement  )  [inline]
 

return the bytes which should be written in case of unmappable characters The returned bytes must be valid encodable/decodable

void acdk::locale::Encoder::handleUnmappable IN(acdk::io::RWriter out,
uc2char  ch
 

in case an Encoder cannot map an character this method will be called, which performces the CodingErrorAction

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

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

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

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

resets the counter for the bytes written by this Encoder

See also:
bytesWritten()

void acdk::locale::Encoder::setEncodingReplacement IN(RbyteArray replacement  )  [inline]
 

set the replace byte sequence for unmappable characters

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


Member Data Documentation

int acdk::locale::Encoder::_bytesWritten [protected]
 

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

RbyteArray acdk::locale::Encoder::_encodingReplacement [protected]
 

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

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