diff options
| author | Alan Conway <aconway@apache.org> | 2008-02-22 23:13:43 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-02-22 23:13:43 +0000 |
| commit | 162cbcc4766122da3b939ed9f9b979bd726cb175 (patch) | |
| tree | 5907f23e78ef413d1fa66254c46dee283e9ddca9 /qpid/cpp/rubygen/templates | |
| parent | ad50f325f63c819de67af9ae7276aafc0238bc40 (diff) | |
| download | qpid-python-162cbcc4766122da3b939ed9f9b979bd726cb175.tar.gz | |
Fixed rubygen to skip unchanged generated files, prevents needless
rebuilding every time the code generator changes.
Start of amqp 0-10 mapping, work in progress.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@630353 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/templates')
| -rwxr-xr-x | qpid/cpp/rubygen/templates/amqp_0_10.rb | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/qpid/cpp/rubygen/templates/amqp_0_10.rb b/qpid/cpp/rubygen/templates/amqp_0_10.rb new file mode 100755 index 0000000000..ef779c9015 --- /dev/null +++ b/qpid/cpp/rubygen/templates/amqp_0_10.rb @@ -0,0 +1,64 @@ +#!/usr/bin/env ruby +$: << ".." # Include .. in load path +require 'cppgen' + +class Amqp_0_10 < CppGen + + def initialize(outdir, amqp) + super(outdir, amqp) + @namespace="qpid::amqp_0_10" + @filename="qpid/amqp_0_10" + end + + def action_h(a, base) + struct(a.cppname, "public #{base}") { + genl "static const uint8_t CODE=#{a.code};" + a.fields.each { |f| + genl "#{(f.type_.amqp2cpp)} #{f.cppname};" + } + } + end + + def action_cpp(a, base) + + end + + def gen_amqp_0_10_h + h_file("#{@filename}.h") { + namespace(@namespace) { + @amqp.classes.each { |cl| + namespace(cl.cppname) { + struct("ClassInfo") { + genl "static const uint8_t CODE=#{cl.code};" + genl "static const char* NAME;" + } + cl.commands.each { |c| action_h c, "Command"} + cl.controls.each { |c| action_h c, "Control"} + } + } + } + } + end + + def gen_amqp_0_10_cpp + cpp_file("#{@filename}.cpp") { + include @filename + + namespace(@namespace) { + @amqp.classes.each { |cl| + namespace(cl.cppname) { + genl "static const char* ClassInfo::NAME=\"#{cl.name};" + } + } + } + } + end + + def generate + gen_amqp_0_10_h + gen_amqp_0_10_cpp + end +end + +Amqp_0_10.new(Outdir, Amqp).generate(); + |
