summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/framing.0-10/constants.rb
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-05-09 18:46:17 +0000
committerAlan Conway <aconway@apache.org>2008-05-09 18:46:17 +0000
commit3eedb6bffa26b6beed6776277f70479d91a31ca0 (patch)
tree3a44e1fdf4ebda35fe37148e05437715b3739750 /qpid/cpp/rubygen/framing.0-10/constants.rb
parenta91fe82ffdb32f0db050c8c071379281295e5ca8 (diff)
downloadqpid-python-3eedb6bffa26b6beed6776277f70479d91a31ca0.tar.gz
Support for 0-10 sessions, not yet integrated. Misc minor fixes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@654913 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/framing.0-10/constants.rb')
-rwxr-xr-xqpid/cpp/rubygen/framing.0-10/constants.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/qpid/cpp/rubygen/framing.0-10/constants.rb b/qpid/cpp/rubygen/framing.0-10/constants.rb
index 35067a733c..752f50b6e9 100755
--- a/qpid/cpp/rubygen/framing.0-10/constants.rb
+++ b/qpid/cpp/rubygen/framing.0-10/constants.rb
@@ -48,7 +48,8 @@ class ConstantsGen < CppGen
genl
doxygen_comment { genl c.doc }
struct(c.name.caps+"Exception", base) {
- genl "#{c.name.caps}Exception(const std::string& msg=std::string()) : #{base}(#{c.value}, \"#{c.name}: \"+msg) {}"
+ genl "std::string getPrefix() const { return \"#{c.name}\"; }"
+ genl "#{c.name.caps}Exception(const std::string& msg=std::string()) : #{base}(#{c.value}, \"\"+msg) {}"
}
end
@@ -60,12 +61,14 @@ class ConstantsGen < CppGen
def reply_exceptions_h()
h_file("#{@dir}/reply_exceptions") {
include "qpid/Exception"
+ include "qpid/ExceptionHolder"
namespace(@namespace) {
define_exceptions_for("execution", "error-code", "SessionException")
define_exceptions_for("connection", "close-code", "ConnectionException")
define_exceptions_for("session", "detach-code", "ChannelException")
genl
genl "void throwExecutionException(int code, const std::string& text);"
+ genl "void setExecutionException(ExceptionHolder& holder, int code, const std::string& text);"
}
}
end
@@ -74,14 +77,21 @@ class ConstantsGen < CppGen
cpp_file("#{@dir}/reply_exceptions") {
include "#{@dir}/reply_exceptions"
include "<sstream>"
+ include "<assert.h>"
namespace("qpid::framing") {
scope("void throwExecutionException(int code, const std::string& text) {"){
+ genl "ExceptionHolder h;"
+ genl "setExecutionException(h, code, text);"
+ genl "h.raise();"
+ }
+ scope("void setExecutionException(ExceptionHolder& holder, int code, const std::string& text) {"){
scope("switch (code) {") {
enum = @amqp.class_("execution").domain("error-code").enum
enum.choices.each { |c|
- genl "case #{c.value}: throw #{c.name.caps}Exception(text);"
+ genl "case #{c.value}: holder = new #{c.name.caps}Exception(text); break;"
}
- genl "default: break;"
+ genl 'default: assert(0);'
+ genl ' holder = new InvalidArgumentException(QPID_MSG("Bad exception code: " << code << ": " << text));'
}
}
}