summaryrefslogtreecommitdiff
path: root/cpp/rubygen/templates
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-02-22 23:13:43 +0000
committerAlan Conway <aconway@apache.org>2008-02-22 23:13:43 +0000
commit60434be9f8c48d05d1f7c1d406f93142d8c1dc44 (patch)
tree3a2cbcdc76b3414d6e775b85100ba5a5764e162e /cpp/rubygen/templates
parent0375ee9a77888a4901dcb093af1683c953cfcb37 (diff)
downloadqpid-python-60434be9f8c48d05d1f7c1d406f93142d8c1dc44.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/qpid@630353 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/templates')
-rwxr-xr-xcpp/rubygen/templates/amqp_0_10.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/cpp/rubygen/templates/amqp_0_10.rb b/cpp/rubygen/templates/amqp_0_10.rb
new file mode 100755
index 0000000000..ef779c9015
--- /dev/null
+++ b/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();
+