diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-06 19:08:07 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-06 19:08:07 +0100 |
commit | 70f702bcdaa70f9b8dffc2e552cf5e0b4be69660 (patch) | |
tree | c35db3a177fbfdea74c7f0d4f9b603f590256662 /documentation/namespaces.html | |
parent | e072565364a825ff71227a1abd290f4274971354 (diff) |
changes to documentation
Diffstat (limited to 'documentation/namespaces.html')
-rw-r--r-- | documentation/namespaces.html | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/documentation/namespaces.html b/documentation/namespaces.html index e85e3d7..0aeadbe 100644 --- a/documentation/namespaces.html +++ b/documentation/namespaces.html @@ -5,7 +5,7 @@ like '__NAMESPACE__', they are internally very simple. </p> <p> - A namespace is nothing else than a class prefix. If you want your classes + A namespace is nothing else than a class or function prefix. If you want your classes or functions to appear in a specific namespace, you simply have to add a prefix to the class or function name. The following code creates a function "myFunction" in the "myNamespace" namespace. @@ -24,7 +24,8 @@ extern "C" { // create extension object static Php::Extension extension("my_extension", "1.0"); - // add the myFunction function to the extension, and put it in namespace "myNamespace" + // add the myFunction function to the extension, + // and put it in namespace "myNamespace" extension.add("myNamespace\\myFunction", myFunction); // return the extension @@ -33,9 +34,9 @@ extern "C" { }</code></pre> </p> <p> - If you like, you can use the Php::Namespace utility class for this. This is an - object with exactly the same signature as the Php::Extension object, and - that you can use to register your functions. + If you like, you can use the Php::Namespace utility class for this. This is a + class with exactly the same signature as the Php::Extension class, and + that you can use to register classes and functions too. </p> <p> <pre class="language-c++"><code>#include <phpcpp.h> @@ -82,7 +83,7 @@ extern "C" { </p> <p> In the example we used the std::move() function to move the nested namespace - the parent namespace, and to move the first namespace into the extension. + into the parent namespace, and to move the first namespace into the extension. Moving is more efficient that adding, although a regular extension.add(myNamespace) would have been valid too. </p> |