diff options
| author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-03-30 20:09:59 +0000 |
|---|---|---|
| committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-03-30 20:09:59 +0000 |
| commit | cfe6bb5fbde532d57e8cb8b6c1e338b00e58034b (patch) | |
| tree | 440140ada63fa6eedfb435749a7b9be3a7b1f281 /cpp/bindings/qmf/ruby | |
| parent | e87e7af34a950629ccdbfefda73789b23ea9c0ff (diff) | |
| download | qpid-python-cfe6bb5fbde532d57e8cb8b6c1e338b00e58034b.tar.gz | |
add support for QMF TYPE_LIST in engine, ruby and python wrappers
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@929244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qmf/ruby')
| -rw-r--r-- | cpp/bindings/qmf/ruby/qmf.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/cpp/bindings/qmf/ruby/qmf.rb b/cpp/bindings/qmf/ruby/qmf.rb index ce824b3605..823cf9bf93 100644 --- a/cpp/bindings/qmf/ruby/qmf.rb +++ b/cpp/bindings/qmf/ruby/qmf.rb @@ -48,8 +48,8 @@ module Qmf when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.asInt when TYPE_INT64 then val.asInt64 when TYPE_MAP then value_to_dict(val) + when TYPE_LIST then value_to_list(val) when TYPE_OBJECT - when TYPE_LIST when TYPE_ARRAY end end @@ -77,8 +77,8 @@ module Qmf when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.setInt(value) when TYPE_INT64 then val.setInt64(value) when TYPE_MAP then dict_to_value(val, value) + when TYPE_LIST then list_to_value(val, value) when TYPE_OBJECT - when TYPE_LIST when TYPE_ARRAY end return val @@ -112,6 +112,7 @@ module Qmf return TYPE_BOOL if value.class == NilClass return TYPE_MAP if value.class == Hash + return TYPE_LIST if value.class == Array raise ArgumentError, "QMF type not known for native type #{value.class}" end @@ -134,6 +135,23 @@ module Qmf val.insert(key, native_to_qmf(typecode, value)) end end + + def value_to_list(val) + # Assume val is of type Qmfengine::Value + raise ArgumentError, "value_to_dict must be given a map value" if !val.isList + list = [] + for i in 0...val.listItemCount + list.push(qmf_to_native(val.listItem(i))) + end + return list + end + + def list_to_value(val, list) + list.each do |value| + typecode = pick_qmf_type(value) + val.appendToList(native_to_qmf(typecode, value)) + end + end end $util = Util.new |
