Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / Encoding_Converter.h
blob9b08f6c7d73062340315b3710ced80fd80dffd95
1 // -*- C++ -*-
3 //=========================================================================
4 /**
5 * @file Encoding_Converter.h
7 * This class is the base class for all encoding converters that convert
8 * to and from UTF-8.
10 * @author Chad Elliott <elliott_c@ociweb.com>
12 //=========================================================================
14 #ifndef ACE_ENCODING_CONVERTER_H
15 #define ACE_ENCODING_CONVERTER_H
17 #include /**/ "ace/pre.h"
19 #include "ace/Basic_Types.h"
21 #if defined (ACE_USES_WCHAR)
22 #include /**/ "ace/ACE_export.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 /** The base class for all ACE UTF Encoding Converters.
27 * This class provides a generic interface that is used to implement
28 * various UTF encoding conversion classes.
30 class ACE_Export ACE_Encoding_Converter
32 public:
33 /// This enum describes the various states that can be returned
34 /// from the to_utf8() and from_utf8() methods which depends on
35 /// both the source buffer and the size of the target buffer.
36 enum Result {CONVERSION_OK,
37 SOURCE_EXHAUSTED,
38 TARGET_EXHAUSTED,
39 SOURCE_ILLEGAL
42 /// This destructor is here (and virtual) because we have virtual
43 /// functions.
44 virtual ~ACE_Encoding_Converter ();
46 /// Convert the source (which can be in any encoding) to UTF-8 and
47 /// store it in the provided target buffer.
48 virtual Result to_utf8 (const void* source,
49 size_t source_size,
50 ACE_Byte* target,
51 size_t target_size,
52 bool strict = true) = 0;
54 /// Convert the UTF-8 source into an alternate encoding and store it
55 /// in the provided target buffer.
56 virtual Result from_utf8 (const ACE_Byte* source,
57 size_t source_size,
58 void* target,
59 size_t target_size,
60 bool strict = true) = 0;
63 ACE_END_VERSIONED_NAMESPACE_DECL
64 #endif /* ACE_USES_WCHAR */
66 #include /**/ "ace/post.h"
68 #endif /* ACE_ENCODING_CONVERTER_H */