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

An engine to transform LogStrings into bytes for the specific character set. 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
 Encodes as many characters from the input string as possible to the output buffer.
 
virtual void reset ()
 Resets any internal state.
 
virtual void flush (ByteBuffer &out)
 Flushes the encoder.
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual const helpers::ClassgetClass () 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)
 Encodes a string replacing unmappable characters with escape sequences.
 
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.
 

Protected Member Functions

 CharsetEncoder ()
 Protected constructor.
 

Detailed Description

An engine to transform LogStrings into bytes for the specific character set.

Constructor & Destructor Documentation

◆ CharsetEncoder()

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

Protected constructor.

◆ ~CharsetEncoder()

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

Destructor.

Member Function Documentation

◆ encode() [1/2]

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

Encodes a string replacing unmappable characters with escape sequences.

◆ encode() [2/2]

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

Encodes as many characters from the input string as possible to the output buffer.

Parameters
ininput string
iterposition in string to start.
outoutput buffer.
Returns
APR_SUCCESS unless a character can not be represented in the encoding.

◆ flush()

virtual void log4cxx::helpers::CharsetEncoder::flush ( ByteBuffer out)
virtual

Flushes the encoder.

◆ getDefaultEncoder()

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

Get encoder for default charset.

◆ getEncoder()

static 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()

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

Get encoder for UTF-8.

◆ isError()

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

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

◆ isTriviallyCopyable()

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

Is the data of src unchanged by enc.

◆ reset()

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

Resets any internal state.


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