Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68167 - in trunk/boost/spirit/home: karma/string qi/string
From: hartmut.kaiser_at_[hidden]
Date: 2011-01-14 21:54:23


Author: hkaiser
Date: 2011-01-14 21:54:22 EST (Fri, 14 Jan 2011)
New Revision: 68167
URL: http://svn.boost.org/trac/boost/changeset/68167

Log:
Spirit: added explicit name() to symbols
Text files modified:
   trunk/boost/spirit/home/karma/string/symbols.hpp | 46 ++++++++++++++++++++++++++++++++++-----
   trunk/boost/spirit/home/qi/string/symbols.hpp | 26 +++++++++++++++++++---
   2 files changed, 62 insertions(+), 10 deletions(-)

Modified: trunk/boost/spirit/home/karma/string/symbols.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/symbols.hpp (original)
+++ trunk/boost/spirit/home/karma/string/symbols.hpp 2011-01-14 21:54:22 EST (Fri, 14 Jan 2011)
@@ -211,11 +211,12 @@
             typedef Attribute type;
         };
 
- symbols()
+ symbols(std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name_(name)
         {}
 
         symbols(symbols const& syms)
@@ -223,6 +224,7 @@
           , add(*this)
           , remove(*this)
           , lookup(syms.lookup)
+ , name_(syms.name_)
         {}
 
         template <typename CharEncoding_, typename Tag_>
@@ -231,14 +233,17 @@
           , add(*this)
           , remove(*this)
           , lookup(syms.lookup)
+ , name_(syms.name_)
         {}
 
         template <typename Symbols, typename Data>
- symbols(Symbols const& syms, Data const& data)
+ symbols(Symbols const& syms, Data const& data
+ , std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name_(name)
         {
             typename range_const_iterator<Symbols>::type si = boost::begin(syms);
             typename range_const_iterator<Data>::type di = boost::begin(data);
@@ -250,6 +255,7 @@
         operator=(symbols const& rhs)
         {
             *lookup = *rhs.lookup;
+ name_ = rhs.name_;
             return *this;
         }
 
@@ -258,6 +264,7 @@
         operator=(symbols<Attribute, T, Lookup, CharEncoding_, Tag_> const& rhs)
         {
             *lookup = *rhs.lookup;
+ name_ = rhs.name_;
             return *this;
         }
 
@@ -346,7 +353,16 @@
         template <typename Context>
         info what(Context&) const
         {
- return info("symbols");
+ return info(name_);
+ }
+
+ void name(std::string const &str)
+ {
+ name_ = str;
+ }
+ std::string const &name() const
+ {
+ return name_;
         }
 
         ///////////////////////////////////////////////////////////////////////
@@ -419,6 +435,7 @@
         adder add;
         remover remove;
         shared_ptr<Lookup> lookup;
+ std::string name_;
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -449,11 +466,12 @@
             typedef Attribute type;
         };
 
- symbols()
+ symbols(std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name_(name)
         {}
 
         symbols(symbols const& syms)
@@ -461,6 +479,7 @@
           , add(*this)
           , remove(*this)
           , lookup(syms.lookup)
+ , name_(syms.name_)
         {}
 
         template <typename CharEncoding_, typename Tag_>
@@ -469,14 +488,17 @@
           , add(*this)
           , remove(*this)
           , lookup(syms.lookup)
+ , name_(syms.name_)
         {}
 
         template <typename Symbols, typename Data>
- symbols(Symbols const& syms, Data const& data)
+ symbols(Symbols const& syms, Data const& data
+ , std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name_(name)
         {
             typename range_const_iterator<Symbols>::type si = boost::begin(syms);
             typename range_const_iterator<Data>::type di = boost::begin(data);
@@ -488,6 +510,7 @@
         operator=(symbols const& rhs)
         {
             *lookup = *rhs.lookup;
+ name_ = rhs.name_;
             return *this;
         }
 
@@ -496,6 +519,7 @@
         operator=(symbols<Attribute, unused_type, Lookup, CharEncoding_, Tag_> const& rhs)
         {
             *lookup = *rhs.lookup;
+ name_ = rhs.name_;
             return *this;
         }
 
@@ -588,7 +612,16 @@
         template <typename Context>
         info what(Context&) const
         {
- return info("symbols");
+ return info(name_);
+ }
+
+ void name(std::string const &str)
+ {
+ name_ = str;
+ }
+ std::string const &name() const
+ {
+ return name_;
         }
 
         ///////////////////////////////////////////////////////////////////////
@@ -661,6 +694,7 @@
         adder add;
         remover remove;
         shared_ptr<Lookup> lookup;
+ std::string name_;
     };
 
     ///////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/spirit/home/qi/string/symbols.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/symbols.hpp (original)
+++ trunk/boost/spirit/home/qi/string/symbols.hpp 2011-01-14 21:54:22 EST (Fri, 14 Jan 2011)
@@ -63,11 +63,12 @@
             typedef value_type type;
         };
 
- symbols()
+ symbols(std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name(name_)
         {
         }
 
@@ -76,6 +77,7 @@
           , add(*this)
           , remove(*this)
           , lookup(syms.lookup)
+ , name_(syms.name_)
         {
         }
 
@@ -85,15 +87,17 @@
           , add(*this)
           , remove(*this)
           , lookup(syms.lookup)
+ , name_(syms.name_)
         {
         }
 
         template <typename Symbols>
- symbols(Symbols const& syms)
+ symbols(Symbols const& syms, std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name_(name)
         {
             typename range_const_iterator<Symbols>::type si = boost::begin(syms);
             while (si != boost::end(syms))
@@ -101,11 +105,13 @@
         }
 
         template <typename Symbols, typename Data>
- symbols(Symbols const& syms, Data const& data)
+ symbols(Symbols const& syms, Data const& data
+ , std::string const& name = "symbols")
           : base_type(terminal::make(reference_(*this)))
           , add(*this)
           , remove(*this)
           , lookup(new Lookup())
+ , name_(name)
         {
             typename range_const_iterator<Symbols>::type si = boost::begin(syms);
             typename range_const_iterator<Data>::type di = boost::begin(data);
@@ -116,6 +122,7 @@
         symbols&
         operator=(symbols const& rhs)
         {
+ name_ = rhs.name_;
             *lookup = *rhs.lookup;
             return *this;
         }
@@ -124,6 +131,7 @@
         symbols&
         operator=(symbols<Char, T, Lookup, Filter_> const& rhs)
         {
+ name_ = rhs.name_;
             *lookup = *rhs.lookup;
             return *this;
         }
@@ -248,7 +256,16 @@
         template <typename Context>
         info what(Context& /*context*/) const
         {
- return info("symbols"); // $$$ for now! give symbols a name $$$
+ return info(name_);
+ }
+
+ void name(std::string const &str)
+ {
+ name_ = str;
+ }
+ std::string const &name() const
+ {
+ return name_;
         }
 
         struct adder
@@ -340,6 +357,7 @@
         adder add;
         remover remove;
         shared_ptr<Lookup> lookup;
+ std::string name_;
     };
 
     ///////////////////////////////////////////////////////////////////////////


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