]>
Commit | Line | Data |
---|---|---|
1 | /*============================================================================= | |
2 | Copyright (c) 2009 Daniel James | |
3 | ||
4 | Use, modification and distribution is subject to the Boost Software | |
5 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
6 | http://www.boost.org/LICENSE_1_0.txt) | |
7 | =============================================================================*/ | |
8 | ||
9 | // For handling native strings and streams. | |
10 | ||
11 | #if !defined(BOOST_QUICKBOOK_DETAIL_NATIVE_TEXT_HPP) | |
12 | #define BOOST_QUICKBOOK_DETAIL_NATIVE_TEXT_HPP | |
13 | ||
14 | #include <boost/config.hpp> | |
15 | #include <string> | |
16 | #include <stdexcept> | |
17 | #include "string_view.hpp" | |
18 | #include "fwd.hpp" | |
19 | ||
20 | #if defined(__cygwin__) || defined(__CYGWIN__) | |
21 | # define QUICKBOOK_CYGWIN_PATHS 1 | |
22 | #elif defined(_WIN32) | |
23 | # define QUICKBOOK_WIDE_PATHS 1 | |
24 | // Wide streams work okay for me with older versions of Visual C++, | |
25 | // but I've had reports of problems. My guess is that it's an | |
26 | // incompatibility with later versions of windows. | |
27 | # if defined(BOOST_MSVC) && BOOST_MSVC >= 1700 | |
28 | # define QUICKBOOK_WIDE_STREAMS 1 | |
29 | # endif | |
30 | #endif | |
31 | ||
32 | #if !defined(QUICKBOOK_WIDE_PATHS) | |
33 | #define QUICKBOOK_WIDE_PATHS 0 | |
34 | #endif | |
35 | ||
36 | #if !defined(QUICKBOOK_WIDE_STREAMS) | |
37 | #define QUICKBOOK_WIDE_STREAMS 0 | |
38 | #endif | |
39 | ||
40 | #if !defined(QUICKBOOK_CYGWIN_PATHS) | |
41 | #define QUICKBOOK_CYGWIN_PATHS 0 | |
42 | #endif | |
43 | ||
44 | namespace quickbook | |
45 | { | |
46 | namespace detail | |
47 | { | |
48 | struct conversion_error : std::runtime_error | |
49 | { | |
50 | conversion_error(char const* m) : std::runtime_error(m) {} | |
51 | }; | |
52 | ||
53 | #if QUICKBOOK_WIDE_STREAMS | |
54 | typedef std::wstring stream_string; | |
55 | #else | |
56 | typedef std::string stream_string; | |
57 | #endif | |
58 | ||
59 | #if QUICKBOOK_WIDE_PATHS || QUICKBOOK_WIDE_STREAMS | |
60 | std::string to_utf8(std::wstring const& x); | |
61 | std::wstring from_utf8(string_view x); | |
62 | #endif | |
63 | } | |
64 | } | |
65 | ||
66 | #endif |