1 // character_code_conversion.hpp --------------------------------------------------------------//
3 // Copyright 2016 Andrey Semashev
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
9 #ifndef BOOST_DETAIL_WINAPI_CHARACTER_CODE_CONVERSION_HPP
10 #define BOOST_DETAIL_WINAPI_CHARACTER_CODE_CONVERSION_HPP
12 #include <boost/detail/winapi/basic_types.hpp>
14 #ifdef BOOST_HAS_PRAGMA_ONCE
18 #if !defined( BOOST_USE_WINDOWS_H )
21 BOOST_SYMBOL_IMPORT int WINAPI
23 boost::detail::winapi::UINT_ CodePage,
24 boost::detail::winapi::DWORD_ dwFlags,
25 boost::detail::winapi::LPCSTR_ lpMultiByteStr,
27 boost::detail::winapi::LPWSTR_ lpWideCharStr,
30 BOOST_SYMBOL_IMPORT int WINAPI
32 boost::detail::winapi::UINT_ CodePage,
33 boost::detail::winapi::DWORD_ dwFlags,
34 boost::detail::winapi::LPCWSTR_ lpWideCharStr,
36 boost::detail::winapi::LPSTR_ lpMultiByteStr,
38 boost::detail::winapi::LPCSTR_ lpDefaultChar,
39 boost::detail::winapi::LPBOOL_ lpUsedDefaultChar);
42 #endif // #if !defined( BOOST_USE_WINDOWS_H )
48 #if defined( BOOST_USE_WINDOWS_H )
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;
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;
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;
71 #else // defined( BOOST_USE_WINDOWS_H )
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;
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;
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;
94 #endif // defined( BOOST_USE_WINDOWS_H )
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;
101 using ::MultiByteToWideChar;
102 using ::WideCharToMultiByte;
104 } // namespace winapi
105 } // namespace detail
108 #endif // BOOST_DETAIL_WINAPI_CHARACTER_CODE_CONVERSION_HPP