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 | |
parent | e072565364a825ff71227a1abd290f4274971354 (diff) |
changes to documentation
-rw-r--r-- | documentation/namespaces.html | 13 | ||||
-rw-r--r-- | documentation/properties.html | 24 | ||||
-rw-r--r-- | documentation/variables.html | 32 |
3 files changed, 60 insertions, 9 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> diff --git a/documentation/properties.html b/documentation/properties.html index 431896f..bdbdfa7 100644 --- a/documentation/properties.html +++ b/documentation/properties.html @@ -1 +1,23 @@ -<h1>Class properties</h1>
\ No newline at end of file +<h1>Class properties</h1> +<p> + When you define a class completely in PHP, you can add properties (member + variables) to it. When you add member variables to a native C++ class however, + you better use regular C++ member variables for that, instead of PHP variables. + Native variables have an immensely better performance than PHP variables, + and it would be insane to store integers or strings in Php::Value objects + if you can store them in int's and std::string objects as well. +</p> +<p> + To access these member variables you could create getX() and setX() + methods, or alternatively implement __get() and __set() methods if you + want to make your native member variables look like public or protected + properties. +</p> +<p> + I can not imagine that there is anyone in the world who would like to create + a native class, with regular public PHP properties on it. But still, in this + article we explain how you can do that. +</p> +<p> + ... this article is not finished yet +</p>
\ No newline at end of file diff --git a/documentation/variables.html b/documentation/variables.html index 31dded6..f46712d 100644 --- a/documentation/variables.html +++ b/documentation/variables.html @@ -1,4 +1,4 @@ -<h2>Working with variables</h2> +<h1>Working with variables</h1> <p> Variables in PHP are non-typed. A variable can thus hold any possible type: an integer, string, a floating point number, and even an object or an array. @@ -9,5 +9,33 @@ When you mix native code and PHP code, you will need to convert the non-typed PHP variables into native variables, and the other way round: convert native variables back into non-typed PHP variables. The PHP-CPP library offers the - "Value" class that makes this a very simple task. + Php::Value class that makes this a very simple task. </p> +<h2>Scalar variables</h2> +<p> + This section is not finished yet +</p> + + + +<h2>Arrays</h2> +<p> + This section is not finished yet +</p> + + + +<h2>Objects</h2> +<p> + This section is not finished yet +</p> + + + +<h2>Functions</h2> +<p> + This section is not finished yet +</p> + + + |