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 | b7b4a5407af61099567b8f1b3765cfada6150312 (patch) | |
| tree | 84b36342792406d239c78b1fa040e9d3752a36c5 /qpid/cpp/rubygen/templates/structs.rb | |
| parent | 6dacede976a8c5145ebc8bb74622403b5d8de204 (diff) | |
| download | qpid-python-b7b4a5407af61099567b8f1b3765cfada6150312.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@570538 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/templates/structs.rb')
| -rw-r--r-- | qpid/cpp/rubygen/templates/structs.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qpid/cpp/rubygen/templates/structs.rb b/qpid/cpp/rubygen/templates/structs.rb index c92f71c777..2543c43717 100644 --- a/qpid/cpp/rubygen/templates/structs.rb +++ b/qpid/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) |
