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月01日 18:02:37 +0100
committerfrancesco-ST <francesco.abbate@st.com>2010年12月01日 18:02:37 +0100
commit9a2e6443e486a5b417c7e0bfbcfef15ac9e0b6d8 (patch)
tree1596af5d11196151403c4a02aadb623495e265f9 /agg-plot/agg-parse-trans.h
parent812299dcac716252de50f92dc389f6c87da0880f (diff)
downloadgsl-shell-9a2e6443e486a5b417c7e0bfbcfef15ac9e0b6d8.tar.gz
better C++/lua error handling in agg-parse-trans.cpp and lua-plot.cpp
Design change: now C++ never call lua_error directly but can throw an exception or return a value that indicate a failure in operation. This kind of function should use also auto_ptr and stack-allocated (automatic) object instance to ensure the deallocation of memory and strong exception safety. The lua_error can be allocated only by C-style function that does not need proper stack unwinding (no auto-ptr neither automatic allocated object). The rationale is that lua_error use setjmp/longjmp that will bypass C++ stack unwinding.
Diffstat (limited to 'agg-plot/agg-parse-trans.h')
-rw-r--r--agg-plot/agg-parse-trans.h 20
1 files changed, 20 insertions, 0 deletions
diff --git a/agg-plot/agg-parse-trans.h b/agg-plot/agg-parse-trans.h
index 1c76fcaf..4b0fc3ba 100644
--- a/agg-plot/agg-parse-trans.h
+++ b/agg-plot/agg-parse-trans.h
@@ -10,6 +10,26 @@ extern "C" {
#include "scalable.h"
#include "drawable.h"
+class agg_spec_error {
+public:
+ enum err_e {
+ invalid_tag = 0,
+ invalid_spec,
+ invalid_object,
+ generic_error
+ };
+
+ 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]; };
+
+private:
+ err_e m_code;
+
+ static const char *m_msg[];
+};
+
extern drawable * parse_graph_args (lua_State *L, agg::rgba8& color);
#endif
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月16日 15:11:30 +0000

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