diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2002-08-19 06:18:50 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2002-08-19 06:18:50 +0000 |
commit | 230d11f43273266e9ff30ec4f5314d431de78e8b (patch) | |
tree | 20eb334e674d35a1397ba0d062bc42b661db6b58 /cppu/source/uno/data.cxx | |
parent | 796a0ababd0e3149da3e92af96004d4796ce00d3 (diff) |
#102391# introducing some base type extensions
Diffstat (limited to 'cppu/source/uno/data.cxx')
-rw-r--r-- | cppu/source/uno/data.cxx | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index e8e3ed198afe..23691abde96e 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -2,9 +2,9 @@ * * $RCSfile: data.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: dbo $ $Date: 2001-10-19 13:25:14 $ + * last change: $Author: dbo $ $Date: 2002-08-19 07:18:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -277,6 +277,64 @@ sal_Bool SAL_CALL uno_assignData( pSource, pSourceTD->pWeakRef, pSourceTD, queryInterface, acquire, release ); } +//################################################################################################## +sal_Bool SAL_CALL uno_type_isAssignableFromData( + typelib_TypeDescriptionReference * pAssignable, + void * pFrom, typelib_TypeDescriptionReference * pFromType, + uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release ) + SAL_THROW_EXTERN_C() +{ + if (::typelib_typedescriptionreference_isAssignableFrom( pAssignable, pFromType )) + return sal_True; + if (typelib_TypeClass_INTERFACE != pFromType->eTypeClass || + typelib_TypeClass_INTERFACE != pAssignable->eTypeClass) + { + return sal_False; + } + + // query + if (!pFrom) + return sal_False; + void * pInterface = *(void **)pFrom; + if (! pInterface) + return sal_False; + + if (queryInterface) + { + void * p = (*queryInterface)( pInterface, pAssignable ); + if (p) + { + (*release)( p ); + } + return (0 != p); + } + else /* bin UNO */ + { + uno_Any aRet, aExc; + uno_Any * pExc = &aExc; + + void * aArgs[1]; + aArgs[0] = &pAssignable; + + typelib_TypeDescription * pMTqueryInterface = __getQueryInterfaceTypeDescr(); + (*((uno_Interface *)pInterface)->pDispatcher)( + (uno_Interface *)pInterface, pMTqueryInterface, &aRet, aArgs, &pExc ); + ::typelib_typedescription_release( pMTqueryInterface ); + + OSL_ENSURE( !pExc, "### Exception occured during queryInterface()!" ); + if (pExc) + { + __destructAny( pExc, 0 ); + return sal_False; + } + else + { + sal_Bool ret = (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass); + __destructAny( &aRet, 0 ); + return ret; + } + } +} } |