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  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 #ifndef _COM_SUN_STAR_UNO_GENFUNC_HXX_
00020 #define _COM_SUN_STAR_UNO_GENFUNC_HXX_
00021 
00022 #include <com/sun/star/uno/genfunc.h>
00023 #include <com/sun/star/uno/Any.hxx>
00024 
00025 
00026 namespace com
00027 {
00028 namespace sun
00029 {
00030 namespace star
00031 {
00032 namespace uno
00033 {
00034 
00035 //==================================================================================================
00036 inline void SAL_CALL cpp_acquire( void * pCppI )
00037     SAL_THROW(())
00038 {
00039     reinterpret_cast< XInterface * >( pCppI )->acquire();
00040 }
00041 //==================================================================================================
00042 inline void SAL_CALL cpp_release( void * pCppI )
00043     SAL_THROW(())
00044 {
00045     reinterpret_cast< XInterface * >( pCppI )->release();
00046 }
00047 //==================================================================================================
00048 inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescriptionReference * pType )
00049     SAL_THROW(())
00050 {
00051     if (pCppI)
00052     {
00053 #ifndef EXCEPTIONS_OFF
00054         try
00055         {
00056 #endif
00057             Any aRet( reinterpret_cast< XInterface * >( pCppI )->queryInterface(
00058                 * reinterpret_cast< const Type * >( &pType ) ) );
00059             if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass)
00060             {
00061                 XInterface * pRet = reinterpret_cast< XInterface * >( aRet.pReserved );
00062                 aRet.pReserved = 0;
00063                 return pRet;
00064             }
00065 #ifndef EXCEPTIONS_OFF
00066         }
00067         catch (RuntimeException &)
00068         {
00069         }
00070 #endif
00071     }
00072     return 0;
00073 }
00074 
00075 }
00076 }
00077 }
00078 }
00079 
00080 #endif
00081 
00082 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines