diff options
author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-09-22 12:51:10 +0000 |
---|---|---|
committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-09-22 12:51:10 +0000 |
commit | eb2f320af6e874d763fb2f2b3e81801424416cc1 (patch) | |
tree | 3630e84f77a50ddb83cbfbc0480d25280e7f5014 /cpp | |
parent | 1bdcd0996456626cb1180fb9227826f2d953cee1 (diff) | |
download | qpid-python-eb2f320af6e874d763fb2f2b3e81801424416cc1.tar.gz |
QPID-2880: allow boolean values in method call map/list arguments.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@999919 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/bindings/qmf/tests/python_console.py | 6 | ||||
-rwxr-xr-x | cpp/bindings/qmf/tests/ruby_console_test.rb | 5 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ValueImpl.cpp | 17 |
3 files changed, 21 insertions, 7 deletions
diff --git a/cpp/bindings/qmf/tests/python_console.py b/cpp/bindings/qmf/tests/python_console.py index 6ed3c04d50..1cef824fb5 100755 --- a/cpp/bindings/qmf/tests/python_console.py +++ b/cpp/bindings/qmf/tests/python_console.py @@ -281,9 +281,9 @@ class QmfInteropTests(TestBase010): 'aSigned' : -666, 'aString' : "A String", 'aFloat' : 3.1415, - 'aList' : ['x', -1, 'y', 2]} - - inList = ['aString', long(1), -1, 2.7182, {'aMap': -8}] + 'aList' : ['x', -1, 'y', 2], + 'abool' : False} + inList = ['aString', long(1), -1, 2.7182, {'aMap': -8}, True] result = parent.test_map_list(inMap, inList) self.assertEqual(result.status, 0) diff --git a/cpp/bindings/qmf/tests/ruby_console_test.rb b/cpp/bindings/qmf/tests/ruby_console_test.rb index dd495603eb..fcdf3ac54c 100755 --- a/cpp/bindings/qmf/tests/ruby_console_test.rb +++ b/cpp/bindings/qmf/tests/ruby_console_test.rb @@ -333,9 +333,10 @@ class ConsoleTest < ConsoleTestBase 'aSigned' => -666, 'aString' => "A String", 'aFloat' => 3.1415, - 'aList' => ['x', -1, 'y', 2]} + 'aList' => ['x', -1, 'y', 2], + 'abool' => false} - inList = ['aString', 1, -1, 2.7182, {'aMap'=> -8}] + inList = ['aString', 1, -1, 2.7182, {'aMap'=> -8}, true] result = parent.test_map_list(inMap, inList) assert_equal(result.status, 0) diff --git a/cpp/src/qmf/engine/ValueImpl.cpp b/cpp/src/qmf/engine/ValueImpl.cpp index c58c28e166..409bf64c35 100644 --- a/cpp/src/qmf/engine/ValueImpl.cpp +++ b/cpp/src/qmf/engine/ValueImpl.cpp @@ -21,6 +21,7 @@ #include <qpid/framing/FieldValue.h> #include <qpid/framing/FieldTable.h> #include <qpid/framing/List.h> +#include <qpid/log/Statement.h> using namespace std; using namespace qmf::engine; @@ -153,6 +154,12 @@ void ValueImpl::initMap(const FieldTable& ft) subval->impl->initList(subList); insert(name.c_str(), subval); } + } else if (amqType == 0x08) { + Value* subval(new Value(TYPE_BOOL)); + subval->setBool(fvalue.get<int>() ? true : false); + insert(name.c_str(), subval); + } else { + QPID_LOG(error, "Unable to decode unsupported AMQP typecode=" << amqType << " map index=" << name); } } } @@ -185,7 +192,7 @@ void ValueImpl::mapToFieldTable(FieldTable& ft) const ft.setInt64(name, subval.asInt64()); break; case TYPE_BOOL: - ft.setInt(name, subval.asBool() ? 1 : 0); + ft.set(name, FieldTable::ValuePtr(new BoolValue(subval.asBool()))); break; case TYPE_FLOAT: ft.setFloat(name, subval.asFloat()); @@ -274,6 +281,12 @@ void ValueImpl::initList(const List& fl) subVal->impl->initList(subList); appendToList(subVal); } + } else if (amqType == 0x08) { + Value* subval(new Value(TYPE_BOOL)); + subval->setBool(fvalue.get<int>() ? true : false); + appendToList(subval); + } else { + QPID_LOG(error, "Unable to decode unsupported AMQP typecode =" << amqType); } } } @@ -303,7 +316,7 @@ void ValueImpl::listToFramingList(List& fl) const fl.push_back(List::ValuePtr(new Integer64Value(subval.asInt64()))); break; case TYPE_BOOL: - fl.push_back(List::ValuePtr(new IntegerValue(subval.asBool() ? 1 : 0))); + fl.push_back(List::ValuePtr(new BoolValue(subval.asBool() ? 1 : 0))); break; case TYPE_FLOAT: fl.push_back(List::ValuePtr(new FloatValue(subval.asFloat()))); |