diff options
| author | Gordon Sim <gsim@apache.org> | 2010-01-15 15:17:01 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2010-01-15 15:17:01 +0000 |
| commit | 8e1f647a10024492e09a689e61128eb5f42c561e (patch) | |
| tree | 139169bc5eab35ab62d9c30f8009f4565603a50a /cpp/src/qpid/client | |
| parent | 8455ba0b116208f47ce238b384d4af274fa0edb6 (diff) | |
| download | qpid-python-8e1f647a10024492e09a689e61128eb5f42c561e.tar.gz | |
QPID-2323: add a Uuid type and allow it as the value of a Variant.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@899657 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
| -rw-r--r-- | cpp/src/qpid/client/amqp0_10/Codecs.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/Codecs.cpp b/cpp/src/qpid/client/amqp0_10/Codecs.cpp index ff72dfbf4e..835d80185a 100644 --- a/cpp/src/qpid/client/amqp0_10/Codecs.cpp +++ b/cpp/src/qpid/client/amqp0_10/Codecs.cpp @@ -112,6 +112,13 @@ void setEncodingFor(Variant& out, uint8_t code) } } +qpid::messaging::Uuid getUuid(FieldValue& value) +{ + unsigned char data[16]; + value.getFixedWidthValue<16>(data); + return qpid::messaging::Uuid(data); +} + Variant toVariant(boost::shared_ptr<FieldValue> in) { Variant out; @@ -123,19 +130,21 @@ Variant toVariant(boost::shared_ptr<FieldValue> in) case 0x03: out = in->getIntegerValue<uint8_t, 1>(); break; case 0x04: break; //TODO: iso-8859-15 char case 0x08: out = in->getIntegerValue<bool, 1>(); break; - case 0x010: out.setEncoding(amqp0_10_binary); - case 0x011: out = in->getIntegerValue<int16_t, 2>(); break; - case 0x012: out = in->getIntegerValue<uint16_t, 2>(); break; - case 0x020: out.setEncoding(amqp0_10_binary); - case 0x021: out = in->getIntegerValue<int32_t, 4>(); break; - case 0x022: out = in->getIntegerValue<uint32_t, 4>(); break; - case 0x023: out = in->get<float>(); break; - case 0x027: break; //TODO: utf-32 char - case 0x030: out.setEncoding(amqp0_10_binary); - case 0x031: out = in->getIntegerValue<int64_t, 8>(); break; - case 0x038: out.setEncoding(amqp0_10_datetime); //treat datetime as uint64_t, but set encoding - case 0x032: out = in->getIntegerValue<uint64_t, 8>(); break; - case 0x033:out = in->get<double>(); break; + case 0x10: out.setEncoding(amqp0_10_binary); + case 0x11: out = in->getIntegerValue<int16_t, 2>(); break; + case 0x12: out = in->getIntegerValue<uint16_t, 2>(); break; + case 0x20: out.setEncoding(amqp0_10_binary); + case 0x21: out = in->getIntegerValue<int32_t, 4>(); break; + case 0x22: out = in->getIntegerValue<uint32_t, 4>(); break; + case 0x23: out = in->get<float>(); break; + case 0x27: break; //TODO: utf-32 char + case 0x30: out.setEncoding(amqp0_10_binary); + case 0x31: out = in->getIntegerValue<int64_t, 8>(); break; + case 0x38: out.setEncoding(amqp0_10_datetime); //treat datetime as uint64_t, but set encoding + case 0x32: out = in->getIntegerValue<uint64_t, 8>(); break; + case 0x33: out = in->get<double>(); break; + + case 0x48: out = getUuid(*in); break; //TODO: figure out whether and how to map values with codes 0x40-0xd8 @@ -197,12 +206,11 @@ boost::shared_ptr<FieldValue> toFieldValue(const Variant& in) case VAR_DOUBLE: out = boost::shared_ptr<FieldValue>(new DoubleValue(in.asDouble())); break; //TODO: check encoding (and length?) when deciding what AMQP type to treat string as case VAR_STRING: out = boost::shared_ptr<FieldValue>(new Str16Value(in.asString())); break; + case VAR_UUID: out = boost::shared_ptr<FieldValue>(new UuidValue(in.asUuid().data())); break; case VAR_MAP: - //out = boost::shared_ptr<FieldValue>(toFieldValueCollection<FieldTableValue>(in.asMap(), &toFieldTableEntry)); out = boost::shared_ptr<FieldValue>(toFieldTableValue(in.asMap())); break; case VAR_LIST: - //out = boost::shared_ptr<FieldValue>(toFieldValueCollection<ListValue>(in.asList(), &toFieldValue)); out = boost::shared_ptr<FieldValue>(toListValue(in.asList())); break; } |
