1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2002-2007 Marcin Kalicinski
3 // Copyright (C) 2007 Alexey Baskakov
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see www.boost.org
10 // ----------------------------------------------------------------------------
11 #ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED
12 #define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED
15 #include <boost/property_tree/detail/ptree_utils.hpp>
17 namespace boost
{ namespace property_tree
{ namespace xml_parser
20 // Naively convert narrow string to another character type
22 std::basic_string
<Ch
> widen(const char *text
)
24 std::basic_string
<Ch
> result
;
33 //! Xml writer settings
35 class xml_writer_settings
38 xml_writer_settings(Ch indent_char
= Ch(' '),
39 typename
std::basic_string
<Ch
>::size_type indent_count
= 4,
40 const std::basic_string
<Ch
> &encoding
= widen
<Ch
>("utf-8"))
41 : indent_char(indent_char
)
42 , indent_count(indent_count
)
48 const typename
std::basic_string
<Ch
>::size_type indent_count
;
49 const std::basic_string
<Ch
> encoding
;
53 xml_writer_settings
<Ch
> xml_writer_make_settings(Ch indent_char
, typename
std::basic_string
<Ch
>::size_type indent_count
, const Ch
*encoding
)
55 return xml_writer_settings
<Ch
>(indent_char
, indent_count
, encoding
);