]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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> | |
7c673cae FG |
15 | #include <string> |
16 | #include <stdexcept> | |
b32b8144 | 17 | #include "string_view.hpp" |
7c673cae FG |
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 | |
b32b8144 FG |
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 | |
7c673cae FG |
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 | { | |
7c673cae FG |
46 | namespace detail |
47 | { | |
48 | struct conversion_error : std::runtime_error | |
49 | { | |
50 | conversion_error(char const* m) : std::runtime_error(m) {} | |
51 | }; | |
52 | ||
7c673cae | 53 | #if QUICKBOOK_WIDE_STREAMS |
b32b8144 | 54 | typedef std::wstring stream_string; |
7c673cae | 55 | #else |
b32b8144 | 56 | typedef std::string stream_string; |
7c673cae | 57 | #endif |
7c673cae | 58 | |
b32b8144 FG |
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); | |
7c673cae | 62 | #endif |
7c673cae FG |
63 | } |
64 | } | |
65 | ||
66 | #endif |