OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UTF8Handler.hpp
Go to the documentation of this file.
1 #ifndef __OPENTREP_BAS_UTF8HANDLER_HPP
2 #define __OPENTREP_BAS_UTF8HANDLER_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <string>
9 
10 namespace OPENTREP {
11 
19  class UTF8Handler {
20  public:
21  /*
22  * Conversion from a UTF-8-encoded "simple character" (though
23  * potentially multi-byte) STL string into a wide character STL
24  * string.
25  *
26  * Note that as there is no checks of appropriate encoding, it
27  * only works for valid UTF-8, i.e. no 5- or 6-byte sequences.
28  *
29  * Note that the "simple characters", within a STL string, may be
30  * multi-byte (e.g., if they are UTF-8-encoded).
31  *
32  * @param std::string The "simple character" (though potentially
33  * multi-byte) STL string.
34  * @return std::wstring The wide character STL string.
35  */
36  static std::wstring toWideString (const std::string& iSrc);
37 
38  /*
39  * Conversion from a wide character STL string into a UTF-8-encoded
40  * "simple character" (though potentially multi-byte) STL string.
41  *
42  * Note that as there is no checks of appropriate encoding, it
43  * only works for valid UTF-8, i.e. no 5- or 6-byte sequences.
44  *
45  * Note that the "simple characters", within a STL string, may be
46  * multi-byte (e.g., if they are UTF-8-encoded).
47  *
48  * @param std::wstring The wide character STL string.
49  * @return std::string The "simple character" (though potentially
50  * multi-byte) STL string.
51  */
52  static std::string toSimpleString (const std::wstring& iStr);
53 
57  static std::string displayCharString (const char* iString);
58 
63  static std::string displaySTLWString (const std::wstring& iString);
64  };
65 
66 }
67 #endif // __OPENTREP_BAS_UTF8HANDLER_HPP
static std::wstring toWideString(const std::string &iSrc)
Definition: UTF8Handler.cpp:37
Utility class for basic handling of UTF-8 encoded strings.
Definition: UTF8Handler.hpp:19
static std::string displayCharString(const char *iString)
static std::string toSimpleString(const std::wstring &iStr)
Definition: UTF8Handler.cpp:98
static std::string displaySTLWString(const std::wstring &iString)