Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67687 - trunk/boost/spirit/home/support/utree
From: hartmut.kaiser_at_[hidden]
Date: 2011-01-05 15:15:11


Author: hkaiser
Date: 2011-01-05 15:14:25 EST (Wed, 05 Jan 2011)
New Revision: 67687
URL: http://svn.boost.org/trac/boost/changeset/67687

Log:
Spirit: Fixing utree problems
Text files modified:
   trunk/boost/spirit/home/support/utree/utree_traits.hpp | 35 ++++++++++++++++++++++++++++++-----
   1 files changed, 30 insertions(+), 5 deletions(-)

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 2011-01-05 15:14:25 EST (Wed, 05 Jan 2011)
@@ -176,7 +176,7 @@
             for (iterator_type i = traits::begin(val); i != end; traits::next(i))
                 push_back(attr, traits::deref(i));
         }
-
+
         static void call(Attribute const& val, utree& attr)
         {
             call(val, attr, is_container<Attribute>());
@@ -191,18 +191,22 @@
     {
         static void call(utree const& val, utree& attr)
         {
- if (attr.empty())
+ if (attr.empty()) {
                 attr = val;
- else {
+ }
+ else if (val.which() == utree_type::list_type) {
                 typedef utree::const_iterator iterator_type;
 
                 iterator_type end = traits::end(val);
                 for (iterator_type i = traits::begin(val); i != end; traits::next(i))
                     push_back(attr, traits::deref(i));
             }
+ else {
+ push_back(attr, val);
+ }
         }
     };
-
+
     template <>
     struct assign_to_container_from_value<utree, utree::list_type>
     {
@@ -210,11 +214,32 @@
         {
             if (attr.empty())
                 attr = val;
- else
+ else
                 push_back(attr, val);
         }
     };
 
+ template <>
+ struct assign_to_container_from_value<utree::list_type, utree>
+ {
+ static void call(utree const& val, utree& attr)
+ {
+ if (attr.empty())
+ attr = val;
+ else
+ push_back(attr, val);
+ }
+ };
+
+ template <>
+ struct assign_to_container_from_value<utree::list_type, utree::list_type>
+ {
+ static void call(utree const& val, utree& attr)
+ {
+ push_back(attr, val);
+ }
+ };
+
     ///////////////////////////////////////////////////////////////////////////
     // this specialization makes sure strings get assigned as a whole and are
     // not converted into a utree list


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