HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_CharSetUtils.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_CharSetUtils.h (UT Library, C++)
7  *
8  * COMMENTS:
9  * Utilities for encoding, decoding, and converting text
10  * from, to, and between character sets and other encodings.
11  */
12 
13 #ifndef __UT_CharSetUtils__
14 #define __UT_CharSetUtils__
15 
16 #include "UT_API.h"
17 
18 class UT_String;
19 class UT_StringHolder;
20 class UT_WorkBuffer;
21 
22 
24 {
25 public:
26  // The encoding of the source code strings (ie, the char* stuff)
27  // Currently it specifies ISO-9959-1 (Latin 1) char set.
28  static const char * const SRC_CODE_ENCODING;
29 
30  // The encoding used in the XML file. Currently it specifies UTF-8.
31  static const char * const XML_ENCODING;
32 
33  /// Conversion method from the source encoding to UTF-8 Unicode encoding.
34  /// src_str - the input string bytestream in the src_encoding
35  /// out_str - the output string bytesream in the UTF-8 encoding.
36  /// src_encoding - always Latin 1
37  //
38  /// Returns true if ok, false otherwise.
39  static bool encodeUTF8( const char * src_str,
40  UT_WorkBuffer & out_str );
41 
42  /// Conversion method from the source encoding of UTF-8 to the encoding
43  /// specified by the out_encoding.
44  /// src_str - the input string bytestream in the UTF-8 encoding.
45  /// out_str - the output string bytesream in the out_encoding.
46  /// out_encoding - always Latin 1
47  //
48  /// Returns true if ok, false otherwise.
49  /// @{
50  static bool decodeUTF8( const char * src_str,
51  UT_WorkBuffer & out_str );
52  static bool decodeUTF8( const char * src_str,
53  UT_String & out_str );
54  static bool decodeUTF8( const char * src_str,
55  UT_StringHolder & out_str );
56  /// @}
57 };
58 
59 #endif
60 
static const char *const SRC_CODE_ENCODING
#define UT_API
Definition: UT_API.h:14
static const char *const XML_ENCODING