|
Boost Users : |
Subject: Re: [Boost-users] Boost Spirit Karma - convert character to hex representation
From: Ernest Zaslavsky (ernest.zaslavsky_at_[hidden])
Date: 2015-04-20 00:02:50
Thanks!
Padding looks like what the doctor ordered. However I'm concerned with upper/lower directives. What is needed in hex is a simple mapping for 6 letters from a..z to A..Z and vice versa. Upper/lower, I guess, will employ std::locale to work properly which in turn uses std::facet which (at least in Windows) has lazy initialization and protected by CriticalSection. This is a performance killer, I've just spent two weeks getting rid of these from my code. Now tell me that I'm wrong and these directives do not use std::locale and I will be happy for the rest of my life :)
Otherwise I would like to know if there is another possibility to control hex letter case
-----Original Message-----
From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Hartmut Kaiser
Sent: Sunday, April 19, 2015 4:23 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Boost Spirit Karma - convert character to hex representation
> There is karma::hex formatter and I need somehow to add zero padding
> to get â0aâ instead of just âaâ. in addition it would be lovely to
> have some king of control over hex letter case. It sounds like a
> policies for real or Boolean formatters but I didnât find one for hex.
> Is it possible to achieve the above without policy?
Padding can be achieved by using the right_align[] directive: http://www.boost.org/doc/libs/1_58_0/libs/spirit/doc/html/spirit/karma/reference/directive/alignment.html.
You can control the hex-letter case using the upper[] and lower[] directives: http://www.boost.org/doc/libs/1_58_0/libs/spirit/doc/html/spirit/karma/reference/directive/upperlower.html.
HTH
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net