1 #include "ace/Encoding_Converter_Factory.h"
3 #if defined (ACE_USES_WCHAR)
4 #include "ace/UTF32_Encoding_Converter.h"
5 #include "ace/UTF16_Encoding_Converter.h"
6 #include "ace/UTF8_Encoding_Converter.h"
7 #include "ace/OS_Memory.h"
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 ACE_Encoding_Converter
*
12 ACE_Encoding_Converter_Factory::create (
13 const ACE_Byte
* source
,
15 ACE_Encoding_Converter_Factory::Encoding_Hint hint
)
17 #if defined (ACE_BIG_ENDIAN)
18 bool const convert_for_bigendian
= true;
20 bool const convert_for_bigendian
= false;
21 #endif /* ACE_BIG_ENDIAN */
22 ACE_Encoding_Converter
* converter
= 0;
27 ACE_NEW_RETURN (converter
,
28 ACE_UTF32_Encoding_Converter (!convert_for_bigendian
),
32 ACE_NEW_RETURN (converter
,
33 ACE_UTF32_Encoding_Converter (convert_for_bigendian
),
37 ACE_NEW_RETURN (converter
,
38 ACE_UTF16_Encoding_Converter (!convert_for_bigendian
),
42 ACE_NEW_RETURN (converter
,
43 ACE_UTF16_Encoding_Converter (convert_for_bigendian
),
47 ACE_NEW_RETURN (converter
,
48 ACE_UTF8_Encoding_Converter
,
52 // First check for ASCII since much of ASCII text will appear to
53 // convert from UTF-16 to UTF-8.
54 converter
= ACE_UTF8_Encoding_Converter::encoded (source
, source_size
);
59 converter
= ACE_UTF32_Encoding_Converter::encoded (source
, source_size
);
64 converter
= ACE_UTF16_Encoding_Converter::encoded (source
, source_size
);
72 ACE_END_VERSIONED_NAMESPACE_DECL
73 #endif /* ACE_USES_WCHAR */