diff options
author | Alan Conway <aconway@apache.org> | 2007-08-02 21:00:54 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-08-02 21:00:54 +0000 |
commit | cd6b4ba256effcf6c3e3f69a74e51d82c579e2ea (patch) | |
tree | f45ef849bb8d138c6e709464dc71e4cb502fa0cf /cpp/rubygen/templates | |
parent | 029c638fd23d3e53a58ca521209ae62057e59689 (diff) | |
download | qpid-python-cd6b4ba256effcf6c3e3f69a74e51d82c579e2ea.tar.gz |
Generate boost::variants for each class. Not yet used on trunk.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@562255 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/templates')
-rwxr-xr-x | cpp/rubygen/templates/ClassBodyVariant.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cpp/rubygen/templates/ClassBodyVariant.rb b/cpp/rubygen/templates/ClassBodyVariant.rb new file mode 100755 index 0000000000..a1dada40a5 --- /dev/null +++ b/cpp/rubygen/templates/ClassBodyVariant.rb @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +$: << ".." # Include .. in load path +require 'cppgen' + +class ClassBodyVariant < CppGen + + def initialize(outdir, amqp) + super(outdir, amqp) + end + + def class_body(c) + h_file (c.body_name) { + c.methods.each { |m| genl "#include \"#{m.body_name}.h\""; } + genl + genl "#include <boost/visitor.hpp>" + genl + gen "typedef boost::variant<" + indent { genl c.methods().collect { |m| m.body_name }.join(",\n") } + genl "> #{c.body_name};" + } + end + + def generate() + @amqp.classes.each{ |c| class_body c } + end +end + +ClassBodyVariant.new(Outdir, Amqp).generate(); + |