diff options
Diffstat (limited to 'tools/m4/method.m4')
-rw-r--r-- | tools/m4/method.m4 | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/tools/m4/method.m4 b/tools/m4/method.m4 index f4bee93e..4193e04b 100644 --- a/tools/m4/method.m4 +++ b/tools/m4/method.m4 @@ -9,26 +9,41 @@ dnl dnl dnl method -dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 +dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,const,refreturn,errthrow,deprecated,constversion,arglist_without_types) define(`_METHOD',`dnl _PUSH(SECTION_CC) ifelse(`$10',,,`_DEPRECATE_IFDEF_START') +ifelse(`$9',,,`#ifdef GLIBMM_EXCEPTIONS_ENABLED') $3 __CPPNAME__::$1`'($5)ifelse(`$7',1,` const') +ifelse(`$9',,,`#else +$3 __CPPNAME__::$1`'(`'$5`'ifelse(($5),(),`',`, ')std::auto_ptr<Glib::Error>& error)ifelse(`$7',1,` const') +#endif //GLIBMM_EXCEPTIONS_ENABLED +') { ifelse(`$11',,dnl -` ifelse(`$8'`$9',,dnl -` ifelse(`$3',void,,`return ')_CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)'); -', dnl -`ifelse(`$9',,,` GError *error = 0;') - ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)'); -ifelse(`$9',,,` if(error) ::Glib::Error::throw_exception(error);') +` ifelse(`$8'`$9',,dnl If it is not errthrow or refreturn +`ifelse(`$3',void,dnl If it returns voids: +`$2(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6);' dnl It it returns non-void: +,`return _CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');')' dnl End if it returns voids. +,dnl If is errthrow or refreturn +`ifelse(`$9',,,` GError* gerror = 0;') + ifelse(`$3',void,,``$3' retvalue = _CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');')dnl +ifelse(`$9',,,` +#ifdef GLIBMM_EXCEPTIONS_ENABLED + if(gerror) + ::Glib::Error::throw_exception(gerror); +#else + if(gerror) + error = ::Glib::Error::throw_exception(gerror); +#endif //GLIBMM_EXCEPTIONS_ENABLED +') ifelse(`$8',,,`dnl if(retvalue) retvalue->reference(); //The function does not do a ref for us. ')dnl ifelse(`$3',void,,` return retvalue;') -')dnl +')dnl End errthrow/refreturn ',` return const_cast<__CPPNAME__*>(this)->$1($12);') } ifelse(`$10',,,`_DEPRECATE_IFDEF_END @@ -42,14 +57,27 @@ dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,refreturn,er define(`_STATIC_METHOD',`dnl _PUSH(SECTION_CC) ifelse(`$9',,,`_DEPRECATE_IFDEF_START') dnl +ifelse(`$8',,,`#ifdef GLIBMM_EXCEPTIONS_ENABLED') $3 __CPPNAME__::$1($5) +ifelse(`$8',,,`#else +$3 __CPPNAME__::$1(`'$5`'ifelse(($5),(),`',`, ')std::auto_ptr<Glib::Error>& error) +#endif //GLIBMM_EXCEPTIONS_ENABLED +') { ifelse(`$7'`$8',,dnl ` ifelse(`$3',void,,`return ')_CONVERT($4,$3,`$2`'($6)'); ', dnl -`ifelse(`$8',,,` GError *error = 0;') +`ifelse(`$8',,,` GError* gerror = 0;') ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'($6)'); -ifelse(`$8',,,` if(error) ::Glib::Error::throw_exception(error);') +ifelse(`$8',,,` +#ifdef GLIBMM_EXCEPTIONS_ENABLED + if(gerror) + ::Glib::Error::throw_exception(gerror); +#else + if(gerror) + error = ::Glib::Error::throw_exception(gerror); +#endif //GLIBMM_EXCEPTIONS_ENABLED +') ifelse(`$7',,,`dnl if(retvalue) retvalue->reference(); //The function does not do a ref for us. |