From da4710512865e6816585ac4ab8edab2fa125e2d8 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sun, 6 Apr 2014 21:18:45 +0200 Subject: the exception.h header file no longer depends on the zend engine header files. TSRM macros are no longer used in any of the public PHPCPP header files so there is no more need for the phpcpp/config.h header file nor the config-create script --- include/exception.h | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'include/exception.h') diff --git a/include/exception.h b/include/exception.h index dd38035..671df9e 100644 --- a/include/exception.h +++ b/include/exception.h @@ -30,42 +30,51 @@ private: */ int _code; + /** + * Has this exception been processed by native C++ code? + * @var bool + */ + bool _processed = false; + public: /** * Constructor * @param &string */ - Exception(const std::string &message, int code = 0) : std::exception(), _message(message), _code(code) - { - } + Exception(const std::string &message, int code = 0) : std::exception(), _message(message), _code(code) {} /** * Destructor */ - virtual ~Exception() throw() + virtual ~Exception() throw() {} + + /** + * Overridden what method + * @return const char * + */ + virtual const char *what() const noexcept override { + return _message.c_str(); } /** * Returns the message of the exception. * @return &string */ - std::string &message() throw() + const std::string &message() const throw() { return _message; } /** - * Process the exception - * - * This method is called only from within the PHP-CPP library, - * and will turn the exception into a PHP exception - * - * @param tsrm_ls - * - * @internal + * Is this a native exception (one that was thrown from C++ code) + * @return bool */ - virtual void process(TSRMLS_D); + virtual bool native() const + { + // yes, it is native + return true; + } }; /** -- cgit v1.2.3