xml_parser_writer_settings.hpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2002-2007 Marcin Kalicinski
3 // Copyright (C) 2007 Alexey Baskakov
4 //
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)
8 //
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
13 
14 #include <string>
16 
17 namespace boost { namespace property_tree { namespace xml_parser
18 {
19 
20  // Naively convert narrow string to another character type
21  template<class Str>
22  Str widen(const char *text)
23  {
24  typedef typename Str::value_type Ch;
25  Str result;
26  while (*text)
27  {
28  result += Ch(*text);
29  ++text;
30  }
31  return result;
32  }
33 
35  template<class Str>
37  {
38  typedef typename Str::value_type Ch;
39  public:
40  xml_writer_settings(Ch inchar = Ch(' '),
41  typename Str::size_type incount = 0,
42  const Str &enc = widen<Str>("utf-8"))
43  : indent_char(inchar)
44  , indent_count(incount)
45  , encoding(enc)
46  {
47  }
48 
50  typename Str::size_type indent_count;
51  Str encoding;
52  };
53 
54  template <class Str>
55  xml_writer_settings<Str> xml_writer_make_settings(typename Str::value_type indent_char = (typename Str::value_type)(' '),
56  typename Str::size_type indent_count = 0,
57  const Str &encoding = widen<Str>("utf-8"))
58  {
59  return xml_writer_settings<Str>(indent_char, indent_count, encoding);
60  }
61 
62 } } }
63 
64 #endif
boost::property_tree::xml_parser::xml_writer_settings
Xml writer settings. The default settings lead to no pretty printing.
Definition: xml_parser_writer_settings.hpp:36
ptree_utils.hpp
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::property_tree::xml_parser::xml_writer_settings::Ch
Str::value_type Ch
Definition: xml_parser_writer_settings.hpp:38
boost::property_tree::xml_parser::xml_writer_make_settings
xml_writer_settings< Str > xml_writer_make_settings(typename Str::value_type indent_char=(typename Str::value_type)(' '), typename Str::size_type indent_count=0, const Str &encoding=widen< Str >("utf-8"))
Definition: xml_parser_writer_settings.hpp:55
boost::property_tree::xml_parser::xml_writer_settings::indent_count
Str::size_type indent_count
Definition: xml_parser_writer_settings.hpp:50
boost::property_tree::xml_parser::xml_writer_settings::indent_char
Ch indent_char
Definition: xml_parser_writer_settings.hpp:49
Ch
#define Ch(x, y, z)
Definition: SHA256.cpp:47
boost::property_tree::xml_parser::xml_writer_settings::encoding
Str encoding
Definition: xml_parser_writer_settings.hpp:51
boost::property_tree::xml_parser::widen
Str widen(const char *text)
Definition: xml_parser_writer_settings.hpp:22
boost::property_tree::xml_parser::xml_writer_settings::xml_writer_settings
xml_writer_settings(Ch inchar=Ch(' '), typename Str::size_type incount=0, const Str &enc=widen< Str >("utf-8"))
Definition: xml_parser_writer_settings.hpp:40


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:56:19