From 9649f8ccca2a9f62a946bd58e7d3e8cb60031232 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 31 Mar 2008 17:20:08 +0000 Subject: Updated xml fragment to reflect correct types for connection.start.mechanisms, connection.start.locales and connection.open.capabilities Updated connection handler in line with above changes Added Str16Value to FieldValues Allow Array instances of different types to be created git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@643067 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/framing/Array.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cpp/src/qpid/framing/Array.cpp') diff --git a/cpp/src/qpid/framing/Array.cpp b/cpp/src/qpid/framing/Array.cpp index 1215c8a28b..d2ab354dab 100644 --- a/cpp/src/qpid/framing/Array.cpp +++ b/cpp/src/qpid/framing/Array.cpp @@ -30,6 +30,8 @@ namespace framing { Array::Array() : typeOctet(0xF0/*void*/) {} +Array::Array(uint8_t type) : typeOctet(type) {} + Array::Array(const std::vector& in) { typeOctet = 0xA4; @@ -39,6 +41,7 @@ Array::Array(const std::vector& in) } } + uint32_t Array::size() const { //note: size is only included when used as a 'top level' type uint32_t len(4/*size*/ + 1/*type*/ + 4/*count*/); @@ -109,6 +112,14 @@ bool Array::operator==(const Array& x) const { return true; } +void Array::add(ValuePtr value) +{ + if (typeOctet != value->getType()) { + throw SyntaxErrorException(QPID_MSG("Wrong type of value, expected " << typeOctet)); + } + values.push_back(value); +} + } } -- cgit v1.2.1