summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/amqpgen.rb
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2007-10-14 02:21:59 +0000
committerRafael H. Schloming <rhs@apache.org>2007-10-14 02:21:59 +0000
commite0ba5becd0052cabe0cfa997dd35d7362bf2c472 (patch)
tree5c55f1dd6be53c4032be45ba422dacca1ded197f /qpid/cpp/rubygen/amqpgen.rb
parent2a10deef36eec1b8df9ec52dfb44a72eee7059a8 (diff)
downloadqpid-python-e0ba5becd0052cabe0cfa997dd35d7362bf2c472.tar.gz
Enabled packed struct encoding in python, cpp, and java. Also fixed computation of required byte credit in Message.cpp.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@584474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/amqpgen.rb')
-rwxr-xr-xqpid/cpp/rubygen/amqpgen.rb25
1 files changed, 20 insertions, 5 deletions
diff --git a/qpid/cpp/rubygen/amqpgen.rb b/qpid/cpp/rubygen/amqpgen.rb
index 21bc05c651..5952b494df 100755
--- a/qpid/cpp/rubygen/amqpgen.rb
+++ b/qpid/cpp/rubygen/amqpgen.rb
@@ -41,10 +41,25 @@ class Module
# Add attribute reader for XML attribute.
def amqp_attr_reader(*attrs)
attrs.each { |a|
- define_method(mangle(a)) {
- @amqp_attr_reader||={ }
- @amqp_attr_reader[a] ||= xml.attributes[a.to_s]
- }
+ case a
+ when Symbol
+ define_method(mangle(a)) {
+ @amqp_attr_reader||={ }
+ @amqp_attr_reader[a] ||= xml.attributes[a.to_s]
+ }
+ when Hash
+ a.each { |attr, default|
+ define_method(mangle(attr)) {
+ @amqp_attr_reader||={ }
+ value = xml.attributes[attr.to_s]
+ if value
+ @amqp_attr_reader[attr] ||= value
+ else
+ @amqp_attr_reader[attr] ||= default
+ end
+ }
+ }
+ end
}
end
@@ -151,7 +166,7 @@ end
class AmqpStruct < AmqpElement
def initialize(xml, parent) super; end
- amqp_attr_reader :size, :type, :pack
+ amqp_attr_reader :size, :type, :pack => "short"
amqp_child_reader :field
def result?() parent.xml.name == "result"; end