summaryrefslogtreecommitdiff
path: root/src/origexception.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/origexception.h')
-rw-r--r--src/origexception.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/origexception.h b/src/origexception.h
new file mode 100644
index 0000000..ca59e7f
--- /dev/null
+++ b/src/origexception.h
@@ -0,0 +1,62 @@
+/**
+ * OrigException.h
+ *
+ * Class that wraps around an exception that was thrown by PHP code,
+ * and that could - but not necessarily has to - be caught by C++
+ *
+ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ * @copyright 2013 Copernica BV
+ */
+
+/**
+ * Set up namespace
+ */
+namespace Php {
+
+/**
+ * Class definition
+ */
+class OrigException : public Value, public Exception
+{
+private:
+ /**
+ * Has the exception been restored by the C++ code so that it can be dealt by PHP?
+ * @var boolean
+ */
+ bool _restored;
+
+public:
+ /**
+ * Constructor
+ * @param zval
+ */
+ OrigException(struct _zval_struct *zval);
+
+ /**
+ * Copy constructor
+ * @param exception
+ */
+ OrigException(const OrigException &exception);
+
+ /**
+ * Move constructor
+ * @param exception
+ */
+ OrigException(OrigException &&exception);
+
+ /**
+ * Destructor
+ */
+ virtual ~OrigException() throw();
+
+ /**
+ * Restore the exception - because the exception was not handled by C++ code
+ * @internal
+ */
+ void restore();
+};
+
+/**
+ * End of namespace
+ */
+}