1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICE_STRING_CONVERTER_H
6 #define ICE_STRING_CONVERTER_H
7 
8 #include <Ice/Config.h>
9 #include <IceUtil/StringConverter.h>
10 #include <IceUtil/ConsoleUtil.h>
11 
12 namespace Ice
13 {
14 
15 /** Encapsulates bytes in the UTF-8 encoding. */
16 typedef IceUtil::UTF8Buffer UTF8Buffer;
17 
18 /** Narrow string converter. */
19 typedef IceUtil::StringConverter StringConverter;
20 typedef IceUtil::StringConverterPtr StringConverterPtr;
21 
22 /** Wide string converter. */
23 typedef IceUtil::WstringConverter WstringConverter;
24 typedef IceUtil::WstringConverterPtr WstringConverterPtr;
25 
26 /** Indicates an error occurred during string conversion. */
27 typedef IceUtil::IllegalConversionException IllegalConversionException;
28 
29 #ifdef ICE_CPP11_MAPPING
30 /** Base class for a string converter. */
31 template<typename charT>
32 using BasicStringConverter = IceUtil::BasicStringConverter<charT>;
33 #endif
34 
35 #ifdef _WIN32
36 /**
37  * Creates a string converter that converts between multi-byte and UTF-8 strings and uses MultiByteToWideChar
38  * and WideCharToMultiByte for its implementation.
39  */
40 using IceUtil::createWindowsStringConverter;
41 #endif
42 
43 /** Creates a string converter that converts between Unicode wide strings and UTF-8 strings. */
44 using IceUtil::createUnicodeWstringConverter;
45 
46 /** Installs a default narrow string converter for the process. */
47 using IceUtil::setProcessStringConverter;
48 
49 /** Obtains the default narrow string converter for the process. */
50 using IceUtil::getProcessStringConverter;
51 
52 /** Installs a default wide string converter for the process. */
53 using IceUtil::setProcessWstringConverter;
54 
55 /** Obtains the default wide string converter for the process. */
56 using IceUtil::getProcessWstringConverter;
57 
58 /** Converts a wide string to a narrow string. */
59 using IceUtil::wstringToString;
60 
61 /** Converts a narrow string to a wide string. */
62 using IceUtil::stringToWstring;
63 
64 /**
65  * Converts a narrow string to a UTF-8 encoded string using a string converter.
66  * No conversion is performed if the string converter is nil.
67  */
68 using IceUtil::nativeToUTF8;
69 
70 /**
71  * Converts a UTF-8 encoded string to a narrow string using a string converter.
72  * No conversion is performed if the string converter is nil.
73  */
74 using IceUtil::UTF8ToNative;
75 
76 }
77 
78 #endif
79