18 #ifndef _LOG4CXX_HELPERS_TRANSCODER_H 19 #define _LOG4CXX_HELPERS_TRANSCODER_H 22 #pragma warning ( push ) 23 #pragma warning ( disable: 4231 4251 4275 4786 ) 49 static void decodeUTF8(
const std::string& src,
LogString& dst);
53 static void encodeUTF8(
const LogString& src, std::string& dst);
61 static void encodeUTF8(
unsigned int sv,
ByteBuffer& dst);
65 static void encodeUTF16LE(
unsigned int sv,
ByteBuffer& dst);
69 static void encodeUTF16BE(
unsigned int sv,
ByteBuffer& dst);
79 static unsigned int decode(
const std::string& in,
80 std::string::const_iterator& iter);
87 static void encode(
unsigned int ch, std::string& dst);
93 static void decode(
const std::string& src,
LogString& dst);
99 static void encode(
const LogString& src, std::string& dst);
112 #if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR_T || defined(WIN32) || defined(_WIN32) 113 static void decode(
const std::wstring& src,
LogString& dst);
114 static void encode(
const LogString& src, std::wstring& dst);
124 static unsigned int decode(
const std::wstring& in,
125 std::wstring::const_iterator& iter);
132 static void encode(
unsigned int ch, std::wstring& dst);
137 #if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API || LOG4CXX_LOGCHAR_IS_UNICHAR 138 static void decode(
const std::basic_string<UniChar>& src,
LogString& dst);
139 static void encode(
const LogString& src, std::basic_string<UniChar>& dst);
148 static unsigned int decode(
const std::basic_string<UniChar>& in,
149 std::basic_string<UniChar>::const_iterator& iter);
156 static void encode(
unsigned int ch, std::basic_string<UniChar>& dst);
160 #if LOG4CXX_CFSTRING_API 165 enum { LOSSCHAR = 0x3F };
171 static logchar decode(
char v);
182 static std::string encodeCharsetName(
const LogString& charsetName);
190 enum { BUFSIZE = 256 };
191 static size_t encodeUTF8(
unsigned int ch,
char* dst);
192 static size_t encodeUTF16BE(
unsigned int ch,
char* dst);
193 static size_t encodeUTF16LE(
unsigned int ch,
char* dst);
199 #define LOG4CXX_ENCODE_CHAR(var, src) \ 201 log4cxx::helpers::Transcoder::encode(src, var) 203 #define LOG4CXX_DECODE_CHAR(var, src) \ 204 log4cxx::LogString var; \ 205 log4cxx::helpers::Transcoder::decode(src, var) 207 #define LOG4CXX_DECODE_CFSTRING(var, src) \ 208 log4cxx::LogString var; \ 209 log4cxx::helpers::Transcoder::decode(src, var) 211 #define LOG4CXX_ENCODE_CFSTRING(var, src) \ 212 CFStringRef var = log4cxx::helpers::Transcoder::encode(src) 215 #if LOG4CXX_LOGCHAR_IS_WCHAR 217 #define LOG4CXX_ENCODE_WCHAR(var, src) \ 218 const std::wstring& var = src 220 #define LOG4CXX_DECODE_WCHAR(var, src) \ 221 const log4cxx::LogString& var = src 225 #define LOG4CXX_ENCODE_WCHAR(var, src) \ 227 log4cxx::helpers::Transcoder::encode(src, var) 229 #define LOG4CXX_DECODE_WCHAR(var, src) \ 230 log4cxx::LogString var; \ 231 log4cxx::helpers::Transcoder::decode(src, var) 235 #if LOG4CXX_LOGCHAR_IS_UNICHAR 237 #define LOG4CXX_ENCODE_UNICHAR(var, src) \ 238 const std::basic_string<UniChar>& var = src 240 #define LOG4CXX_DECODE_UNICHAR(var, src) \ 241 const log4cxx::LogString& var = src 245 #define LOG4CXX_ENCODE_UNICHAR(var, src) \ 246 std::basic_string<UniChar> var; \ 247 log4cxx::helpers::Transcoder::encode(src, var) 249 #define LOG4CXX_DECODE_UNICHAR(var, src) \ 250 log4cxx::LogString var; \ 251 log4cxx::helpers::Transcoder::decode(src, var) 255 #if defined(_MSC_VER) 256 #pragma warning (pop) 259 #endif //_LOG4CXX_HELPERS_TRANSCODER_H Simple transcoder for converting between external char and wchar_t strings and internal strings...
Definition: transcoder.h:41
const struct __CFString * CFStringRef
Definition: logstring.h:36
A byte buffer.
Definition: bytebuffer.h:33
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66