throws typemaps added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7620 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3ee7d16f7c
commit
f8ee15c278
2 changed files with 32 additions and 1 deletions
|
|
@ -268,6 +268,30 @@
|
|||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||
" /* tyepcheck void * */ "
|
||||
|
||||
/* php kewords */
|
||||
|
||||
/* Exception handling */
|
||||
|
||||
%typemap(throws) int,
|
||||
long,
|
||||
short,
|
||||
unsigned int,
|
||||
unsigned long,
|
||||
unsigned short {
|
||||
char error_msg[256];
|
||||
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
||||
SWIG_PHP_Error(E_ERROR, error_msg);
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{
|
||||
(void)$1;
|
||||
SWIG_PHP_Error(E_ERROR, "C++ $1_type exception thrown");
|
||||
%}
|
||||
|
||||
%typemap(throws) char * %{
|
||||
SWIG_PHP_Error(E_ERROR, (char *)$1);
|
||||
%}
|
||||
|
||||
|
||||
/* php keywords */
|
||||
/* please test and activate */
|
||||
//%include "phpkw.swg"
|
||||
|
|
|
|||
|
|
@ -42,4 +42,11 @@ namespace std {
|
|||
ZVAL_STRINGL($result,const_cast<char*>($1->c_str()),$1->length(),1);
|
||||
}
|
||||
|
||||
%typemap(throws) string %{
|
||||
SWIG_PHP_Error(E_ERROR, (char *)$1.c_str());
|
||||
%}
|
||||
|
||||
%typemap(throws) const string& %{
|
||||
SWIG_PHP_Error(E_ERROR, (char *)$1.c_str());
|
||||
%}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue