1 #ifndef UTF_CONVERSION_GROUP
2 #define UTF_CONVERSION_GROUP
130 #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
131 #define UNI_MAX_BMP (UTF32)0x0000FFFF
132 #define UNI_MAX_UTF16 (UTF32)0x0010FFFF
133 #define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
134 #define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
193 #error should not be in here right now --cak
199 #define to_unicode_temp(s) transcode_to_utf16(s)
203 #define from_unicode_temp(s) transcode_to_utf8(s)
208 #define to_unicode_persist(name, s) transcode_to_utf16 name(s)
211 #define from_unicode_persist(name, s) transcode_to_utf8 name(s)
214 #define to_unicode_temp(s) null_transcoder(s, false)
215 #define from_unicode_temp(s) null_transcoder(s, false)
216 #define to_unicode_persist(name, s) null_transcoder name(s, true)
217 #define from_unicode_persist(name, s) null_transcoder name(s, true)
233 class transcode_to_utf16 :
public virtual root_object
236 transcode_to_utf16(
const char *utf8_input);
241 transcode_to_utf16(
const astring &utf8_input);
244 virtual ~transcode_to_utf16();
249 operator const UTF16 * ()
const {
return _converted; }
251 operator UTF16 * () {
return _converted; }
268 class transcode_to_utf8 :
public virtual root_object
271 transcode_to_utf8(
const UTF16 *utf16_input);
276 transcode_to_utf8(
const wchar_t *utf16_input);
279 virtual ~transcode_to_utf8();
284 operator const UTF8 * ()
const {
return _converted; }
286 operator UTF8 * () {
return _converted; }
289 operator astring()
const;
303 class null_transcoder :
public virtual root_object
307 null_transcoder(
const char *utf8_input,
bool make_own_copy);
309 null_transcoder(
const astring &utf8_input,
bool make_own_copy);
311 if (_make_own_copy)
delete [] _converted;
316 operator char * () {
return (
char *)_converted; }
317 operator const char * ()
const {
return (
const char *)_converted; }
319 operator astring()
const {
return astring((
const char *)_converted); }
324 const UTF8 *_converted;
Constants and objects used throughout HOOPLE.
#define NULL_POINTER
The value representing a pointer to nothing.
The guards collection helps in testing preconditions and reporting errors.
ConversionResult ConvertUTF8toUTF16(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)
ConversionResult ConvertUTF32toUTF16(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)
ConversionResult ConvertUTF32toUTF8(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)
ConversionResult ConvertUTF8toUTF32(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
Booleano isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd)
ConversionResult ConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)
ConversionResult ConvertUTF16toUTF32(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)