From 72e4480d96fe8b74ff484e3c1debca310e4090a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= Date: Mon, 14 Apr 2014 12:13:58 +0200 Subject: [PATCH 1/2] property_tree: fix GCC -Wshadow warnings Signed-off-by: Michael Stahl --- .../property_tree/detail/json_parser_error.hpp | 8 +-- .../property_tree/detail/json_parser_read.hpp | 16 ++--- .../property_tree/detail/ptree_implementation.hpp | 84 +++++++++++----------- include/boost/property_tree/string_path.hpp | 18 ++--- 4 files changed, 63 insertions(+), 63 deletions(-) diff --git a/include/boost/property_tree/detail/json_parser_error.hpp b/include/boost/property_tree/detail/json_parser_error.hpp index d48c72f..c9dc3ff 100644 --- a/include/boost/property_tree/detail/json_parser_error.hpp +++ b/include/boost/property_tree/detail/json_parser_error.hpp @@ -20,10 +20,10 @@ namespace boost { namespace property_tree { namespace json_parser class json_parser_error: public file_parser_error { public: - json_parser_error(const std::string &message, - const std::string &filename, - unsigned long line): - file_parser_error(message, filename, line) + json_parser_error(const std::string &message_, + const std::string &filename_, + unsigned long line_): + file_parser_error(message_, filename_, line_) { } }; diff --git a/include/boost/property_tree/detail/json_parser_read.hpp b/include/boost/property_tree/detail/json_parser_read.hpp index f8a374c..b4a8018 100644 --- a/include/boost/property_tree/detail/json_parser_read.hpp +++ b/include/boost/property_tree/detail/json_parser_read.hpp @@ -45,7 +45,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_object_s { context &c; - a_object_s(context &c): c(c) { } + a_object_s(context &c_): c(c_) { } void operator()(Ch) const { if (c.stack.empty()) @@ -63,7 +63,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_object_e { context &c; - a_object_e(context &c): c(c) { } + a_object_e(context &c_): c(c_) { } void operator()(Ch) const { BOOST_ASSERT(c.stack.size() >= 1); @@ -74,7 +74,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_name { context &c; - a_name(context &c): c(c) { } + a_name(context &c_): c(c_) { } void operator()(It, It) const { c.name.swap(c.string); @@ -85,7 +85,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_string_val { context &c; - a_string_val(context &c): c(c) { } + a_string_val(context &c_): c(c_) { } void operator()(It, It) const { BOOST_ASSERT(c.stack.size() >= 1); @@ -98,7 +98,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_literal_val { context &c; - a_literal_val(context &c): c(c) { } + a_literal_val(context &c_): c(c_) { } void operator()(It b, It e) const { BOOST_ASSERT(c.stack.size() >= 1); @@ -112,7 +112,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_char { context &c; - a_char(context &c): c(c) { } + a_char(context &c_): c(c_) { } void operator()(It b, It) const { c.string += *b; @@ -122,7 +122,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_escape { context &c; - a_escape(context &c): c(c) { } + a_escape(context &c_): c(c_) { } void operator()(Ch ch) const { switch (ch) @@ -143,7 +143,7 @@ namespace boost { namespace property_tree { namespace json_parser struct a_unicode { context &c; - a_unicode(context &c): c(c) { } + a_unicode(context &c_): c(c_) { } void operator()(unsigned long u) const { u = (std::min)(u, static_cast((std::numeric_limits::max)())); diff --git a/include/boost/property_tree/detail/ptree_implementation.hpp b/include/boost/property_tree/detail/ptree_implementation.hpp index 31d60e3..0c85a28 100644 --- a/include/boost/property_tree/detail/ptree_implementation.hpp +++ b/include/boost/property_tree/detail/ptree_implementation.hpp @@ -549,48 +549,48 @@ namespace boost { namespace property_tree template basic_ptree & - basic_ptree::get_child(const path_type &path) + basic_ptree::get_child(const path_type &path_) { - path_type p(path); + path_type p(path_); self_type *n = walk_path(p); if (!n) { - BOOST_PROPERTY_TREE_THROW(ptree_bad_path("No such node", path)); + BOOST_PROPERTY_TREE_THROW(ptree_bad_path("No such node", path_)); } return *n; } template inline const basic_ptree & - basic_ptree::get_child(const path_type &path) const + basic_ptree::get_child(const path_type &path_) const { - return const_cast(this)->get_child(path); + return const_cast(this)->get_child(path_); } template inline basic_ptree & - basic_ptree::get_child(const path_type &path, + basic_ptree::get_child(const path_type &path_, self_type &default_value) { - path_type p(path); + path_type p(path_); self_type *n = walk_path(p); return n ? *n : default_value; } template inline const basic_ptree & - basic_ptree::get_child(const path_type &path, + basic_ptree::get_child(const path_type &path_, const self_type &default_value) const { - return const_cast(this)->get_child(path, + return const_cast(this)->get_child(path_, const_cast(default_value)); } template optional &> - basic_ptree::get_child_optional(const path_type &path) + basic_ptree::get_child_optional(const path_type &path_) { - path_type p(path); + path_type p(path_); self_type *n = walk_path(p); if (!n) { return optional(); @@ -600,9 +600,9 @@ namespace boost { namespace property_tree template optional &> - basic_ptree::get_child_optional(const path_type &path) const + basic_ptree::get_child_optional(const path_type &path_) const { - path_type p(path); + path_type p(path_); self_type *n = walk_path(p); if (!n) { return optional(); @@ -612,10 +612,10 @@ namespace boost { namespace property_tree template basic_ptree & - basic_ptree::put_child(const path_type &path, + basic_ptree::put_child(const path_type &path_, const self_type &value) { - path_type p(path); + path_type p(path_); self_type &parent = force_path(p); // Got the parent. Now get the correct child. key_type fragment = p.reduce(); @@ -630,10 +630,10 @@ namespace boost { namespace property_tree template basic_ptree & - basic_ptree::add_child(const path_type &path, + basic_ptree::add_child(const path_type &path_, const self_type &value) { - path_type p(path); + path_type p(path_); self_type &parent = force_path(p); // Got the parent. key_type fragment = p.reduce(); @@ -719,26 +719,26 @@ namespace boost { namespace property_tree template template inline typename boost::enable_if, Type>::type - basic_ptree::get(const path_type &path, + basic_ptree::get(const path_type &path_, Translator tr) const { - return get_child(path).BOOST_NESTED_TEMPLATE get_value(tr); + return get_child(path_).BOOST_NESTED_TEMPLATE get_value(tr); } template template inline - Type basic_ptree::get(const path_type &path) const + Type basic_ptree::get(const path_type &path_) const { - return get_child(path).BOOST_NESTED_TEMPLATE get_value(); + return get_child(path_).BOOST_NESTED_TEMPLATE get_value(); } template template inline - Type basic_ptree::get(const path_type &path, + Type basic_ptree::get(const path_type &path_, const Type &default_value, Translator tr) const { - return get_optional(path, tr).get_value_or(default_value); + return get_optional(path_, tr).get_value_or(default_value); } template @@ -748,18 +748,18 @@ namespace boost { namespace property_tree std::basic_string >::type basic_ptree::get( - const path_type &path, const Ch *default_value, Translator tr) const + const path_type &path_, const Ch *default_value, Translator tr) const { - return get, Translator>(path, default_value, tr); + return get, Translator>(path_, default_value, tr); } template template inline typename boost::disable_if, Type>::type - basic_ptree::get(const path_type &path, + basic_ptree::get(const path_type &path_, const Type &default_value) const { - return get_optional(path).get_value_or(default_value); + return get_optional(path_).get_value_or(default_value); } template @@ -769,17 +769,17 @@ namespace boost { namespace property_tree std::basic_string >::type basic_ptree::get( - const path_type &path, const Ch *default_value) const + const path_type &path_, const Ch *default_value) const { - return get< std::basic_string >(path, default_value); + return get< std::basic_string >(path_, default_value); } template template - optional basic_ptree::get_optional(const path_type &path, + optional basic_ptree::get_optional(const path_type &path_, Translator tr) const { - if (optional child = get_child_optional(path)) + if (optional child = get_child_optional(path_)) return child.get(). BOOST_NESTED_TEMPLATE get_value_optional(tr); else @@ -789,9 +789,9 @@ namespace boost { namespace property_tree template template optional basic_ptree::get_optional( - const path_type &path) const + const path_type &path_) const { - if (optional child = get_child_optional(path)) + if (optional child = get_child_optional(path_)) return child.get().BOOST_NESTED_TEMPLATE get_value_optional(); else return optional(); @@ -820,13 +820,13 @@ namespace boost { namespace property_tree template template basic_ptree & basic_ptree::put( - const path_type &path, const Type &value, Translator tr) + const path_type &path_, const Type &value, Translator tr) { - if(optional child = get_child_optional(path)) { + if(optional child = get_child_optional(path_)) { child.get().put_value(value, tr); return *child; } else { - self_type &child2 = put_child(path, self_type()); + self_type &child2 = put_child(path_, self_type()); child2.put_value(value, tr); return child2; } @@ -835,18 +835,18 @@ namespace boost { namespace property_tree template template inline basic_ptree & basic_ptree::put( - const path_type &path, const Type &value) + const path_type &path_, const Type &value) { - return put(path, value, + return put(path_, value, typename translator_between::type()); } template template inline basic_ptree & basic_ptree::add( - const path_type &path, const Type &value, Translator tr) + const path_type &path_, const Type &value, Translator tr) { - self_type &child = add_child(path, self_type()); + self_type &child = add_child(path_, self_type()); child.put_value(value, tr); return child; } @@ -854,9 +854,9 @@ namespace boost { namespace property_tree template template inline basic_ptree & basic_ptree::add( - const path_type &path, const Type &value) + const path_type &path_, const Type &value) { - return add(path, value, + return add(path_, value, typename translator_between::type()); } diff --git a/include/boost/property_tree/string_path.hpp b/include/boost/property_tree/string_path.hpp index d4bc686..27f977a 100644 --- a/include/boost/property_tree/string_path.hpp +++ b/include/boost/property_tree/string_path.hpp @@ -88,14 +88,14 @@ namespace boost { namespace property_tree typedef typename String::value_type char_type; /// Create an empty path. - explicit string_path(char_type separator = char_type('.')); + explicit string_path(char_type separator_ = char_type('.')); /// Create a path by parsing the given string. /// @param value A sequence, possibly with separators, that describes /// the path, e.g. "one.two.three". /// @param separator The separator used in parsing. Defaults to '.'. /// @param tr The translator used by this path to convert the individual /// parts to keys. - string_path(const String &value, char_type separator = char_type('.'), + string_path(const String &value, char_type separator_ = char_type('.'), Translator tr = Translator()); /// Create a path by parsing the given string. /// @param value A zero-terminated array of values. Only use if zero- @@ -106,7 +106,7 @@ namespace boost { namespace property_tree /// @param tr The translator used by this path to convert the individual /// parts to keys. string_path(const char_type *value, - char_type separator = char_type('.'), + char_type separator_ = char_type('.'), Translator tr = Translator()); // Default copying doesn't do the right thing with the iterator @@ -162,23 +162,23 @@ namespace boost { namespace property_tree }; template inline - string_path::string_path(char_type separator) - : m_separator(separator), m_start(m_value.begin()) + string_path::string_path(char_type separator_) + : m_separator(separator_), m_start(m_value.begin()) {} template inline string_path::string_path(const String &value, - char_type separator, + char_type separator_, Translator tr) - : m_value(value), m_separator(separator), + : m_value(value), m_separator(separator_), m_tr(tr), m_start(m_value.begin()) {} template inline string_path::string_path(const char_type *value, - char_type separator, + char_type separator_, Translator tr) - : m_value(value), m_separator(separator), + : m_value(value), m_separator(separator_), m_tr(tr), m_start(m_value.begin()) {} -- 1.8.3.1