diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-12-30 06:06:51 -0800 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-12-30 06:06:51 -0800 |
commit | 678fb09044c87a2f4bf843bb55eb4b057f1c131a (patch) | |
tree | 31d23b285b4215a1a563b6338e2ac086e07f6736 /include | |
parent | 00be9c5573d6858c89e2f305b4504b0a477ff230 (diff) |
exceptions thrown in PHP code can now be caugth and processed by C++ code
Diffstat (limited to 'include')
-rw-r--r-- | include/origexception.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/include/origexception.h b/include/origexception.h new file mode 100644 index 0000000..bce0945 --- /dev/null +++ b/include/origexception.h @@ -0,0 +1,63 @@ +/** + * 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(); + + /** + * Restore the exception - because the exception was not handled by C++ code + * @internal + */ + void restore(); +}; + +/** + * End of namespace + */ +} + |