AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
genfunc.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 #ifndef INCLUDED_COM_SUN_STAR_UNO_GENFUNC_HXX
4 #define INCLUDED_COM_SUN_STAR_UNO_GENFUNC_HXX
5 
6 #include "sal/config.h"
7 
8 #include <cstddef>
9 
11 #include "com/sun/star/uno/Any.hxx"
12 #include "com/sun/star/uno/XInterface.hpp"
13 
14 
15 namespace com
16 {
17 namespace sun
18 {
19 namespace star
20 {
21 namespace uno
22 {
23 
24 
25 inline void SAL_CALL cpp_acquire( void * pCppI )
26 {
27  static_cast< XInterface * >( pCppI )->acquire();
28 }
29 
30 inline void SAL_CALL cpp_release( void * pCppI )
31 {
32  static_cast< XInterface * >( pCppI )->release();
33 }
34 
35 inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescriptionReference * pType )
36 {
37  if (pCppI)
38  {
39  try
40  {
41  Any aRet( static_cast< XInterface * >( pCppI )->queryInterface(
42  * reinterpret_cast< const Type * >( &pType ) ) );
43  if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass)
44  {
45  XInterface * pRet = static_cast< XInterface * >( aRet.pReserved );
46  aRet.pReserved = NULL;
47  return pRet;
48  }
49  }
50  catch (RuntimeException &)
51  {
52  }
53  }
54  return NULL;
55 }
56 
57 }
58 }
59 }
60 }
61 
62 #endif
63 
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:30
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
C++ class representing an IDL any.
Definition: Any.h:36
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:25
type class of interface
Definition: typeclass.h:62
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:23
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:35