summaryrefslogtreecommitdiff
path: root/cpp/rubygen
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-04-07 21:16:48 +0000
committerAlan Conway <aconway@apache.org>2008-04-07 21:16:48 +0000
commit4c79a7d7d717cf28029237de6073c65670c2d7e9 (patch)
treeeaa98213ff44e9d76f4826c1fd02d1c439ca13da /cpp/rubygen
parentb85ed9344b09b1db318ced3ac7026f6211974292 (diff)
downloadqpid-python-4c79a7d7d717cf28029237de6073c65670c2d7e9.tar.gz
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
Diffstat (limited to 'cpp/rubygen')
-rwxr-xr-xcpp/rubygen/0-10/specification.rb17
1 files changed, 13 insertions, 4 deletions
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 <class T> #{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 << \"<empty #{name}>\"); }"
+ }
+ }
end
def gen_visitable(base, subs)