Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / tao / Codeset / UTF16_BOM_Translator.h
blob19c3b8eb1595b5ddf1929c925949f733277ec55e
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"
26 // ****************************************************************
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
30 /**
31 * @class TAO_UTF16_BOM_Translator
33 * @brief Codeset translation specialization - Manages Byte Order Marker
35 * This class performs the codeset translation:
36 * - Native: UTF16 (i.e. Unicode)
37 * - Stream: UTF16 with Byte Order Marker
39 class TAO_Codeset_Export TAO_UTF16_BOM_Translator
40 : public ACE_WChar_Codeset_Translator
42 public:
43 /// Constructor
44 /// @param forceBE: true forces all wchar, warray, and wstrings to big-endian byte order
45 TAO_UTF16_BOM_Translator (bool forceBE);
47 /// Virtual destruction
48 virtual ~TAO_UTF16_BOM_Translator (void);
50 // = Documented in $ACE_ROOT/ace/CDR_Stream.h
51 virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR &,
52 ACE_CDR::WChar &);
53 virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR &,
54 ACE_CDR::WChar *&);
55 #if !defined(ACE_LACKS_STD_WSTRING)
56 virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&,
57 std::wstring &);
58 #endif
59 virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR &,
60 ACE_CDR::WChar *,
61 ACE_CDR::ULong);
62 virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR &,
63 ACE_CDR::WChar);
64 virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR &,
65 ACE_CDR::ULong,
66 const ACE_CDR::WChar *);
67 virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR &,
68 const ACE_CDR::WChar *,
69 ACE_CDR::ULong);
70 virtual ACE_CDR::ULong ncs () {return 0x00010109;}
71 virtual ACE_CDR::ULong tcs () {return 0x00010109;}
73 private:
74 ACE_CDR::Boolean read_wchar_array_i (ACE_InputCDR &,
75 ACE_CDR::WChar *,
76 ACE_CDR::ULong&,
77 int adjust_len = 0);
79 ACE_CDR::Boolean write_wchar_array_i (ACE_OutputCDR &,
80 const ACE_CDR::WChar *,
81 ACE_CDR::ULong);
83 ACE_CDR::Boolean write_swapped_wchar_array_i (ACE_OutputCDR & cdr,
84 const ACE_CDR::WChar *x,
85 ACE_CDR::ULong length);
88 ACE_CDR::Boolean write_wchar_i (ACE_OutputCDR &,
89 ACE_CDR::WChar ,
90 bool allow_BOM);
92 private:
93 /// if this flag is true, force wchar's to big endian order
94 bool forceBE_;
98 TAO_END_VERSIONED_NAMESPACE_DECL
100 #include /**/ "ace/post.h"
101 #endif /* UTF16_BOM_TRANSLATOR_H */