diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-30 07:47:55 -0700 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-30 07:47:55 -0700 |
commit | c2343400688366e567f67e89a50d573786f98bec (patch) | |
tree | ca130b093bb72748f3c3f53e25968320ed828f7c /include/extension.h | |
parent | 49faa66adb7870d9e20596d2ae7c41c9638045e3 (diff) |
Further work in progress (that breaks everything)
Diffstat (limited to 'include/extension.h')
-rw-r--r-- | include/extension.h | 98 |
1 files changed, 33 insertions, 65 deletions
diff --git a/include/extension.h b/include/extension.h index 701da86..daff45e 100644 --- a/include/extension.h +++ b/include/extension.h @@ -11,14 +11,13 @@ * as module in a webserver) many requests are handled by the same extension * instance. * + * This is a template class. You need to pass in the type of an object + * that you use for storing request specific state information. + * * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> * @copyright 2013 Copernica BV */ - -/** - * Forward declarations - */ -struct _zend_module_entry; +#include <php5/Zend/zend_modules.h> /** * Set up namespace @@ -26,28 +25,29 @@ struct _zend_module_entry; namespace PhpCpp { /** - * Forward definitions - */ -class Functions; - -/** * Class definition */ class Extension { public: /** - * Extension that defines a number of functions right away + * Constructor that defines a number of functions right away * @param name Extension name * @param version Extension version string * @param functions The functions that are defined */ - Extension(const char *name, const char *version, const std::initializer_list<Function> &functions = {}); + Extension(const char *name, const char *version, const Functions &functions); + + /** + * No copy'ing and no moving + */ + Extension(const Extension &extension) = delete; + Extension(Extension &&extension) = delete; /** * Destructor */ - virtual ~Extension(); + virtual ~Extension() {} /** * Initialize the extension. @@ -105,14 +105,14 @@ public: */ bool startRequest() { - // failure if we already have a request - if (_request) return false; - - // create the request - _request = request(); - - // and initialize it - return _request->initialize(); +// // failure if we already have a request +// if (_request) return false; +// +// // create the request +// _request = request(); +// +// // and initialize it +// return _request->initialize(); } /** @@ -125,57 +125,25 @@ public: */ bool endRequest() { - // request must exist - if (!_request) return false; - - // finalize the request - bool result = _request->finalize(); - - // destruct the request object - delete _request; - - // done - return result; +// // request must exist +// if (!_request) return false; +// +// // finalize the request +// bool result = _request->finalize(); +// +// // destruct the request object +// delete _request; +// +// // done +// return result; } - /** - * Internal method to get access to the entry - * @return zend_module_entry - * @internal - */ - _zend_module_entry *entry(); - private: /** - * Extension name - * @var char* - */ - const char *_name; - - /** - * Extension version - * @var char* - */ - const char *_version; - - /** - * The functions that are defined - * @var vector - */ - Functions *_functions; - - /** * The information that is passed to the Zend engine * @var zend_module_entry */ - _zend_module_entry *_entry = NULL; - - /** - * The current request being processed - * @var Request - */ - Request *_request = NULL; - + zend_module_entry _entry; }; |