summaryrefslogtreecommitdiff
path: root/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
commitb0f3edfa2a68ccf34aa7a555d0d37c2e17b8421b (patch)
treea94c5a579769809f4d398f4c65ad579a432b93fd /cpp/rubygen/framing.0-10/constants.rb
parent2ebccc4f3ab6e7813ac2179c8318163ffdd22cff (diff)
downloadqpid-python-b0f3edfa2a68ccf34aa7a555d0d37c2e17b8421b.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/qpid@654913 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/framing.0-10/constants.rb')
-rwxr-xr-xcpp/rubygen/framing.0-10/constants.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/cpp/rubygen/framing.0-10/constants.rb b/cpp/rubygen/framing.0-10/constants.rb
index 35067a733c..752f50b6e9 100755
--- a/cpp/rubygen/framing.0-10/constants.rb
+++ b/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));'
}
}
}