summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-08-27 20:39:35 +0000
committerAlan Conway <aconway@apache.org>2007-08-27 20:39:35 +0000
commitd3b238b5909fda83f4e2ff8c7fb3de72edbf797f (patch)
treed6fff3b1a14cdf2da4d17e802b9deffe36ad9d26 /qpid/cpp/rubygen
parentc6ccebe9c53c539324fdb8d16a8bdfeb9285979f (diff)
downloadqpid-python-d3b238b5909fda83f4e2ff8c7fb3de72edbf797f.tar.gz
* src/qpid/framing/FrameDefaultVisitor.h:
A visitor for all concrete frame body types. * src/qpid/broker/SessionState.h: 3 states - closed, active, suspended. * src/qpid/broker/SessionAdapter.h, .cpp: Session handler, implements session class commands. In progres.. * rubygen/templates/MethodBodyDefaultVisitor.rb: A visitor for all method body types. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@570236 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen')
-rwxr-xr-xqpid/cpp/rubygen/cppgen.rb6
-rwxr-xr-xqpid/cpp/rubygen/templates/MethodBodyDefaultVisitor.rb34
2 files changed, 40 insertions, 0 deletions
diff --git a/qpid/cpp/rubygen/cppgen.rb b/qpid/cpp/rubygen/cppgen.rb
index d72731075f..0063231e84 100755
--- a/qpid/cpp/rubygen/cppgen.rb
+++ b/qpid/cpp/rubygen/cppgen.rb
@@ -221,5 +221,11 @@ class CppGen < Generator
def public() outdent { genl "public:" } end
def private() outdent { genl "private:" } end
def protected() outdent { genl "protected:" } end
+
+ # Returns [namespace, classname, filename]
+ def parse_classname(full_cname)
+ names=full_cname.split("::")
+ return names[0..-2].join('::'), names[-1], names.join("/")
+ end
end
diff --git a/qpid/cpp/rubygen/templates/MethodBodyDefaultVisitor.rb b/qpid/cpp/rubygen/templates/MethodBodyDefaultVisitor.rb
new file mode 100755
index 0000000000..2247c4d8a1
--- /dev/null
+++ b/qpid/cpp/rubygen/templates/MethodBodyDefaultVisitor.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+$: << ".." # Include .. in load path
+require 'cppgen'
+
+class MethodBodyDefaultVisitorGen < CppGen
+
+ def initialize(outdir, amqp)
+ super(outdir, amqp)
+ @namespace, @classname, @filename = parse_classname("qpid::framing::MethodBodyDefaultVisitor")
+ end
+
+ def generate()
+ h_file(@filename) {
+ include "qpid/framing/MethodBodyConstVisitor"
+ namespace(@namespace) {
+ genl
+ cpp_class(@classname, "public MethodBodyConstVisitor") {
+ genl "public:"
+ genl "virtual void defaultVisit() = 0;"
+ @amqp.methods_.each { |m|
+ genl "virtual void visit(const #{m.body_name}&);" }
+ }}}
+
+ cpp_file(@filename) {
+ include(@filename)
+ namespace(@namespace) {
+ @amqp.methods_.each { |m|
+ genl "void #{@classname}::visit(const #{m.body_name}&) { defaultVisit(); }"
+ }}}
+ end
+end
+
+MethodBodyDefaultVisitorGen.new(Outdir, Amqp).generate();
+