From 4c79a7d7d717cf28029237de6073c65670c2d7e9 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 7 Apr 2008 21:16:48 +0000 Subject: rubygen/0-10/specification.rb - operator << for generated types. - src/tests/amqp_0_10/serialize.cpp src/qpid/BoundedIterator.h, .cpp - removed unused file git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@645699 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/rubygen/0-10/specification.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'cpp/rubygen') diff --git a/cpp/rubygen/0-10/specification.rb b/cpp/rubygen/0-10/specification.rb index 549a51fba0..83a7da07a2 100755 --- a/cpp/rubygen/0-10/specification.rb +++ b/cpp/rubygen/0-10/specification.rb @@ -86,9 +86,10 @@ class Specification < CppGen end genl scope("std::ostream& operator << (std::ostream& o, const #{x.classname}&#{"x" unless x.fields.empty?}) {") { - genl "return o << \"[#{x.fqname}\";"; + genl "o << \"[#{x.fqname}\";"; x.fields.each{ |f| genl "o << \" #{f.name}=\" << x.#{f.cppname};" } genl "o << \"];\";" + genl "return o;" } end @@ -158,7 +159,7 @@ class Specification < CppGen # Structs that must be generated early because # they are used by other definitions: each_class_ns { |c| - c.collect_all(AmqpStruct).each { |s| struct_h s if pregenerate? s } + c.collect_all(AmqpStruct).each { |s| struct_h s if pregenerate? s } } # Now dependent domains/structs and actions each_class_ns { |c| @@ -272,7 +273,11 @@ class Specification < CppGen genl "template #{name}(const T& t) : #{holder_base}(t) {}" genl "using #{holder_base}::operator=;" genl "void set(uint8_t classCode, uint8_t code);" - }}} + } + genl + genl "std::ostream& operator<<(std::ostream& o, const #{name}& h);" + } + } cpp_file("#{@dir}/#{name}") { include "#{@dir}/#{name}" @@ -286,7 +291,11 @@ class Specification < CppGen genl "case 0x#{s.full_code.to_s(16)}: *this=in_place<#{s.fqclassname}>(); break;" } genl "default: assert(0);" - }}}} + }} + genl + genl "std::ostream& operator<<(std::ostream& o, const #{name}& h) { return h.get() ? (o << *h.get()) : (o << \"\"); }" + } + } end def gen_visitable(base, subs) -- cgit v1.2.1