diff options
author | Gordon Sim <gsim@apache.org> | 2007-08-28 19:38:17 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2007-08-28 19:38:17 +0000 |
commit | 9e10f4ea3b2f8ab6650f635cada48e4735ca20d7 (patch) | |
tree | 26ad3b8dffa17fa665fe7a033a7c8092839df011 /cpp/rubygen/templates/structs.rb | |
parent | 6b09696b216c090b512c6af92bf7976ae3407add (diff) | |
download | qpid-python-9e10f4ea3b2f8ab6650f635cada48e4735ca20d7.tar.gz |
Updated message.transfer encoding to use header and content segments (including new structs).
Unified more between the basic and message classes messages.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@570538 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/templates/structs.rb')
-rw-r--r-- | cpp/rubygen/templates/structs.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpp/rubygen/templates/structs.rb b/cpp/rubygen/templates/structs.rb index c92f71c777..2543c43717 100644 --- a/cpp/rubygen/templates/structs.rb +++ b/cpp/rubygen/templates/structs.rb @@ -33,6 +33,16 @@ class StructGen < CppGen ValueTypes=["octet", "short", "long", "longlong", "timestamp"] + def default_initialisation(s) + params = s.fields.select {|f| ValueTypes.include?(f.domain.type_) || f.domain.type_ == "bit"} + strings = params.collect {|f| "#{f.cppname}(0)"} + if strings.empty? + return "" + else + return " : " + strings.join(", ") + end + end + def printable_form(f) if (f.cpptype.name == "u_int8_t") return "(int) " + f.cppname @@ -108,12 +118,19 @@ class StructGen < CppGen end def methodbody_extra_defs(s) + if (s.content) + content = "true" + else + content = "false" + end + gen <<EOS using AMQMethodBody::accept; void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } inline ClassId amqpClassId() const { return CLASS_ID; } inline MethodId amqpMethodId() const { return METHOD_ID; } + inline bool isContentBearing() const { return #{content}; } EOS end @@ -132,6 +149,9 @@ EOS if (s.kind_of? AmqpMethod) genl "#{name}(ProtocolVersion=ProtocolVersion()) {}" end + if (s.kind_of? AmqpStruct) + genl "#{name}() #{default_initialisation(s)} {}" + end end def define_accessors(f) |