UDK 3.2.7 C/C++ API Reference
com/sun/star/uno/genfunc.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 #ifndef _COM_SUN_STAR_UNO_GENFUNC_HXX_
00029 #define _COM_SUN_STAR_UNO_GENFUNC_HXX_
00030 
00031 #include <com/sun/star/uno/genfunc.h>
00032 #include <com/sun/star/uno/Any.hxx>
00033 
00034 
00035 namespace com
00036 {
00037 namespace sun
00038 {
00039 namespace star
00040 {
00041 namespace uno
00042 {
00043 
00044 //==================================================================================================
00045 inline void SAL_CALL cpp_acquire( void * pCppI )
00046     SAL_THROW(())
00047 {
00048     reinterpret_cast< XInterface * >( pCppI )->acquire();
00049 }
00050 //==================================================================================================
00051 inline void SAL_CALL cpp_release( void * pCppI )
00052     SAL_THROW(())
00053 {
00054     reinterpret_cast< XInterface * >( pCppI )->release();
00055 }
00056 //==================================================================================================
00057 inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescriptionReference * pType )
00058     SAL_THROW(())
00059 {
00060     if (pCppI)
00061     {
00062 #ifndef EXCEPTIONS_OFF
00063         try
00064         {
00065 #endif
00066             Any aRet( reinterpret_cast< XInterface * >( pCppI )->queryInterface(
00067                 * reinterpret_cast< const Type * >( &pType ) ) );
00068             if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass)
00069             {
00070                 XInterface * pRet = reinterpret_cast< XInterface * >( aRet.pReserved );
00071                 aRet.pReserved = 0;
00072                 return pRet;
00073             }
00074 #ifndef EXCEPTIONS_OFF
00075         }
00076         catch (RuntimeException &)
00077         {
00078         }
00079 #endif
00080     }
00081     return 0;
00082 }
00083 
00084 }
00085 }
00086 }
00087 }
00088 
00089 #endif
00090 
00091 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines