Apache log4cxx  Version 0.12.1
log4cxx::helpers::Transcoder Class Reference

Simple transcoder for converting between external char and wchar_t strings and internal strings. More...

#include <transcoder.h>

Public Types

enum  { LOSSCHAR = 0x3F }
 

Static Public Member Functions

static void decodeUTF8 (const std::string &src, LogString &dst)
 Appends this specified string of UTF-8 characters to LogString. More...
 
static void encodeUTF8 (const LogString &src, std::string &dst)
 Converts the LogString to a UTF-8 string. More...
 
static char * encodeUTF8 (const LogString &src, log4cxx::helpers::Pool &p)
 Converts the LogString to a UTF-8 string. More...
 
static void encodeUTF8 (unsigned int sv, ByteBuffer &dst)
 Append UCS-4 code point to a byte buffer as UTF-8. More...
 
static void encodeUTF16LE (unsigned int sv, ByteBuffer &dst)
 Append UCS-4 code point to a byte buffer as UTF-16LE. More...
 
static void encodeUTF16BE (unsigned int sv, ByteBuffer &dst)
 Append UCS-4 code point to a byte buffer as UTF-16BE. More...
 
static unsigned int decode (const std::string &in, std::string::const_iterator &iter)
 Decodes next character from a UTF-8 string. More...
 
static void encode (unsigned int ch, std::string &dst)
 Appends UCS-4 value to a UTF-8 string. More...
 
static void decode (const std::string &src, LogString &dst)
 Appends string in the current code-page to a LogString. More...
 
static void encode (const LogString &src, std::string &dst)
 Appends a LogString to a string in the current code-page. More...
 
static char * encode (const LogString &src, log4cxx::helpers::Pool &p)
 Encodes the specified LogString to the current character set. More...
 
static void decode (const std::wstring &src, LogString &dst)
 
static void encode (const LogString &src, std::wstring &dst)
 
static wchar_t * wencode (const LogString &src, log4cxx::helpers::Pool &p)
 
static unsigned int decode (const std::wstring &in, std::wstring::const_iterator &iter)
 Decodes next character from a wstring. More...
 
static void encode (unsigned int ch, std::wstring &dst)
 Appends UCS-4 value to a UTF-8 string. More...
 
static void decode (const std::basic_string< UniChar > &src, LogString &dst)
 
static void encode (const LogString &src, std::basic_string< UniChar > &dst)
 
static unsigned int decode (const std::basic_string< UniChar > &in, std::basic_string< UniChar >::const_iterator &iter)
 Decodes next character from a UniChar string. More...
 
static void encode (unsigned int ch, std::basic_string< UniChar > &dst)
 Appends UCS-4 value to a UTF-8 string. More...
 
static void decode (const CFStringRef &src, LogString &dst)
 
static CFStringRef encode (const LogString &src)
 
static logchar decode (char v)
 Returns a logchar value given a character literal in the ASCII charset. More...
 
static LogString decode (const char *v)
 Returns a LogString given a string literal in the ASCII charset. More...
 
static std::string encodeCharsetName (const LogString &charsetName)
 Encodes a charset name in the default encoding without using a CharsetEncoder (which could trigger recursion). More...
 

Detailed Description

Simple transcoder for converting between external char and wchar_t strings and internal strings.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LOSSCHAR 

Member Function Documentation

◆ decode() [1/9]

static unsigned int log4cxx::helpers::Transcoder::decode ( const std::string &  in,
std::string::const_iterator &  iter 
)
static

Decodes next character from a UTF-8 string.

Parameters
instring from which the character is extracted.
iteriterator addressing start of character, will be advanced to next character if successful.
Returns
scalar value (UCS-4) or 0xFFFF if invalid sequence.

◆ decode() [2/9]

static void log4cxx::helpers::Transcoder::decode ( const std::string &  src,
LogString dst 
)
static

Appends string in the current code-page to a LogString.

◆ decode() [3/9]

static void log4cxx::helpers::Transcoder::decode ( const std::wstring &  src,
LogString dst 
)
static

◆ decode() [4/9]

static unsigned int log4cxx::helpers::Transcoder::decode ( const std::wstring &  in,
std::wstring::const_iterator &  iter 
)
static

Decodes next character from a wstring.

Parameters
instring from which the character is extracted.
iteriterator addressing start of character, will be advanced to next character if successful.
Returns
scalar value (UCS-4) or 0xFFFF if invalid sequence.

◆ decode() [5/9]

static void log4cxx::helpers::Transcoder::decode ( const std::basic_string< UniChar > &  src,
LogString dst 
)
static

◆ decode() [6/9]

static unsigned int log4cxx::helpers::Transcoder::decode ( const std::basic_string< UniChar > &  in,
std::basic_string< UniChar >::const_iterator &  iter 
)
static

Decodes next character from a UniChar string.

Parameters
instring from which the character is extracted.
iteriterator addressing start of character, will be advanced to next character if successful.
Returns
scalar value (UCS-4) or 0xFFFF if invalid sequence.

◆ decode() [7/9]

static void log4cxx::helpers::Transcoder::decode ( const CFStringRef src,
LogString dst 
)
static

◆ decode() [8/9]

static logchar log4cxx::helpers::Transcoder::decode ( char  v)
static

Returns a logchar value given a character literal in the ASCII charset.

Used to implement the LOG4CXX_STR macro for EBCDIC and UNICHAR.

◆ decode() [9/9]

static LogString log4cxx::helpers::Transcoder::decode ( const char *  v)
static

Returns a LogString given a string literal in the ASCII charset.

Used to implement the LOG4CXX_STR macro for EBCDIC and UNICHAR.

◆ decodeUTF8()

static void log4cxx::helpers::Transcoder::decodeUTF8 ( const std::string &  src,
LogString dst 
)
static

Appends this specified string of UTF-8 characters to LogString.

◆ encode() [1/8]

static void log4cxx::helpers::Transcoder::encode ( unsigned int  ch,
std::string &  dst 
)
static

Appends UCS-4 value to a UTF-8 string.

Parameters
chUCS-4 value.
dstdestination.

◆ encode() [2/8]

static void log4cxx::helpers::Transcoder::encode ( const LogString src,
std::string &  dst 
)
static

Appends a LogString to a string in the current code-page.

Unrepresentable characters may be replaced with loss characters.

◆ encode() [3/8]

static char* log4cxx::helpers::Transcoder::encode ( const LogString src,
log4cxx::helpers::Pool p 
)
static

Encodes the specified LogString to the current character set.

Parameters
srcstring to encode.
ppool from which to allocate return value.
Returns
pool allocated string.

◆ encode() [4/8]

static void log4cxx::helpers::Transcoder::encode ( const LogString src,
std::wstring &  dst 
)
static

◆ encode() [5/8]

static void log4cxx::helpers::Transcoder::encode ( unsigned int  ch,
std::wstring &  dst 
)
static

Appends UCS-4 value to a UTF-8 string.

Parameters
chUCS-4 value.
dstdestination.

◆ encode() [6/8]

static void log4cxx::helpers::Transcoder::encode ( const LogString src,
std::basic_string< UniChar > &  dst 
)
static

◆ encode() [7/8]

static void log4cxx::helpers::Transcoder::encode ( unsigned int  ch,
std::basic_string< UniChar > &  dst 
)
static

Appends UCS-4 value to a UTF-8 string.

Parameters
chUCS-4 value.
dstdestination.

◆ encode() [8/8]

static CFStringRef log4cxx::helpers::Transcoder::encode ( const LogString src)
static

◆ encodeCharsetName()

static std::string log4cxx::helpers::Transcoder::encodeCharsetName ( const LogString charsetName)
static

Encodes a charset name in the default encoding without using a CharsetEncoder (which could trigger recursion).

◆ encodeUTF16BE()

static void log4cxx::helpers::Transcoder::encodeUTF16BE ( unsigned int  sv,
ByteBuffer dst 
)
static

Append UCS-4 code point to a byte buffer as UTF-16BE.

◆ encodeUTF16LE()

static void log4cxx::helpers::Transcoder::encodeUTF16LE ( unsigned int  sv,
ByteBuffer dst 
)
static

Append UCS-4 code point to a byte buffer as UTF-16LE.

◆ encodeUTF8() [1/3]

static void log4cxx::helpers::Transcoder::encodeUTF8 ( const LogString src,
std::string &  dst 
)
static

Converts the LogString to a UTF-8 string.

◆ encodeUTF8() [2/3]

static char* log4cxx::helpers::Transcoder::encodeUTF8 ( const LogString src,
log4cxx::helpers::Pool p 
)
static

Converts the LogString to a UTF-8 string.

◆ encodeUTF8() [3/3]

static void log4cxx::helpers::Transcoder::encodeUTF8 ( unsigned int  sv,
ByteBuffer dst 
)
static

Append UCS-4 code point to a byte buffer as UTF-8.

◆ wencode()

static wchar_t* log4cxx::helpers::Transcoder::wencode ( const LogString src,
log4cxx::helpers::Pool p 
)
static

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