qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: qpid-proton 0.12.2 connection_engine and ssl
Date Wed, 20 Jul 2016 13:16:58 GMT
On Wed, 2016-07-20 at 04:31 -0700, Tobias Duckworth wrote:
> The decode::no_more_data problem...
> 
> The body of the message is empty, why not just return an empty
> string?
> 
> I can work around this by doing a proton::value body =
> message.body(); if
> (!body.empty())
> 
> But seems a bit hardcore to throw an exception, just saying.
> I do understand that string is an easy example, and perhaps the
> conversion
> to an integer is less obvious.
> 

This is the AMQP/C++ data conversion layer. I aimed at making it more
"type safe" in the spirit of C++ than the conversions in python. I also
wanted to make it possible to interrogate and construct exact on-the-
wire AMQP types, as well as doing easy "obvious" conversions to/from
native C++ types.

Note you can do ostream << value to get a printable string, but for an
empty value that will give you "<null>" not "".

In 0.13, the get and as_(), as_int() functions been deprecated in
favour of these more general templates:

value v;
// throw unless v contains exactly the AMQP type corresponding to T
proton::get<T>(v); 

// ok if v contains any type that std::is_convertible to T.
proton::coerce<T>(v); 

What other kinds of conversions would you like to see? We could easily
add a proton::to_string() to return the printable string, I could
perhaps be convinced that the printable string for an empty value
should be "".

Thanks,
Alan.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message