summaryrefslogtreecommitdiff
path: root/include/extension.h
diff options
context:
space:
mode:
authorMartijn Otto <martijn.otto@copernica.com>2015-03-26 16:00:10 +0100
committerMartijn Otto <martijn.otto@copernica.com>2015-03-26 16:00:10 +0100
commit7a928e2b19bddf152fd838469cc50805d4132401 (patch)
tree0a6657f4b94c27556b2f218e407f752018540d3b /include/extension.h
parentae4fa5f871d937773e9facde87a32784e715e3ae (diff)
Changed default visibility for symbols in the PHP-CPP library to hidden and explicitly exported all symbols available from the public API. Moved the hiddenpointer to the zend implementation directory as it is not meant to be used publicly and not referenced anywhere from the API anyway
Diffstat (limited to 'include/extension.h')
-rw-r--r--include/extension.h64
1 files changed, 31 insertions, 33 deletions
diff --git a/include/extension.h b/include/extension.h
index 15ad5e1..caa3d33 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -6,11 +6,11 @@
* apache process starts - and will be used for all subsequent requests that
* are handled by Apache.
*
- * For some environments (for example CLI scripts and CGI calls) only one
+ * For some environments (for example CLI scripts and CGI 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.
- *
+ *
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013, 2014 Copernica BV
*/
@@ -33,7 +33,7 @@ using Callback = std::function<void()>;
/**
* Class definition
*/
-class Extension : public Namespace
+class PHPCPP_EXPORT Extension : public Namespace
{
public:
/**
@@ -51,68 +51,68 @@ public:
* @param apiversion PHP API version (this should always be PHPCPP_API_VERSION, so you better not supply it)
*/
Extension(const char *name, const char *version = "1.0", int apiversion = PHPCPP_API_VERSION);
-
+
/**
* No copy'ing and no moving
*/
Extension(const Extension &extension) = delete;
Extension(Extension &&extension) = delete;
-
+
/**
* Destructor
*/
virtual ~Extension();
-
+
/**
* Register a function to be called when the PHP engine is ready
- *
- * The callback will be called after all extensions are loaded, and all
+ *
+ * The callback will be called after all extensions are loaded, and all
* functions and classes are available, but before the first pageview/request
* is handled. You can register this callback if you want to be notified
* when the engine is ready, for example to initialize certain things.
- *
+ *
* @param callback Function to be called
* @return Extension Same object to allow chaining
*/
Extension &onStartup(const Callback &callback);
-
+
/**
* Register a function to be called when the PHP engine is going to stop
- *
+ *
* The callback will be called right before the process is going to stop.
* You can register a function if you want to clean up certain things.
- *
+ *
* @param callback Function to be called
* @return Extension Same object to allow chaining
*/
Extension &onShutdown(const Callback &callback);
-
+
/**
* Register a callback that is called at the beginning of each pageview/request
- *
+ *
* You can register a callback if you want to initialize certain things
* at the beginning of each request. Remember that the extension can handle
* multiple requests after each other, and you may want to set back certain
* global variables to their initial variables in front of each request
- *
+ *
* @param callback Function to be called
* @return Extension Same object to allow chaining
*/
Extension &onRequest(const Callback &callback);
-
+
/**
* Register a callback that is called to cleanup things after a pageview/request
- *
+ *
* The callback will be called after _each_ request, so that you can clean up
* certain things and make your extension ready to handle the next request.
* This method is called onIdle because the extension is idle in between
* requests.
- *
+ *
* @param callback Function to be called
* @return Extension Same object to allow chaining
*/
Extension &onIdle(const Callback &callback);
-
+
/**
* Add a ini entry to the extension by moving it
* @param ini The php.ini setting
@@ -122,10 +122,10 @@ public:
{
// skip when locked
if (locked()) return *this;
-
+
// and add it to the list of classes
_ini_entries.emplace_back(new Ini(std::move(ini)));
-
+
// allow chaining
return *this;
}
@@ -142,11 +142,11 @@ public:
// and add it to the list of classes
_ini_entries.emplace_back(new Ini(ini));
-
+
// allow chaining
return *this;
}
-
+
/**
* Because the add function exists in both the Namespace base class
* as well as this extended Extension class, we have to tell the compiler
@@ -165,9 +165,9 @@ public:
/**
* Apply a callback to each php.ini variable
- *
+ *
* The callback will be called with a reference to the ini variable.
- *
+ *
* @param callback
*/
void iniVariables(const std::function<void(Ini &ini)> &callback)
@@ -178,30 +178,30 @@ public:
/**
* Retrieve the module pointer
- *
+ *
* This is the memory address that should be exported by the get_module()
* function.
*
* @return void*
*/
void *module();
-
+
/**
* Cast to a module entry
- *
+ *
* @return void*
*/
operator void * ()
{
return module();
}
-
+
protected:
/**
* Is the extension object in a locked state? This happens after the
* get_module() function was called for the first time ("apache reload"
* forces a new call to get_module())
- *
+ *
* @return bool
*/
virtual bool locked() const override;
@@ -209,7 +209,7 @@ protected:
private:
/**
* The implementation object
- *
+ *
* @var ExtensionImpl
*/
ExtensionImpl *_impl;
@@ -226,5 +226,3 @@ private:
* End of namespace
*/
}
-
-