summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/FieldValue.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-11-04 19:52:49 +0000
committerAlan Conway <aconway@apache.org>2008-11-04 19:52:49 +0000
commiteda249ff22edb3726243da81ff48c82e4d88e872 (patch)
tree0939d790e6a1b0d86993c9c3804c1adaa369aeb8 /cpp/src/qpid/framing/FieldValue.cpp
parent5d2471636928eff8b8031237c54348db0d5c388d (diff)
downloadqpid-python-eda249ff22edb3726243da81ff48c82e4d88e872.tar.gz
constants.rb: generate type code constants for AMQP types. Useful with Array.
framing/Array: - added some std:::vector like functions & typedefs. - use TypeCode enums, human readable ostream << operator. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@711365 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/FieldValue.cpp')
-rw-r--r--cpp/src/qpid/framing/FieldValue.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/qpid/framing/FieldValue.cpp b/cpp/src/qpid/framing/FieldValue.cpp
index 9107ceeeea..ecf469236d 100644
--- a/cpp/src/qpid/framing/FieldValue.cpp
+++ b/cpp/src/qpid/framing/FieldValue.cpp
@@ -109,10 +109,10 @@ bool FieldValue::operator==(const FieldValue& v) const
*data == *v.data;
}
-StringValue::StringValue(const std::string& v) :
+Str8Value::Str8Value(const std::string& v) :
FieldValue(
- 0xA4,
- new VariableWidthValue<4>(
+ TYPE_CODE_STR8,
+ new VariableWidthValue<1>(
reinterpret_cast<const uint8_t*>(v.data()),
reinterpret_cast<const uint8_t*>(v.data()+v.size())))
{
@@ -168,4 +168,13 @@ ArrayValue::ArrayValue(const Array& a) : FieldValue(0xaa, new EncodedValue<Array
{
}
+void FieldValue::print(std::ostream& out) const {
+ data->print(out);
+ out << TypeCode(typeOctet) << '(';
+ if (data->convertsToString()) out << data->getString();
+ else if (data->convertsToInt()) out << data->getInt();
+ else data->print(out);
+ out << ')';
+}
+
}}