Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / Codeset / UTF16_BOM_Translator.h
blob9bb002920322452a0f05beb06dd55f76065bea55
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file UTF16_BOM_Translator.h
7 * @author Phil Mesnier <mesnier_p@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef UTF16_BOM_TRANSLATOR_H
12 #define UTF16_BOM_TRANSLATOR_H
13 #include /**/ "ace/pre.h"
15 #include "ace/config-all.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/Codeset/codeset_export.h"
22 #include "tao/Versioned_Namespace.h"
23 #include "ace/CDR_Stream.h"
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 /**
27 * @class TAO_UTF16_BOM_Translator
29 * @brief Codeset translation specialization - Manages Byte Order Marker
31 * This class performs the codeset translation:
32 * - Native: UTF16 (i.e. Unicode)
33 * - Stream: UTF16 with Byte Order Marker
35 class TAO_Codeset_Export TAO_UTF16_BOM_Translator
36 : public ACE_WChar_Codeset_Translator
38 public:
39 /// Constructor
40 /// @param forceBE: true forces all wchar, warray, and wstrings to big-endian byte order
41 TAO_UTF16_BOM_Translator (bool forceBE);
43 /// Virtual destruction
44 virtual ~TAO_UTF16_BOM_Translator () = default;
46 // = Documented in $ACE_ROOT/ace/CDR_Stream.h
47 virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR &,
48 ACE_CDR::WChar &);
49 virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR &,
50 ACE_CDR::WChar *&);
51 #if !defined(ACE_LACKS_STD_WSTRING)
52 virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&,
53 std::wstring &);
54 #endif
55 virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR &,
56 ACE_CDR::WChar *,
57 ACE_CDR::ULong);
58 virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR &,
59 ACE_CDR::WChar);
60 virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR &,
61 ACE_CDR::ULong,
62 const ACE_CDR::WChar *);
63 virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR &,
64 const ACE_CDR::WChar *,
65 ACE_CDR::ULong);
66 virtual ACE_CDR::ULong ncs () {return 0x00010109;}
67 virtual ACE_CDR::ULong tcs () {return 0x00010109;}
69 private:
70 ACE_CDR::Boolean read_wchar_array_i (ACE_InputCDR &,
71 ACE_CDR::WChar *,
72 ACE_CDR::ULong&,
73 int adjust_len = 0);
75 ACE_CDR::Boolean write_wchar_array_i (ACE_OutputCDR &,
76 const ACE_CDR::WChar *,
77 ACE_CDR::ULong);
79 ACE_CDR::Boolean write_swapped_wchar_array_i (ACE_OutputCDR & cdr,
80 const ACE_CDR::WChar *x,
81 ACE_CDR::ULong length);
84 ACE_CDR::Boolean write_wchar_i (ACE_OutputCDR &,
85 ACE_CDR::WChar ,
86 bool allow_BOM);
88 private:
89 /// if this flag is true, force wchar's to big endian order
90 bool forceBE_;
93 TAO_END_VERSIONED_NAMESPACE_DECL
95 #include /**/ "ace/post.h"
96 #endif /* UTF16_BOM_TRANSLATOR_H */