Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66998 - in trunk/boost/spirit/home/support/utree: . detail
From: hartmut.kaiser_at_[hidden]
Date: 2010-12-03 21:02:56


Author: hkaiser
Date: 2010-12-03 21:02:55 EST (Fri, 03 Dec 2010)
New Revision: 66998
URL: http://svn.boost.org/trac/boost/changeset/66998

Log:
Spirit: fixing customization points for utree
Text files modified:
   trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp | 2 +-
   trunk/boost/spirit/home/support/utree/utree.hpp | 2 +-
   trunk/boost/spirit/home/support/utree/utree_traits.hpp | 19 ++++++++++++++++---
   3 files changed, 18 insertions(+), 5 deletions(-)

Modified: trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp (original)
+++ trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp 2010-12-03 21:02:55 EST (Fri, 03 Dec 2010)
@@ -1252,7 +1252,7 @@
             set_type(type::list_type);
             l.default_construct();
         }
- else if (get_type() != type::nil_type)
+ else if (get_type() != type::list_type)
         {
             boost::throw_exception(bad_type_exception());
         }

Modified: trunk/boost/spirit/home/support/utree/utree.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/utree.hpp (original)
+++ trunk/boost/spirit/home/support/utree/utree.hpp 2010-12-03 21:02:55 EST (Fri, 03 Dec 2010)
@@ -383,7 +383,7 @@
         bool empty() const;
         std::size_t size() const;
 
- utree_type::info which() const;
+ type::info which() const;
 
         template <typename T>
         T get() const;

Modified: trunk/boost/spirit/home/support/utree/utree_traits.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/utree_traits.hpp (original)
+++ trunk/boost/spirit/home/support/utree/utree_traits.hpp 2010-12-03 21:02:55 EST (Fri, 03 Dec 2010)
@@ -74,7 +74,7 @@
           if (attr.empty())
               attr = val;
           else
- attr.push_back(val); // implicitly converts utree to a list
+ push_back(attr, val);
         }
 
         static void call(Attribute const& val, utree& attr, mpl::true_)
@@ -89,7 +89,8 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // this specialization is required to disambiguate the specialization
+ // this specialization is required to disambiguate the specializations
+ // related to utree
     template <>
     struct assign_to_attribute_from_value<utree, utree>
     {
@@ -106,6 +107,7 @@
     template <typename T>
     struct push_back_container<utree, T>
     {
+ ///////////////////////////////////////////////////////////////////////
         template <typename T2>
         static void push_to_nil(utree& c, T2 const& val)
         {
@@ -127,10 +129,14 @@
             c = utree(val);
         }
 
+ ///////////////////////////////////////////////////////////////////////
         template <typename T2>
         static void push_to_string(utree& c, T2 const& val)
         {
- c.push_back(val);
+ utree ut;
+ ut.push_back(c);
+ ut.push_back(val);
+ c.swap(ut);
         }
 
         static void push_to_string(utree& c, utree const& val)
@@ -157,6 +163,13 @@
             c = (std::string(rng.begin(), rng.end()) + val);
         }
 
+ static void push_to_string(utree& c, char val)
+ {
+ utf8_string_range rng = c.get<utf8_string_range>();
+ c = (std::string(rng.begin(), rng.end()) + val);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
         static bool call(utree& c, T const& val)
         {
             switch (c.which())


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk