diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-24 17:38:05 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-24 17:38:05 +0200 |
commit | fe3c7fdf52e4bfd6e736a54c20eb12bb5cfd1f30 (patch) | |
tree | a25dfc32c8cf6f76fdf4071c1af66e68f7ee0512 /include | |
parent | 308d4970599cc5e5f637cbd354498dd88c8eb3c2 (diff) |
initial setup for library
Diffstat (limited to 'include')
-rw-r--r-- | include/extension.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/include/extension.h b/include/extension.h new file mode 100644 index 0000000..69d5d3c --- /dev/null +++ b/include/extension.h @@ -0,0 +1,76 @@ +/** + * Extension.h + * + * The extension class is the starting point of your PHP extension. This class + * is instantiated the moment the PHP engine starts - for example when the + * apache process starts - and will be used for all subsequent requests that + * are handled by Apache. + * + * For some environments (for example CLI scripts and FastCGI calls) only one + * request is handled by an extension instance, but for others (when PHP runs + * as module in a webserver) many requests are handled by the same extension + * instance. + */ + +/** + * Set up namespace + */ +namespace PhpCpp +{ + +/** + * Class definition + */ +class Extension +{ +public: + /** + * Constructor + */ + Extension(); + + /** + * Destructor + */ + virtual ~Extension() + { + } + + /** + * Initialize the extension. + * + * This method is called after the extension has been loaded, constructed + * and after the compatibility has been checked, but before the requests + * are handled. You can override this method to add your own initialization. + * + * The method should return true on success, and false on failure (in which + * case the extension will not be used) + * + * @return boolean + */ + virtual bool initialize() + { + return true; + } + + /** + * Finalize the extension + * + * This method gets called after all requests were handled, and right before + * the Apache module or CLI script will exit. You can override it to add + * your own cleanup code. + */ + virtual void finalize() + { + } + +private: + +}; + +/** + * End of namespace + */ +} + + |