File indexing completed on 2025-01-18 09:50:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED
0012 #define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED
0013
0014 #include <string>
0015 #include <boost/property_tree/detail/ptree_utils.hpp>
0016
0017 namespace boost { namespace property_tree { namespace xml_parser
0018 {
0019
0020
0021 template<class Str>
0022 Str widen(const char *text)
0023 {
0024 typedef typename Str::value_type Ch;
0025 Str result;
0026 while (*text)
0027 {
0028 result += Ch(*text);
0029 ++text;
0030 }
0031 return result;
0032 }
0033
0034
0035 template<class Str>
0036 class xml_writer_settings
0037 {
0038 typedef typename Str::value_type Ch;
0039 public:
0040 xml_writer_settings(Ch inchar = Ch(' '),
0041 typename Str::size_type incount = 0,
0042 const Str &enc = widen<Str>("utf-8"))
0043 : indent_char(inchar)
0044 , indent_count(incount)
0045 , encoding(enc)
0046 {
0047 }
0048
0049 Ch indent_char;
0050 typename Str::size_type indent_count;
0051 Str encoding;
0052 };
0053
0054 template <class Str>
0055 xml_writer_settings<Str> xml_writer_make_settings(typename Str::value_type indent_char = (typename Str::value_type)(' '),
0056 typename Str::size_type indent_count = 0,
0057 const Str &encoding = widen<Str>("utf-8"))
0058 {
0059 return xml_writer_settings<Str>(indent_char, indent_count, encoding);
0060 }
0061
0062 } } }
0063
0064 #endif