Boost logo

Boost :

Subject: Re: [boost] Attibutes and Qi
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-08-27 08:43:13


> I used the classic spirit in the past. Now I want to migrate to Spirit 2.4
> but I don't get the things together.Reading the different docus in the web
> did not help. What I want to do at first is to parse a simple string into
> a QString:
> My pseudo code looks like:
>
> QString t;
> qi::rule<string::iterator, QString()> r1 = (+qi::char_)(qi::_val =
> qi::_1);
> qi::rule<string::iterator , void()> r = r1[ref(t) = _1];
> std::string temp("Hallo");
> phrase_parse(temp.begin(), temp.end(), r, qi::space);
>
> But the compiler does no like this. Can anybody help me?

Please note, I don't know anything about QString. But in order to be usable
in places where Spirit expects to see a container, any data type needs to
conform to certain concepts. In particular the type is expected to expose a
STL compatible insert() function, expose the embedded types 'value_type',
'iterator', 'size_type', and 'reference'. IOW, it needs to be a STL
compatible container.

If the required interfaces are not exposed, you'll need to specialize
Spirit's customization points for your data type (see the docs and examples
for that, for instance:
http://www.boost.org/doc/libs/1_44_0/libs/spirit/doc/html/spirit/advanced/cu
stomize/is_container.html).

If you write such customization points for QString we would love to get them
back and having it added to the Spirit repository.

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk