3 //=========================================================================
5 * @file UTF8_Encoding_Converter.h
7 * This class contains declarations for methods that convert between
8 * UTF-8 and the native ACE_TCHAR representation.
10 * @author Chad Elliott <elliott_c@ociweb.com>
12 //=========================================================================
14 #ifndef ACE_UTF8_ENCODING_CONVERTER_H
15 #define ACE_UTF8_ENCODING_CONVERTER_H
17 #include /**/ "ace/pre.h"
19 #include "ace/Encoding_Converter.h"
21 #if defined (ACE_USES_WCHAR)
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
24 /** Convert from UTF-16 or UTF-32 to UTF-8.
25 * This class implements the ACE_Encoding_Converter interface.
27 class ACE_UTF8_Encoding_Converter
: public ACE_Encoding_Converter
30 /// Allocate the converter to be used by the from_utf8() method based
31 /// on the size of the native wide character.
32 ACE_UTF8_Encoding_Converter (void);
34 /// De-allocate the native converter.
35 virtual ~ACE_UTF8_Encoding_Converter (void);
37 /// Since the source *must be* UTF-8, there is no conversion required.
38 /// This method just copies the source to the target given that there
40 virtual Result
to_utf8 (const void* source
,
46 /// Utilize the native converter to convert the UTF-8 source into an
47 /// alternate encoding and store it in the provided target buffer.
48 virtual Result
from_utf8 (const ACE_Byte
* source
,
55 /// This factory helper method determines if the source stream is UTF-8
56 /// encoded. If it is, allocate an ACE_UTF8_Encoding_Converter and
57 /// return it. The caller then owns the allocated object.
58 static ACE_UTF8_Encoding_Converter
* encoded (const ACE_Byte
* source
,
62 ACE_Encoding_Converter
* native_
;
65 ACE_END_VERSIONED_NAMESPACE_DECL
66 #endif /* ACE_USES_WCHAR */
68 #include /**/ "ace/post.h"
70 #endif /* ACE_UTF8_ENCODING_CONVERTER_H */