Fix newobject3 testcase
Fixes Octave problem which has a template called product.
This commit is contained in:
parent
e7f0c6d6ad
commit
08210236ef
5 changed files with 158 additions and 11 deletions
93
Examples/test-suite/php5/newobject3.php
Normal file
93
Examples/test-suite/php5/newobject3.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 4.0.0
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// Try to load our extension if it's not already loaded.
|
||||
if (!extension_loaded('newobject3')) {
|
||||
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
|
||||
if (!dl('php_newobject3.dll')) return;
|
||||
} else {
|
||||
// PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
|
||||
if (PHP_SHLIB_SUFFIX === 'dylib') {
|
||||
if (!dl('newobject3.so')) return;
|
||||
} else {
|
||||
if (!dl('newobject3.'.PHP_SHLIB_SUFFIX)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* PHP Proxy Classes */
|
||||
class Product {
|
||||
public $_cPtr=null;
|
||||
protected $_pData=array();
|
||||
|
||||
function __set($var,$value) {
|
||||
if ($var === 'thisown') return swig_newobject3_alter_newobject($this->_cPtr,$value);
|
||||
$this->_pData[$var] = $value;
|
||||
}
|
||||
|
||||
function __get($var) {
|
||||
if ($var === 'thisown') return swig_newobject3_get_newobject($this->_cPtr);
|
||||
return $this->_pData[$var];
|
||||
}
|
||||
|
||||
function __isset($var) {
|
||||
if ($var === 'thisown') return true;
|
||||
return array_key_exists($var, $this->_pData);
|
||||
}
|
||||
|
||||
function __construct($res=null) {
|
||||
if (is_resource($res) && get_resource_type($res) === '_p_Product') {
|
||||
$this->_cPtr=$res;
|
||||
return;
|
||||
}
|
||||
$this->_cPtr=new_Product();
|
||||
}
|
||||
}
|
||||
|
||||
class factory {
|
||||
public $_cPtr=null;
|
||||
protected $_pData=array();
|
||||
|
||||
function __set($var,$value) {
|
||||
if ($var === 'thisown') return swig_newobject3_alter_newobject($this->_cPtr,$value);
|
||||
$this->_pData[$var] = $value;
|
||||
}
|
||||
|
||||
function __get($var) {
|
||||
if ($var === 'thisown') return swig_newobject3_get_newobject($this->_cPtr);
|
||||
return $this->_pData[$var];
|
||||
}
|
||||
|
||||
function __isset($var) {
|
||||
if ($var === 'thisown') return true;
|
||||
return array_key_exists($var, $this->_pData);
|
||||
}
|
||||
|
||||
function create($id_or_name,$type=0) {
|
||||
$r=factory_create($this->_cPtr,$id_or_name,$type);
|
||||
if (!is_resource($r)) return $r;
|
||||
return new Product($r);
|
||||
}
|
||||
|
||||
function __construct($res=null) {
|
||||
if (is_resource($res) && get_resource_type($res) === '_p_factory') {
|
||||
$this->_cPtr=$res;
|
||||
return;
|
||||
}
|
||||
$this->_cPtr=new_factory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue