summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings/qmf/ruby
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2010-03-30 20:09:59 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2010-03-30 20:09:59 +0000
commitfeed6024a260189ed210f7a04049a44d2a2e9937 (patch)
tree8033c7eb7c04e90efb1d0d54e9a5b404695b4e71 /qpid/cpp/bindings/qmf/ruby
parent7b39205d3938dcdf87e78d99caa7d69f02212bf8 (diff)
downloadqpid-python-feed6024a260189ed210f7a04049a44d2a2e9937.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@929244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings/qmf/ruby')
-rw-r--r--qpid/cpp/bindings/qmf/ruby/qmf.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/qpid/cpp/bindings/qmf/ruby/qmf.rb b/qpid/cpp/bindings/qmf/ruby/qmf.rb
index ce824b3605..823cf9bf93 100644
--- a/qpid/cpp/bindings/qmf/ruby/qmf.rb
+++ b/qpid/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