new model for C++/Lua error exception-safe separation - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/agg-parse-trans.h
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2010年12月02日 10:21:15 +0100
committerfrancesco-ST <francesco.abbate@st.com>2010年12月02日 10:21:15 +0100
commit1002c98152dc3dabad7b251103d60a587f7aa5b1 (patch)
treef4710447b154d4244ac861e70c3dce5917f6e2f8 /agg-plot/agg-parse-trans.h
parent9a2e6443e486a5b417c7e0bfbcfef15ac9e0b6d8 (diff)
downloadgsl-shell-1002c98152dc3dabad7b251103d60a587f7aa5b1.tar.gz
new model for C++/Lua error exception-safe separationgsl-shell-1.0
Now all the exceptions are trapped in pure C++ functions and a status code is returned by reference to indicate success or give an error message. The C function that instruments Lua interface can call lua_error but is not supposed to catch exceptions and does not allocate auto class instance that need non-trivial destructors.
Diffstat (limited to 'agg-plot/agg-parse-trans.h')
-rw-r--r--agg-plot/agg-parse-trans.h 10
1 files changed, 7 insertions, 3 deletions
diff --git a/agg-plot/agg-parse-trans.h b/agg-plot/agg-parse-trans.h
index 4b0fc3ba..cd5848f9 100644
--- a/agg-plot/agg-parse-trans.h
+++ b/agg-plot/agg-parse-trans.h
@@ -5,12 +5,13 @@ extern "C" {
#include "lua.h"
}
-#include "agg_color_rgba.h"
+#include <exception>
#include "scalable.h"
#include "drawable.h"
+#include "agg_color_rgba.h"
-class agg_spec_error {
+class agg_spec_error : public std::exception {
public:
enum err_e {
invalid_tag = 0,
@@ -22,7 +23,10 @@ public:
agg_spec_error(enum err_e err) : m_code(err) {};
agg_spec_error() : m_code(generic_error) {};
- const char * message() const { return m_msg[(int) m_code]; };
+ virtual const char* what() const throw()
+ {
+ return m_msg[(int) m_code];
+ }
private:
err_e m_code;
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月16日 15:58:20 +0000

AltStyle によって変換されたページ (->オリジナル) /