1 /*=============================================================================
2 Copyright (c) 2009 Daniel James
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 =============================================================================*/
9 // For handling native strings and streams.
11 #if !defined(BOOST_QUICKBOOK_DETAIL_NATIVE_TEXT_HPP)
12 #define BOOST_QUICKBOOK_DETAIL_NATIVE_TEXT_HPP
14 #include <boost/config.hpp>
17 #include "string_view.hpp"
20 #if defined(__cygwin__) || defined(__CYGWIN__)
21 # define QUICKBOOK_CYGWIN_PATHS 1
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
32 #if !defined(QUICKBOOK_WIDE_PATHS)
33 #define QUICKBOOK_WIDE_PATHS 0
36 #if !defined(QUICKBOOK_WIDE_STREAMS)
37 #define QUICKBOOK_WIDE_STREAMS 0
40 #if !defined(QUICKBOOK_CYGWIN_PATHS)
41 #define QUICKBOOK_CYGWIN_PATHS 0
48 struct conversion_error : std::runtime_error
50 conversion_error(char const* m) : std::runtime_error(m) {}
53 #if QUICKBOOK_WIDE_STREAMS
54 typedef std::wstring stream_string;
56 typedef std::string stream_string;
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);