From e4f90bd1d50405ab2e315041231553c9ea57b60f Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Thu, 6 Mar 2014 19:32:12 +0100 Subject: changes to documentation --- documentation/classes-and-objects.html | 8 ++++---- documentation/constructors-and-destructors.html | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'documentation') diff --git a/documentation/classes-and-objects.html b/documentation/classes-and-objects.html index 16de480..21813bb 100644 --- a/documentation/classes-and-objects.html +++ b/documentation/classes-and-objects.html @@ -52,7 +52,7 @@ extern "C" {

Let's talk about programming conventions first - we always use capitals for - the first letter of a classname, and our member variables always start with + the first letter of a classname, and member variables always start with an underscore. Every class always has a destructor, and it always is virtual. That's just a convention - our convention - and you do not have to follow that. @@ -64,7 +64,7 @@ extern "C" {

If you want to make a class method that is accessible from PHP, you must - ensure that is has one of the eight supported signatures (which are the same + ensure that it has one of the eight supported signatures (which are the same signatures that exportable plain functions can have), plus their const variant.

@@ -88,7 +88,7 @@ Php::Value YourClass::example8(Php::Parameters &params) const;

To make the class accessible from PHP, you must add it to the extension - object inside the get_module() function. The Php::Class template class can be + object inside the get_module() function. The Php::Class template class should be be used for that. The template parameter should be your implementation class, so that the Php::Class object internally knows which class to instantiate the moment the "new" operator is used inside a PHP script. @@ -199,7 +199,7 @@ echo($counter->value()."\n");

In PHP (and in C++ too) you can mark methods as public, private or protected. To achieve this for your native class too, you should pass in an additional - flags parameter when you add the method to the Php::Class object. Image that + flags parameter when you add the method to the Php::Class object. Imagine that you want to make the increment and decrement methods in the previous example protected, then you can simply add a flag:

diff --git a/documentation/constructors-and-destructors.html b/documentation/constructors-and-destructors.html index 54ca23f..42a6699 100644 --- a/documentation/constructors-and-destructors.html +++ b/documentation/constructors-and-destructors.html @@ -106,7 +106,8 @@ $d = new DERIVED(); never confuse your C++ constructor with the __construct() method. In the C++ constructor, the C++ object is being constructed and the PHP object does not yet exist. After the constructor is finished, the PHP engine - will create the PHP object, and the __construct() method gets called. It is therefore + will create the PHP object, and the PHP-CPP library will link that PHP object + to your C++ class. And only then the __construct() method gets called. It is therefore valid to have both a C++ constructor and a __construct() method in your class.

-- cgit v1.2.3