summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/templates
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-08-02 21:00:54 +0000
committerAlan Conway <aconway@apache.org>2007-08-02 21:00:54 +0000
commitc063a5a7ee8748b1d1921beb0bc435bcb9e0d924 (patch)
treecc8c9c98151a75aee98f698cc68830760c2b30a7 /qpid/cpp/rubygen/templates
parent2c11eb5a8f0c49ce86b11bab2beae24f988e851f (diff)
downloadqpid-python-c063a5a7ee8748b1d1921beb0bc435bcb9e0d924.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@562255 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/templates')
-rwxr-xr-xqpid/cpp/rubygen/templates/ClassBodyVariant.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/qpid/cpp/rubygen/templates/ClassBodyVariant.rb b/qpid/cpp/rubygen/templates/ClassBodyVariant.rb
new file mode 100755
index 0000000000..a1dada40a5
--- /dev/null
+++ b/qpid/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();
+