Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / Codeset / UTF8_Latin1_Translator.h
blob8198f6f8145bbbebf2f05dfd2ae4b9dcabb30b14
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file UTF8_Latin1_Translator.h
7 * @author Phil Mesnier <mesnier_p@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef UTF8_LATIN1_TRANSLATOR_H
12 #define UTF8_LATIN1_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"
25 // ****************************************************************
27 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class UTF8_Latin1_Translator
32 * @brief Codeset translation specialization - Manages Byte Order Marker
34 * This class performs the codeset translation:
35 * - Native: ISO-8859-1 (i.e. Latin 1)
36 * - Stream: UTF-8 (8 bit unicode mapping)
38 * When writing chars, it is possible to raise a DATA_CONVERSION exception
39 * because some valid Latin codepoints map to 2-byte utf-8 codepoints.
41 * When reading strings, it is possible to raise a DATA_CONVERSION exception
42 * because the string may include utf-8 unicode codepoints > 0x00FF.
44 class TAO_Codeset_Export TAO_UTF8_Latin1_Translator
45 : public ACE_Char_Codeset_Translator
47 public:
48 /// constructor
49 TAO_UTF8_Latin1_Translator () = default;
51 /// Virtual destruction
52 virtual ~TAO_UTF8_Latin1_Translator () = default;
54 // = Documented in $ACE_ROOT/ace/CDR_Stream.h
55 virtual ACE_CDR::Boolean read_char (ACE_InputCDR &,
56 ACE_CDR::Char &);
57 virtual ACE_CDR::Boolean read_string (ACE_InputCDR &,
58 ACE_CDR::Char *&);
59 virtual ACE_CDR::Boolean read_string (ACE_InputCDR &,
60 std::string &);
61 virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &,
62 ACE_CDR::Char *,
63 ACE_CDR::ULong);
64 virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &,
65 ACE_CDR::Char);
66 virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &,
67 ACE_CDR::ULong,
68 const ACE_CDR::Char *);
69 virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &,
70 const ACE_CDR::Char *,
71 ACE_CDR::ULong);
72 virtual ACE_CDR::ULong ncs () {return 0x00010001U;}
73 virtual ACE_CDR::ULong tcs () {return 0x05010001U;}
75 private:
76 ACE_CDR::ULong read_char_i (ACE_InputCDR &, ACE_CDR::Char &);
78 ACE_CDR::Boolean write_char_i (ACE_OutputCDR &, ACE_CDR::Char);
81 TAO_END_VERSIONED_NAMESPACE_DECL
83 #include /**/ "ace/post.h"
84 #endif /* UTF8_LATIN1_TRANSLATOR_H */