Index: detail/ptree_implementation.hpp =================================================================== --- detail/ptree_implementation.hpp (revision 83174) +++ detail/ptree_implementation.hpp (working copy) @@ -655,10 +655,10 @@ template template inline - Type basic_ptree::get_value() const + Type basic_ptree::get_value(const std::locale & loc) const { return get_value( - typename translator_between::type()); + typename translator_between::type(loc)); } template @@ -683,10 +683,10 @@ template template inline typename boost::disable_if, Type>::type - basic_ptree::get_value(const Type &default_value) const + basic_ptree::get_value(const Type &default_value, const std::locale & loc) const { return get_value(default_value, - typename translator_between::type()); + typename translator_between::type(loc)); } template @@ -710,10 +710,10 @@ template template inline - optional basic_ptree::get_value_optional() const + optional basic_ptree::get_value_optional(const std::locale & loc) const { return get_value_optional( - typename translator_between::type()); + typename translator_between::type(loc)); } template @@ -727,9 +727,9 @@ template template inline - Type basic_ptree::get(const path_type &path) const + Type basic_ptree::get(const path_type &path, const std::locale & loc) const { - return get_child(path).BOOST_NESTED_TEMPLATE get_value(); + return get_child(path).BOOST_NESTED_TEMPLATE get_value(loc); } template @@ -757,9 +757,9 @@ template inline typename boost::disable_if, Type>::type basic_ptree::get(const path_type &path, - const Type &default_value) const + const Type &default_value, const std::locale & loc) const { - return get_optional(path).get_value_or(default_value); + return get_optional(path, loc).get_value_or(default_value); } template @@ -789,10 +789,10 @@ template template optional basic_ptree::get_optional( - const path_type &path) const + const path_type &path, const std::locale & loc) const { if (optional child = get_child_optional(path)) - return child.get().BOOST_NESTED_TEMPLATE get_value_optional(); + return child.get().BOOST_NESTED_TEMPLATE get_value_optional(loc); else return optional(); } @@ -812,9 +812,9 @@ template template inline - void basic_ptree::put_value(const Type &value) + void basic_ptree::put_value(const Type &value, const std::locale & loc) { - put_value(value, typename translator_between::type()); + put_value(value, typename translator_between::type(loc)); } template @@ -835,10 +835,10 @@ template template inline basic_ptree & basic_ptree::put( - const path_type &path, const Type &value) + const path_type &path, const Type &value, const std::locale & loc) { return put(path, value, - typename translator_between::type()); + typename translator_between::type(loc)); } template @@ -854,10 +854,10 @@ template template inline basic_ptree & basic_ptree::add( - const path_type &path, const Type &value) + const path_type &path, const Type &value, const std::locale & loc) { return add(path, value, - typename translator_between::type()); + typename translator_between::type(loc)); } Index: id_translator.hpp =================================================================== --- id_translator.hpp (revision 83174) +++ id_translator.hpp (working copy) @@ -28,6 +28,13 @@ boost::optional get_value(const T &v) { return v; } boost::optional put_value(const T &v) { return v; } + + explicit id_translator() + { + } + explicit id_translator(const std::locale &) + { + } }; // This is the default translator whenever you get two equal types. Index: ptree.hpp =================================================================== --- ptree.hpp (revision 83174) +++ ptree.hpp (working copy) @@ -310,7 +310,7 @@ * @throw ptree_bad_data if the conversion fails. */ template - Type get_value() const; + Type get_value(const std::locale & loc = std::locale()) const; /** Take the value of this node and attempt to translate it to a * @c Type object using the supplied translator. Return @p default_value @@ -333,7 +333,7 @@ */ template typename boost::disable_if, Type>::type - get_value(const Type &default_value) const; + get_value(const Type &default_value, const std::locale & loc = std::locale()) const; /** Make get_value do the right thing for string literals. */ template @@ -355,7 +355,7 @@ * this fails. */ template - optional get_value_optional() const; + optional get_value_optional(const std::locale & loc = std::locale()) const; /** Replace the value at this node with the given value, translated * to the tree's data type using the supplied translator. @@ -369,7 +369,7 @@ * @throw ptree_bad_data if the conversion fails. */ template - void put_value(const Type &value); + void put_value(const Type &value, const std::locale & loc = std::locale()); /** Shorthand for get_child(path).get_value(tr). */ template @@ -378,7 +378,7 @@ /** Shorthand for get_child(path).get_value\(). */ template - Type get(const path_type &path) const; + Type get(const path_type &path, const std::locale & loc = std::locale()) const; /** Shorthand for get_child(path, empty_ptree()) * .get_value(default_value, tr). @@ -405,7 +405,7 @@ */ template typename boost::disable_if, Type>::type - get(const path_type &path, const Type &default_value) const; + get(const path_type &path, const Type &default_value, const std::locale & loc = std::locale()) const; /** Make get do the right thing for string literals. */ template @@ -435,7 +435,7 @@ * That is, return the value if it exists and can be converted, or nil. */ template - optional get_optional(const path_type &path) const; + optional get_optional(const path_type &path, const std::locale & loc = std::locale()) const; /** Set the value of the node at the given path to the supplied value, * translated to the tree's data type. If the node doesn't exist, it is @@ -453,7 +453,7 @@ * @throw ptree_bad_data if the conversion fails. */ template - self_type &put(const path_type &path, const Type &value); + self_type &put(const path_type &path, const Type &value, const std::locale & loc = std::locale()); /** If the node identified by the path does not exist, create it, * including all its missing parents. @@ -484,7 +484,7 @@ * @throw ptree_bad_data if the conversion fails. */ template - self_type &add(const path_type &path, const Type &value); + self_type &add(const path_type &path, const Type &value, const std::locale & loc = std::locale()); private: // Hold the data of this node Index: stream_translator.hpp =================================================================== --- stream_translator.hpp (revision 83174) +++ stream_translator.hpp (working copy) @@ -140,6 +140,7 @@ i < (std::numeric_limits::min)()) { s.clear(); // guarantees eof to be unset + s.setstate(std::ios_base::badbit); return; } e = (signed char)i; @@ -161,6 +162,7 @@ // out of range? if(i > (std::numeric_limits::max)()) { s.clear(); // guarantees eof to be unset + s.setstate(std::ios_base::badbit); return; } e = (unsigned char)i; @@ -179,7 +181,7 @@ typedef std::basic_string internal_type; typedef E external_type; - explicit stream_translator(std::locale loc = std::locale()) + explicit stream_translator(std::locale loc) : m_loc(loc) {}