summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/0-10/exceptions.rb
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-04-03 19:57:14 +0000
committerAlan Conway <aconway@apache.org>2008-04-03 19:57:14 +0000
commitb1cc93b489819453f07a84f149f0ba44ab6481bc (patch)
treebb7b9c8e51273a3d9a7b18362098a352121b7091 /qpid/cpp/rubygen/0-10/exceptions.rb
parentcb076892e53f1634d60fe31bca9e0438054bf419 (diff)
downloadqpid-python-b1cc93b489819453f07a84f149f0ba44ab6481bc.tar.gz
rubygen/0-10/exceptions.rb:
- generate exception classes for each error code, e.g. InvalidArgumentException rubygen/0-10/specification.rb - extracted specification_fwd.h from specification.h, contains consts enums, typedefs and forward declarations of classes. src/qpid/amqp_0_10/Map.cpp, src/qpid/broker/SessionAdapter.cpp: - updated to use exceptions.h git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@644461 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/0-10/exceptions.rb')
-rwxr-xr-xqpid/cpp/rubygen/0-10/exceptions.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/qpid/cpp/rubygen/0-10/exceptions.rb b/qpid/cpp/rubygen/0-10/exceptions.rb
new file mode 100755
index 0000000000..4f7080690f
--- /dev/null
+++ b/qpid/cpp/rubygen/0-10/exceptions.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+$: << ".." # Include .. in load path
+require 'cppgen'
+
+class GenExceptions < CppGen
+
+ def initialize(outdir, amqp)
+ super(outdir, amqp)
+ @ns="qpid::amqp_#{@amqp.version.bars}"
+ @dir="qpid/amqp_#{@amqp.version.bars}"
+ end
+
+ def gen_exceptions()
+ h_file("#{@dir}/exceptions") {
+ include "qpid/Exception"
+ include "specification.h"
+ namespace("#{@ns}") {
+ @amqp.class_("execution").domain("error-code").enum.choices.each { |c|
+ name=c.name.typename+"Exception"
+ struct(name, "public SessionException") {
+ genl "#{name}(const std::string& msg=std::string()) : SessionException(execution::#{c.name.shout}, msg) {}"
+ }
+ }
+ }
+ }
+ end
+
+ def generate()
+ gen_exceptions
+ end
+end
+
+GenExceptions.new($outdir, $amqp).generate();
+
+