Object Structure approach Code
Takes care of simple class wrapping with pointers, enum, values, variables, and inheritance.
This commit is contained in:
parent
06c275935b
commit
11e2f53840
3 changed files with 219 additions and 21 deletions
|
|
@ -85,10 +85,9 @@
|
|||
/* Object passed by value. Convert to a pointer */
|
||||
%typemap(in) SWIGTYPE ($&1_ltype tmp)
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
}
|
||||
$1 = *tmp;
|
||||
$arg2if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL)
|
||||
$arg2SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
$arg2$1 = *tmp;
|
||||
%}
|
||||
|
||||
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
|
||||
|
|
@ -104,9 +103,8 @@
|
|||
%typemap(in) SWIGTYPE *,
|
||||
SWIGTYPE []
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
$arg2if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0)
|
||||
$arg2SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
%}
|
||||
|
||||
%typemap(in) SWIGTYPE &
|
||||
|
|
@ -133,9 +131,8 @@
|
|||
|
||||
%typemap(in) SWIGTYPE *DISOWN
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
}
|
||||
$arg2if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0)
|
||||
$arg2SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
%}
|
||||
|
||||
%typemap(argout) SWIGTYPE *,
|
||||
|
|
@ -369,7 +366,7 @@
|
|||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
|
||||
SWIG_SetZval($result, $newobj , $c_obj, (void *)result, SWIGTYPE$swig_type, $zend_obj);
|
||||
%}
|
||||
|
||||
%typemap(out) SWIGTYPE *const&
|
||||
|
|
|
|||
|
|
@ -237,3 +237,23 @@ static swig_module_info *SWIG_Php_GetModule() {
|
|||
static void SWIG_Php_SetModule(swig_module_info *pointer) {
|
||||
REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS);
|
||||
}
|
||||
|
||||
static void
|
||||
SWIG_SetZval( zval *zv, int object, int class_obj ,void *ptr, swig_type_info *type, zend_object *std) {
|
||||
|
||||
if (class_obj)
|
||||
return;
|
||||
|
||||
if (!ptr) {
|
||||
ZVAL_NULL(zv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (object == 1) {
|
||||
ZVAL_OBJ(zv,std);
|
||||
}
|
||||
|
||||
if (object == 2) {
|
||||
SWIG_SetPointerZval(zv,ptr,type,class_obj);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue