From 72e4480d96fe8b74ff484e3c1debca310e4090a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Mon, 14 Apr 2014 12:13:58 +0200
Subject: [PATCH 1/2] property_tree: fix GCC -Wshadow warnings
Signed-off-by: Michael Stahl <mstahl@redhat.com>
---
.../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
|
b
|
namespace boost { namespace property_tree { namespace json_parser
|
20 | 20 | class json_parser_error: public file_parser_error |
21 | 21 | { |
22 | 22 | public: |
23 | | json_parser_error(const std::string &message, |
24 | | const std::string &filename, |
25 | | unsigned long line): |
26 | | file_parser_error(message, filename, line) |
| 23 | json_parser_error(const std::string &message_, |
| 24 | const std::string &filename_, |
| 25 | unsigned long line_): |
| 26 | file_parser_error(message_, filename_, line_) |
27 | 27 | { |
28 | 28 | } |
29 | 29 | }; |
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
|
b
|
namespace boost { namespace property_tree { namespace json_parser
|
45 | 45 | struct a_object_s |
46 | 46 | { |
47 | 47 | context &c; |
48 | | a_object_s(context &c): c(c) { } |
| 48 | a_object_s(context &c_): c(c_) { } |
49 | 49 | void operator()(Ch) const |
50 | 50 | { |
51 | 51 | if (c.stack.empty()) |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
63 | 63 | struct a_object_e |
64 | 64 | { |
65 | 65 | context &c; |
66 | | a_object_e(context &c): c(c) { } |
| 66 | a_object_e(context &c_): c(c_) { } |
67 | 67 | void operator()(Ch) const |
68 | 68 | { |
69 | 69 | BOOST_ASSERT(c.stack.size() >= 1); |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
74 | 74 | struct a_name |
75 | 75 | { |
76 | 76 | context &c; |
77 | | a_name(context &c): c(c) { } |
| 77 | a_name(context &c_): c(c_) { } |
78 | 78 | void operator()(It, It) const |
79 | 79 | { |
80 | 80 | c.name.swap(c.string); |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
85 | 85 | struct a_string_val |
86 | 86 | { |
87 | 87 | context &c; |
88 | | a_string_val(context &c): c(c) { } |
| 88 | a_string_val(context &c_): c(c_) { } |
89 | 89 | void operator()(It, It) const |
90 | 90 | { |
91 | 91 | BOOST_ASSERT(c.stack.size() >= 1); |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
98 | 98 | struct a_literal_val |
99 | 99 | { |
100 | 100 | context &c; |
101 | | a_literal_val(context &c): c(c) { } |
| 101 | a_literal_val(context &c_): c(c_) { } |
102 | 102 | void operator()(It b, It e) const |
103 | 103 | { |
104 | 104 | BOOST_ASSERT(c.stack.size() >= 1); |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
112 | 112 | struct a_char |
113 | 113 | { |
114 | 114 | context &c; |
115 | | a_char(context &c): c(c) { } |
| 115 | a_char(context &c_): c(c_) { } |
116 | 116 | void operator()(It b, It) const |
117 | 117 | { |
118 | 118 | c.string += *b; |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
122 | 122 | struct a_escape |
123 | 123 | { |
124 | 124 | context &c; |
125 | | a_escape(context &c): c(c) { } |
| 125 | a_escape(context &c_): c(c_) { } |
126 | 126 | void operator()(Ch ch) const |
127 | 127 | { |
128 | 128 | switch (ch) |
… |
… |
namespace boost { namespace property_tree { namespace json_parser
|
143 | 143 | struct a_unicode |
144 | 144 | { |
145 | 145 | context &c; |
146 | | a_unicode(context &c): c(c) { } |
| 146 | a_unicode(context &c_): c(c_) { } |
147 | 147 | void operator()(unsigned long u) const |
148 | 148 | { |
149 | 149 | u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<Ch>::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
|
b
|
namespace boost { namespace property_tree
|
549 | 549 | |
550 | 550 | template<class K, class D, class C> |
551 | 551 | basic_ptree<K, D, C> & |
552 | | basic_ptree<K, D, C>::get_child(const path_type &path) |
| 552 | basic_ptree<K, D, C>::get_child(const path_type &path_) |
553 | 553 | { |
554 | | path_type p(path); |
| 554 | path_type p(path_); |
555 | 555 | self_type *n = walk_path(p); |
556 | 556 | if (!n) { |
557 | | BOOST_PROPERTY_TREE_THROW(ptree_bad_path("No such node", path)); |
| 557 | BOOST_PROPERTY_TREE_THROW(ptree_bad_path("No such node", path_)); |
558 | 558 | } |
559 | 559 | return *n; |
560 | 560 | } |
561 | 561 | |
562 | 562 | template<class K, class D, class C> inline |
563 | 563 | const basic_ptree<K, D, C> & |
564 | | basic_ptree<K, D, C>::get_child(const path_type &path) const |
| 564 | basic_ptree<K, D, C>::get_child(const path_type &path_) const |
565 | 565 | { |
566 | | return const_cast<self_type*>(this)->get_child(path); |
| 566 | return const_cast<self_type*>(this)->get_child(path_); |
567 | 567 | } |
568 | 568 | |
569 | 569 | template<class K, class D, class C> inline |
570 | 570 | basic_ptree<K, D, C> & |
571 | | basic_ptree<K, D, C>::get_child(const path_type &path, |
| 571 | basic_ptree<K, D, C>::get_child(const path_type &path_, |
572 | 572 | self_type &default_value) |
573 | 573 | { |
574 | | path_type p(path); |
| 574 | path_type p(path_); |
575 | 575 | self_type *n = walk_path(p); |
576 | 576 | return n ? *n : default_value; |
577 | 577 | } |
578 | 578 | |
579 | 579 | template<class K, class D, class C> inline |
580 | 580 | const basic_ptree<K, D, C> & |
581 | | basic_ptree<K, D, C>::get_child(const path_type &path, |
| 581 | basic_ptree<K, D, C>::get_child(const path_type &path_, |
582 | 582 | const self_type &default_value) const |
583 | 583 | { |
584 | | return const_cast<self_type*>(this)->get_child(path, |
| 584 | return const_cast<self_type*>(this)->get_child(path_, |
585 | 585 | const_cast<self_type&>(default_value)); |
586 | 586 | } |
587 | 587 | |
588 | 588 | |
589 | 589 | template<class K, class D, class C> |
590 | 590 | optional<basic_ptree<K, D, C> &> |
591 | | basic_ptree<K, D, C>::get_child_optional(const path_type &path) |
| 591 | basic_ptree<K, D, C>::get_child_optional(const path_type &path_) |
592 | 592 | { |
593 | | path_type p(path); |
| 593 | path_type p(path_); |
594 | 594 | self_type *n = walk_path(p); |
595 | 595 | if (!n) { |
596 | 596 | return optional<self_type&>(); |
… |
… |
namespace boost { namespace property_tree
|
600 | 600 | |
601 | 601 | template<class K, class D, class C> |
602 | 602 | optional<const basic_ptree<K, D, C> &> |
603 | | basic_ptree<K, D, C>::get_child_optional(const path_type &path) const |
| 603 | basic_ptree<K, D, C>::get_child_optional(const path_type &path_) const |
604 | 604 | { |
605 | | path_type p(path); |
| 605 | path_type p(path_); |
606 | 606 | self_type *n = walk_path(p); |
607 | 607 | if (!n) { |
608 | 608 | return optional<const self_type&>(); |
… |
… |
namespace boost { namespace property_tree
|
612 | 612 | |
613 | 613 | template<class K, class D, class C> |
614 | 614 | basic_ptree<K, D, C> & |
615 | | basic_ptree<K, D, C>::put_child(const path_type &path, |
| 615 | basic_ptree<K, D, C>::put_child(const path_type &path_, |
616 | 616 | const self_type &value) |
617 | 617 | { |
618 | | path_type p(path); |
| 618 | path_type p(path_); |
619 | 619 | self_type &parent = force_path(p); |
620 | 620 | // Got the parent. Now get the correct child. |
621 | 621 | key_type fragment = p.reduce(); |
… |
… |
namespace boost { namespace property_tree
|
630 | 630 | |
631 | 631 | template<class K, class D, class C> |
632 | 632 | basic_ptree<K, D, C> & |
633 | | basic_ptree<K, D, C>::add_child(const path_type &path, |
| 633 | basic_ptree<K, D, C>::add_child(const path_type &path_, |
634 | 634 | const self_type &value) |
635 | 635 | { |
636 | | path_type p(path); |
| 636 | path_type p(path_); |
637 | 637 | self_type &parent = force_path(p); |
638 | 638 | // Got the parent. |
639 | 639 | key_type fragment = p.reduce(); |
… |
… |
namespace boost { namespace property_tree
|
719 | 719 | template<class K, class D, class C> |
720 | 720 | template<class Type, class Translator> inline |
721 | 721 | typename boost::enable_if<detail::is_translator<Translator>, Type>::type |
722 | | basic_ptree<K, D, C>::get(const path_type &path, |
| 722 | basic_ptree<K, D, C>::get(const path_type &path_, |
723 | 723 | Translator tr) const |
724 | 724 | { |
725 | | return get_child(path).BOOST_NESTED_TEMPLATE get_value<Type>(tr); |
| 725 | return get_child(path_).BOOST_NESTED_TEMPLATE get_value<Type>(tr); |
726 | 726 | } |
727 | 727 | |
728 | 728 | template<class K, class D, class C> |
729 | 729 | template<class Type> inline |
730 | | Type basic_ptree<K, D, C>::get(const path_type &path) const |
| 730 | Type basic_ptree<K, D, C>::get(const path_type &path_) const |
731 | 731 | { |
732 | | return get_child(path).BOOST_NESTED_TEMPLATE get_value<Type>(); |
| 732 | return get_child(path_).BOOST_NESTED_TEMPLATE get_value<Type>(); |
733 | 733 | } |
734 | 734 | |
735 | 735 | template<class K, class D, class C> |
736 | 736 | template<class Type, class Translator> inline |
737 | | Type basic_ptree<K, D, C>::get(const path_type &path, |
| 737 | Type basic_ptree<K, D, C>::get(const path_type &path_, |
738 | 738 | const Type &default_value, |
739 | 739 | Translator tr) const |
740 | 740 | { |
741 | | return get_optional<Type>(path, tr).get_value_or(default_value); |
| 741 | return get_optional<Type>(path_, tr).get_value_or(default_value); |
742 | 742 | } |
743 | 743 | |
744 | 744 | template<class K, class D, class C> |
… |
… |
namespace boost { namespace property_tree
|
748 | 748 | std::basic_string<Ch> |
749 | 749 | >::type |
750 | 750 | basic_ptree<K, D, C>::get( |
751 | | const path_type &path, const Ch *default_value, Translator tr) const |
| 751 | const path_type &path_, const Ch *default_value, Translator tr) const |
752 | 752 | { |
753 | | return get<std::basic_string<Ch>, Translator>(path, default_value, tr); |
| 753 | return get<std::basic_string<Ch>, Translator>(path_, default_value, tr); |
754 | 754 | } |
755 | 755 | |
756 | 756 | template<class K, class D, class C> |
757 | 757 | template<class Type> inline |
758 | 758 | typename boost::disable_if<detail::is_translator<Type>, Type>::type |
759 | | basic_ptree<K, D, C>::get(const path_type &path, |
| 759 | basic_ptree<K, D, C>::get(const path_type &path_, |
760 | 760 | const Type &default_value) const |
761 | 761 | { |
762 | | return get_optional<Type>(path).get_value_or(default_value); |
| 762 | return get_optional<Type>(path_).get_value_or(default_value); |
763 | 763 | } |
764 | 764 | |
765 | 765 | template<class K, class D, class C> |
… |
… |
namespace boost { namespace property_tree
|
769 | 769 | std::basic_string<Ch> |
770 | 770 | >::type |
771 | 771 | basic_ptree<K, D, C>::get( |
772 | | const path_type &path, const Ch *default_value) const |
| 772 | const path_type &path_, const Ch *default_value) const |
773 | 773 | { |
774 | | return get< std::basic_string<Ch> >(path, default_value); |
| 774 | return get< std::basic_string<Ch> >(path_, default_value); |
775 | 775 | } |
776 | 776 | |
777 | 777 | template<class K, class D, class C> |
778 | 778 | template<class Type, class Translator> |
779 | | optional<Type> basic_ptree<K, D, C>::get_optional(const path_type &path, |
| 779 | optional<Type> basic_ptree<K, D, C>::get_optional(const path_type &path_, |
780 | 780 | Translator tr) const |
781 | 781 | { |
782 | | if (optional<const self_type&> child = get_child_optional(path)) |
| 782 | if (optional<const self_type&> child = get_child_optional(path_)) |
783 | 783 | return child.get(). |
784 | 784 | BOOST_NESTED_TEMPLATE get_value_optional<Type>(tr); |
785 | 785 | else |
… |
… |
namespace boost { namespace property_tree
|
789 | 789 | template<class K, class D, class C> |
790 | 790 | template<class Type> |
791 | 791 | optional<Type> basic_ptree<K, D, C>::get_optional( |
792 | | const path_type &path) const |
| 792 | const path_type &path_) const |
793 | 793 | { |
794 | | if (optional<const self_type&> child = get_child_optional(path)) |
| 794 | if (optional<const self_type&> child = get_child_optional(path_)) |
795 | 795 | return child.get().BOOST_NESTED_TEMPLATE get_value_optional<Type>(); |
796 | 796 | else |
797 | 797 | return optional<Type>(); |
… |
… |
namespace boost { namespace property_tree
|
820 | 820 | template<class K, class D, class C> |
821 | 821 | template<class Type, typename Translator> |
822 | 822 | basic_ptree<K, D, C> & basic_ptree<K, D, C>::put( |
823 | | const path_type &path, const Type &value, Translator tr) |
| 823 | const path_type &path_, const Type &value, Translator tr) |
824 | 824 | { |
825 | | if(optional<self_type &> child = get_child_optional(path)) { |
| 825 | if(optional<self_type &> child = get_child_optional(path_)) { |
826 | 826 | child.get().put_value(value, tr); |
827 | 827 | return *child; |
828 | 828 | } else { |
829 | | self_type &child2 = put_child(path, self_type()); |
| 829 | self_type &child2 = put_child(path_, self_type()); |
830 | 830 | child2.put_value(value, tr); |
831 | 831 | return child2; |
832 | 832 | } |
… |
… |
namespace boost { namespace property_tree
|
835 | 835 | template<class K, class D, class C> |
836 | 836 | template<class Type> inline |
837 | 837 | basic_ptree<K, D, C> & basic_ptree<K, D, C>::put( |
838 | | const path_type &path, const Type &value) |
| 838 | const path_type &path_, const Type &value) |
839 | 839 | { |
840 | | return put(path, value, |
| 840 | return put(path_, value, |
841 | 841 | typename translator_between<data_type, Type>::type()); |
842 | 842 | } |
843 | 843 | |
844 | 844 | template<class K, class D, class C> |
845 | 845 | template<class Type, typename Translator> inline |
846 | 846 | basic_ptree<K, D, C> & basic_ptree<K, D, C>::add( |
847 | | const path_type &path, const Type &value, Translator tr) |
| 847 | const path_type &path_, const Type &value, Translator tr) |
848 | 848 | { |
849 | | self_type &child = add_child(path, self_type()); |
| 849 | self_type &child = add_child(path_, self_type()); |
850 | 850 | child.put_value(value, tr); |
851 | 851 | return child; |
852 | 852 | } |
… |
… |
namespace boost { namespace property_tree
|
854 | 854 | template<class K, class D, class C> |
855 | 855 | template<class Type> inline |
856 | 856 | basic_ptree<K, D, C> & basic_ptree<K, D, C>::add( |
857 | | const path_type &path, const Type &value) |
| 857 | const path_type &path_, const Type &value) |
858 | 858 | { |
859 | | return add(path, value, |
| 859 | return add(path_, value, |
860 | 860 | typename translator_between<data_type, Type>::type()); |
861 | 861 | } |
862 | 862 | |
diff --git a/include/boost/property_tree/string_path.hpp b/include/boost/property_tree/string_path.hpp
index d4bc686..27f977a 100644
a
|
b
|
namespace boost { namespace property_tree
|
88 | 88 | typedef typename String::value_type char_type; |
89 | 89 | |
90 | 90 | /// Create an empty path. |
91 | | explicit string_path(char_type separator = char_type('.')); |
| 91 | explicit string_path(char_type separator_ = char_type('.')); |
92 | 92 | /// Create a path by parsing the given string. |
93 | 93 | /// @param value A sequence, possibly with separators, that describes |
94 | 94 | /// the path, e.g. "one.two.three". |
95 | 95 | /// @param separator The separator used in parsing. Defaults to '.'. |
96 | 96 | /// @param tr The translator used by this path to convert the individual |
97 | 97 | /// parts to keys. |
98 | | string_path(const String &value, char_type separator = char_type('.'), |
| 98 | string_path(const String &value, char_type separator_ = char_type('.'), |
99 | 99 | Translator tr = Translator()); |
100 | 100 | /// Create a path by parsing the given string. |
101 | 101 | /// @param value A zero-terminated array of values. Only use if zero- |
… |
… |
namespace boost { namespace property_tree
|
106 | 106 | /// @param tr The translator used by this path to convert the individual |
107 | 107 | /// parts to keys. |
108 | 108 | string_path(const char_type *value, |
109 | | char_type separator = char_type('.'), |
| 109 | char_type separator_ = char_type('.'), |
110 | 110 | Translator tr = Translator()); |
111 | 111 | |
112 | 112 | // Default copying doesn't do the right thing with the iterator |
… |
… |
namespace boost { namespace property_tree
|
162 | 162 | }; |
163 | 163 | |
164 | 164 | template <typename String, typename Translator> inline |
165 | | string_path<String, Translator>::string_path(char_type separator) |
166 | | : m_separator(separator), m_start(m_value.begin()) |
| 165 | string_path<String, Translator>::string_path(char_type separator_) |
| 166 | : m_separator(separator_), m_start(m_value.begin()) |
167 | 167 | {} |
168 | 168 | |
169 | 169 | template <typename String, typename Translator> inline |
170 | 170 | string_path<String, Translator>::string_path(const String &value, |
171 | | char_type separator, |
| 171 | char_type separator_, |
172 | 172 | Translator tr) |
173 | | : m_value(value), m_separator(separator), |
| 173 | : m_value(value), m_separator(separator_), |
174 | 174 | m_tr(tr), m_start(m_value.begin()) |
175 | 175 | {} |
176 | 176 | |
177 | 177 | template <typename String, typename Translator> inline |
178 | 178 | string_path<String, Translator>::string_path(const char_type *value, |
179 | | char_type separator, |
| 179 | char_type separator_, |
180 | 180 | Translator tr) |
181 | | : m_value(value), m_separator(separator), |
| 181 | : m_value(value), m_separator(separator_), |
182 | 182 | m_tr(tr), m_start(m_value.begin()) |
183 | 183 | {} |
184 | 184 | |