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