diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-06 21:53:24 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-06 21:53:24 +0200 |
commit | 35fd3ccbeb4def71b4d8a59dfbb5c31201b099b9 (patch) | |
tree | 915223360aed4743aa6127fde4836aa413a260e5 /zend/extension.cpp | |
parent | da4710512865e6816585ac4ab8edab2fa125e2d8 (diff) |
renamed src directory to zend directory, disabled TSRM debug code
Diffstat (limited to 'zend/extension.cpp')
-rw-r--r-- | zend/extension.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/zend/extension.cpp b/zend/extension.cpp new file mode 100644 index 0000000..9685b32 --- /dev/null +++ b/zend/extension.cpp @@ -0,0 +1,103 @@ +/** + * Extension.cpp + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2013, 2014 Copernica BV + */ +#include "includes.h" + +/** + * Set up namespace + */ +namespace Php { + +/** + * Constructor that defines a number of functions right away + * @param name Extension name + * @param version Extension version string + */ +Extension::Extension(const char *name, const char *version) : + Namespace(""), _impl(new ExtensionImpl(this, name, version)) {} + +/** + * Destructor + */ +Extension::~Extension() +{ + // get rid of the implementation object + delete _impl; +} + +/** + * Register a function to be called when the PHP engine is ready + * @param callback + * @return Extension + */ +Extension &Extension::onStartup(const Callback &callback) +{ + // pass on to the implementation + _impl->onStartup(callback); + + // allow chaining + return *this; +} + +/** + * Register a function to be called when the PHP engine is going to stop + * @param callback + * @return Extension + */ +Extension &Extension::onShutdown(const Callback &callback) +{ + // pass on to the implementation + _impl->onShutdown(callback); + + // allow chaining + return *this; +} + +/** + * Register a callback that is called at the beginning of each pageview/request + * @param callback + */ +Extension &Extension::onRequest(const Callback &callback) +{ + // pass on to the implementation + _impl->onRequest(callback); + + // allow chaining + return *this; +} + +/** + * Register a callback that is called to cleanup things after a pageview/request + * @param callback + */ +Extension &Extension::onIdle(const Callback &callback) +{ + // pass on to the implementation + _impl->onIdle(callback); + + // allow chaining + return *this; +} + +/** + * Retrieve the module pointer + * + * This is the memory address that should be exported by the get_module() + * function. + * + * @return void* + */ +void *Extension::module() +{ + // pass on to the implementation + return _impl->module(); +} + +/** + * End of namespace + */ +} + |