Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
log4cxx::helpers::CharsetEncoder Class Referenceabstract

An abstract base for classes that transform LogString codepoints to the byte sequence representation of the codepoints. More...

#include <charsetencoder.h>

Inheritance diagram for log4cxx::helpers::CharsetEncoder:
log4cxx::helpers::Object

Public Member Functions

virtual ~CharsetEncoder ()
 Destructor.
virtual log4cxx_status_t encode (const LogString &in, LogString::const_iterator &iter, ByteBuffer &out)=0
 Encode into out codepoints of in until out is full or an invalid value is encountered.
virtual log4cxx_status_t encode (unsigned int codePoint, ByteBuffer &out)=0
 Add onto out an encoded equivalent of codePoint.
virtual void reset ()
 Resets any internal state.
Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
virtual const helpers::Class & getClass () const =0
virtual bool instanceof (const Class &clazz) const =0
virtual const void * cast (const Class &clazz) const =0

Static Public Member Functions

static CharsetEncoderPtr getDefaultEncoder ()
 Get encoder for default charset.
static CharsetEncoderPtr getEncoder (const LogString &charset)
 Get encoder for specified character set.
static CharsetEncoderPtr getUTF8Encoder ()
 Get encoder for UTF-8.
static void encode (CharsetEncoderPtr &enc, const LogString &src, LogString::const_iterator &iter, ByteBuffer &dst)
 Use enc to encode into out codepoints of src until out is full or an invalid value is encountered.
static bool isError (log4cxx_status_t stat)
 Determines if the return value from encode indicates an unconvertable character.
static bool isTriviallyCopyable (const LogString &src, const CharsetEncoderPtr &enc)
 Is the data of src unchanged by enc.
static size_t putUTF8CodePoint (unsigned int ch, char *dst)
 Add UTF-8 bytes to dst corresponding to ch.
static size_t putUTF16BECodePoint (unsigned int ch, char *dst)
 Add UTF-16 big-endian bytes to dst corresponding to ch.
static size_t putUTF16LECodePoint (unsigned int ch, char *dst)
 Add UTF-16 little-endian bytes to dst corresponding to ch.

Protected Member Functions

 CharsetEncoder ()
 Protected constructor.

Detailed Description

An abstract base for classes that transform LogString codepoints to the byte sequence representation of the codepoints.

Constructor & Destructor Documentation

◆ CharsetEncoder()

log4cxx::helpers::CharsetEncoder::CharsetEncoder ( )
protected

Protected constructor.

◆ ~CharsetEncoder()

virtual log4cxx::helpers::CharsetEncoder::~CharsetEncoder ( )
virtual

Destructor.

Member Function Documentation

◆ encode() [1/3]

void log4cxx::helpers::CharsetEncoder::encode ( CharsetEncoderPtr & enc,
const LogString & src,
LogString::const_iterator & iter,
ByteBuffer & dst )
static

Use enc to encode into out codepoints of src until out is full or an invalid value is encountered.

If encoding is stopped by an invalid value, a replacement character is added to out and iter is advanced past the invalid value.

Precondition
iter is a valid, dereferenceable iterator.
iter and the end of src are in the same sequence.

◆ encode() [2/3]

virtual log4cxx_status_t log4cxx::helpers::CharsetEncoder::encode ( const LogString & in,
LogString::const_iterator & iter,
ByteBuffer & out )
pure virtual

Encode into out codepoints of in until out is full or an invalid value is encountered.

Precondition
iter is a valid, dereferenceable iterator.
iter and the end of in are in the same sequence.
Returns
APR_SUCCESS unless an invalid value is encountered

◆ encode() [3/3]

virtual log4cxx_status_t log4cxx::helpers::CharsetEncoder::encode ( unsigned int codePoint,
ByteBuffer & out )
pure virtual

Add onto out an encoded equivalent of codePoint.

Returns
APR_SUCCESS unless codePoint cannot be represented by this charset or out is full.

◆ getDefaultEncoder()

CharsetEncoderPtr log4cxx::helpers::CharsetEncoder::getDefaultEncoder ( )
static

Get encoder for default charset.

◆ getEncoder()

CharsetEncoderPtr log4cxx::helpers::CharsetEncoder::getEncoder ( const LogString & charset)
static

Get encoder for specified character set.

Parameters
charsetthe following values should be recognized: "US-ASCII", "ISO-8859-1", "UTF-8", "UTF-16BE", "UTF-16LE".
Returns
encoder.
Exceptions
IllegalArgumentExceptionif encoding is not recognized.

◆ getUTF8Encoder()

CharsetEncoderPtr log4cxx::helpers::CharsetEncoder::getUTF8Encoder ( )
static

Get encoder for UTF-8.

◆ isError()

bool log4cxx::helpers::CharsetEncoder::isError ( log4cxx_status_t stat)
inlinestatic

Determines if the return value from encode indicates an unconvertable character.

◆ isTriviallyCopyable()

bool log4cxx::helpers::CharsetEncoder::isTriviallyCopyable ( const LogString & src,
const CharsetEncoderPtr & enc )
static

Is the data of src unchanged by enc.

◆ putUTF16BECodePoint()

size_t log4cxx::helpers::CharsetEncoder::putUTF16BECodePoint ( unsigned int ch,
char * dst )
static

Add UTF-16 big-endian bytes to dst corresponding to ch.

Precondition
dst is a writable address for 4 consecutive bytes
Parameters
chthe code point value.
dststorage for upto 4 bytes.

◆ putUTF16LECodePoint()

size_t log4cxx::helpers::CharsetEncoder::putUTF16LECodePoint ( unsigned int ch,
char * dst )
static

Add UTF-16 little-endian bytes to dst corresponding to ch.

Precondition
dst is a writable address for 4 consecutive bytes
Parameters
chthe code point value.
dststorage for upto 4 bytes.

◆ putUTF8CodePoint()

size_t log4cxx::helpers::CharsetEncoder::putUTF8CodePoint ( unsigned int ch,
char * dst )
static

Add UTF-8 bytes to dst corresponding to ch.

Precondition
dst is a writable address for 4 consecutive bytes
Parameters
chthe code point value.
dststorage for upto 4 bytes.

◆ reset()

virtual void log4cxx::helpers::CharsetEncoder::reset ( )
virtual

Resets any internal state.


The documentation for this class was generated from the following file: