diff options
author | Gordon Sim <gsim@apache.org> | 2010-03-18 18:37:28 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-03-18 18:37:28 +0000 |
commit | 53df223b3e2d08aed1bb70649c1f0269e0639f84 (patch) | |
tree | 3b6cb3d0b2a1ec005412d6ce4030fe1e738bf945 /cpp/src/qpid/messaging/Variant.cpp | |
parent | 615cde45bd6415a6b562aeb6b2954c20c48aaed5 (diff) | |
download | qpid-python-53df223b3e2d08aed1bb70649c1f0269e0639f84.tar.gz |
QPID-2452: Fixed control over the encoding used when sending a string valued variant. The user is currently responsible for correctly setting any encoding (e.g. utf8). If none is specified it will be transfered as an amqp0-10 vbin. Fixed bug preventing correct assignment of encoding in variants.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@924939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/messaging/Variant.cpp')
-rw-r--r-- | cpp/src/qpid/messaging/Variant.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp/src/qpid/messaging/Variant.cpp b/cpp/src/qpid/messaging/Variant.cpp index ba93f160ec..2567b7508b 100644 --- a/cpp/src/qpid/messaging/Variant.cpp +++ b/cpp/src/qpid/messaging/Variant.cpp @@ -20,6 +20,7 @@ */ #include "qpid/messaging/Variant.h" #include "qpid/Msg.h" +#include "qpid/log/Statement.h" #include <boost/format.hpp> #include <boost/lexical_cast.hpp> #include <algorithm> @@ -50,7 +51,7 @@ class VariantImpl VariantImpl(int64_t); VariantImpl(float); VariantImpl(double); - VariantImpl(const std::string&); + VariantImpl(const std::string&, const std::string& encoding=std::string()); VariantImpl(const Variant::Map&); VariantImpl(const Variant::List&); VariantImpl(const Uuid&); @@ -130,7 +131,8 @@ VariantImpl::VariantImpl(int32_t i) : type(VAR_INT32) { value.i32 = i; } VariantImpl::VariantImpl(int64_t i) : type(VAR_INT64) { value.i64 = i; } VariantImpl::VariantImpl(float f) : type(VAR_FLOAT) { value.f = f; } VariantImpl::VariantImpl(double d) : type(VAR_DOUBLE) { value.d = d; } -VariantImpl::VariantImpl(const std::string& s) : type(VAR_STRING) { value.v = new std::string(s); } +VariantImpl::VariantImpl(const std::string& s, const std::string& e) + : type(VAR_STRING), encoding(e) { value.v = new std::string(s); } VariantImpl::VariantImpl(const Variant::Map& m) : type(VAR_MAP) { value.v = new Variant::Map(m); } VariantImpl::VariantImpl(const Variant::List& l) : type(VAR_LIST) { value.v = new Variant::List(l); } VariantImpl::VariantImpl(const Uuid& u) : type(VAR_UUID) { value.v = new Uuid(u); } @@ -448,7 +450,7 @@ VariantImpl* VariantImpl::create(const Variant& v) case VAR_INT64: return new VariantImpl(v.asInt64()); case VAR_FLOAT: return new VariantImpl(v.asFloat()); case VAR_DOUBLE: return new VariantImpl(v.asDouble()); - case VAR_STRING: return new VariantImpl(v.asString()); + case VAR_STRING: return new VariantImpl(v.asString(), v.getEncoding()); case VAR_MAP: return new VariantImpl(v.asMap()); case VAR_LIST: return new VariantImpl(v.asList()); case VAR_UUID: return new VariantImpl(v.asUuid()); |