Boost logo

Boost :

Subject: Re: [boost] [spirit2] How to get encoding-specific parsers by character type
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-06-12 08:15:43


> >>> I don't think so. I use char/UTF-8 a lot now; I don't want char to
> >>> be tied to standard narrow.
> >>
> >> Ok, what about specifying encoding tag then?
> >>
> >> template< typename EncodingTagT >
> >> struct encoding_specific
> >> {
> >> ...
> >> };
> >>
> >> I could create my traits to deduce the default encoding by the
> >> character type for my case.
> >
> > I'm sorry, you lost me. Could you please elaborate?
>
> What I want to be able to do is something like that:
>
> template< typename CharT >
> void parse(const CharT* str)
> {
> typedef typename my_traits< CharT >::encoding encoding;
> typedef spirit::encoding_specific< encoding > parsers;
> qi::parse(str, *parsers::char_);
> }
>
> The encoding type shall be one of the tags defined by spirit (for
> instance, spirit::char_encoding::standard). What I need is the
> encoding_specific traits in spirit.

That's making a lot more sense. Would you be willing to prepare a patch?

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