Boost logo

Boost :

Subject: Re: [boost] [RFC] string inserter/extractor "q u o t i n g"
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2010-06-23 22:04:09


On 6/23/2010 11:13 AM, Eric Niebler wrote:
> On 6/23/2010 11:01 AM, Eric Niebler wrote:
>> For valid input, I would prefer if unquote found a way to muddle through
>> and do something reasonable. Throwing an exception when a trailing quote
>> is missing seems like smacking someone's hand when they forgot to say
>> "mother may I?" Why not just accept it? And document that fact! If the
>> string is malformed in a way that you really can't muddle on, then throw
>> something derived from runtime_error.

I agree with muddling through. In a previous post, I recalled
that unquote() should be the inverse of quote(). Therefore, it
should simply remove the delimiter(s) from the beginning and end
and unescape escaped characters within.

> Or, better yet, the algorithm could return std::pair<OutIt,
> error_condition>, where OutIt is as far as the algorithm got, and
> error_condition is an enum describing the error if any.

That's not an unreasonable interface, but given the simplified
behavior outlined above, I don't think I need to go that far.
unquote() should just remove the starting and ending
delimiter(s), if found, and unescape escaped characters from the
middle.

___
Rob


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