]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // character_code_conversion.hpp --------------------------------------------------------------// |
2 | ||
3 | // Copyright 2016 Andrey Semashev | |
4 | ||
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // See http://www.boost.org/LICENSE_1_0.txt | |
7 | ||
8 | ||
9 | #ifndef BOOST_DETAIL_WINAPI_CHARACTER_CODE_CONVERSION_HPP | |
10 | #define BOOST_DETAIL_WINAPI_CHARACTER_CODE_CONVERSION_HPP | |
11 | ||
12 | #include <boost/detail/winapi/basic_types.hpp> | |
13 | ||
14 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
15 | #pragma once | |
16 | #endif | |
17 | ||
18 | #if !defined( BOOST_USE_WINDOWS_H ) | |
19 | extern "C" { | |
20 | ||
21 | BOOST_SYMBOL_IMPORT int WINAPI | |
22 | MultiByteToWideChar( | |
23 | boost::detail::winapi::UINT_ CodePage, | |
24 | boost::detail::winapi::DWORD_ dwFlags, | |
25 | boost::detail::winapi::LPCSTR_ lpMultiByteStr, | |
26 | int cbMultiByte, | |
27 | boost::detail::winapi::LPWSTR_ lpWideCharStr, | |
28 | int cchWideChar); | |
29 | ||
30 | BOOST_SYMBOL_IMPORT int WINAPI | |
31 | WideCharToMultiByte( | |
32 | boost::detail::winapi::UINT_ CodePage, | |
33 | boost::detail::winapi::DWORD_ dwFlags, | |
34 | boost::detail::winapi::LPCWSTR_ lpWideCharStr, | |
35 | int cchWideChar, | |
36 | boost::detail::winapi::LPSTR_ lpMultiByteStr, | |
37 | int cbMultiByte, | |
38 | boost::detail::winapi::LPCSTR_ lpDefaultChar, | |
39 | boost::detail::winapi::LPBOOL_ lpUsedDefaultChar); | |
40 | ||
41 | } // extern "C" | |
42 | #endif // #if !defined( BOOST_USE_WINDOWS_H ) | |
43 | ||
44 | namespace boost { | |
45 | namespace detail { | |
46 | namespace winapi { | |
47 | ||
48 | #if defined( BOOST_USE_WINDOWS_H ) | |
49 | ||
50 | const UINT_ CP_ACP_ = CP_ACP; | |
51 | const UINT_ CP_OEMCP_ = CP_OEMCP; | |
52 | const UINT_ CP_MACCP_ = CP_MACCP; | |
53 | const UINT_ CP_THREAD_ACP_ = CP_THREAD_ACP; | |
54 | const UINT_ CP_SYMBOL_ = CP_SYMBOL; | |
55 | const UINT_ CP_UTF7_ = CP_UTF7; | |
56 | const UINT_ CP_UTF8_ = CP_UTF8; | |
57 | ||
58 | const DWORD_ MB_PRECOMPOSED_ = MB_PRECOMPOSED; | |
59 | const DWORD_ MB_COMPOSITE_ = MB_COMPOSITE; | |
60 | const DWORD_ MB_USEGLYPHCHARS_ = MB_USEGLYPHCHARS; | |
61 | const DWORD_ MB_ERR_INVALID_CHARS_ = MB_ERR_INVALID_CHARS; | |
62 | ||
63 | const DWORD_ WC_COMPOSITECHECK_ = WC_COMPOSITECHECK; | |
64 | const DWORD_ WC_DISCARDNS_ = WC_DISCARDNS; | |
65 | const DWORD_ WC_SEPCHARS_ = WC_SEPCHARS; | |
66 | const DWORD_ WC_DEFAULTCHAR_ = WC_DEFAULTCHAR; | |
67 | #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K | |
68 | const DWORD_ WC_NO_BEST_FIT_CHARS_ = WC_NO_BEST_FIT_CHARS; | |
69 | #endif | |
70 | ||
71 | #else // defined( BOOST_USE_WINDOWS_H ) | |
72 | ||
73 | const UINT_ CP_ACP_ = 0u; | |
74 | const UINT_ CP_OEMCP_ = 1u; | |
75 | const UINT_ CP_MACCP_ = 2u; | |
76 | const UINT_ CP_THREAD_ACP_ = 3u; | |
77 | const UINT_ CP_SYMBOL_ = 42u; | |
78 | const UINT_ CP_UTF7_ = 65000u; | |
79 | const UINT_ CP_UTF8_ = 65001u; | |
80 | ||
81 | const DWORD_ MB_PRECOMPOSED_ = 0x00000001; | |
82 | const DWORD_ MB_COMPOSITE_ = 0x00000002; | |
83 | const DWORD_ MB_USEGLYPHCHARS_ = 0x00000004; | |
84 | const DWORD_ MB_ERR_INVALID_CHARS_ = 0x00000008; | |
85 | ||
86 | const DWORD_ WC_COMPOSITECHECK_ = 0x00000200; | |
87 | const DWORD_ WC_DISCARDNS_ = 0x00000010; | |
88 | const DWORD_ WC_SEPCHARS_ = 0x00000020; | |
89 | const DWORD_ WC_DEFAULTCHAR_ = 0x00000040; | |
90 | #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K | |
91 | const DWORD_ WC_NO_BEST_FIT_CHARS_ = 0x00000400; | |
92 | #endif | |
93 | ||
94 | #endif // defined( BOOST_USE_WINDOWS_H ) | |
95 | ||
96 | #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 | |
97 | // This constant is not present in MinGW | |
98 | const DWORD_ WC_ERR_INVALID_CHARS_ = 0x00000080; | |
99 | #endif | |
100 | ||
101 | using ::MultiByteToWideChar; | |
102 | using ::WideCharToMultiByte; | |
103 | ||
104 | } // namespace winapi | |
105 | } // namespace detail | |
106 | } // namespace boost | |
107 | ||
108 | #endif // BOOST_DETAIL_WINAPI_CHARACTER_CODE_CONVERSION_HPP |