UDK 3.2.7 C/C++ API Reference
|
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 00029 #if ! defined INCLUDED_UNO_DISPATCHER_HXX 00030 #define INCLUDED_UNO_DISPATCHER_HXX 00031 00032 #include "uno/dispatcher.h" 00033 00035 00036 namespace com 00037 { 00038 namespace sun 00039 { 00040 namespace star 00041 { 00042 namespace uno 00043 { 00044 00052 class UnoInterfaceReference 00053 { 00054 public: 00055 uno_Interface * m_pUnoI; 00056 00057 inline bool is() const 00058 { return m_pUnoI != 0; } 00059 00060 inline ~UnoInterfaceReference(); 00061 inline UnoInterfaceReference(); 00062 inline UnoInterfaceReference( uno_Interface * pUnoI, __sal_NoAcquire ); 00063 inline UnoInterfaceReference( uno_Interface * pUnoI ); 00064 inline UnoInterfaceReference( UnoInterfaceReference const & ref ); 00065 00066 inline uno_Interface * get() const 00067 { return m_pUnoI; } 00068 00069 inline UnoInterfaceReference & set( 00070 uno_Interface * pUnoI ); 00071 inline UnoInterfaceReference & set( 00072 uno_Interface * pUnoI, __sal_NoAcquire ); 00073 inline void clear(); 00074 00075 inline UnoInterfaceReference & operator = ( 00076 UnoInterfaceReference const & ref ) 00077 { return set( ref.m_pUnoI ); } 00078 inline UnoInterfaceReference & operator = ( 00079 uno_Interface * pUnoI ) 00080 { return set( pUnoI ); } 00081 00082 inline void dispatch( 00083 struct _typelib_TypeDescription const * pMemberType, 00084 void * pReturn, void * pArgs [], uno_Any ** ppException ) const; 00085 00086 private: 00087 inline bool operator == ( UnoInterfaceReference const & ); // not impl 00088 inline bool operator != ( UnoInterfaceReference const & ); // not impl 00089 inline bool operator == ( uno_Interface * ); // not impl 00090 inline bool operator != ( uno_Interface * ); // not impl 00091 }; 00092 00093 //______________________________________________________________________________ 00094 inline UnoInterfaceReference::~UnoInterfaceReference() 00095 { 00096 if (m_pUnoI != 0) 00097 (*m_pUnoI->release)( m_pUnoI ); 00098 } 00099 00100 //______________________________________________________________________________ 00101 inline UnoInterfaceReference::UnoInterfaceReference() 00102 : m_pUnoI( 0 ) 00103 { 00104 } 00105 00106 //______________________________________________________________________________ 00107 inline UnoInterfaceReference::UnoInterfaceReference( 00108 uno_Interface * pUnoI, __sal_NoAcquire ) 00109 : m_pUnoI( pUnoI ) 00110 { 00111 } 00112 00113 //______________________________________________________________________________ 00114 inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI ) 00115 : m_pUnoI( pUnoI ) 00116 { 00117 if (m_pUnoI != 0) 00118 (*m_pUnoI->acquire)( m_pUnoI ); 00119 } 00120 00121 //______________________________________________________________________________ 00122 inline UnoInterfaceReference::UnoInterfaceReference( 00123 UnoInterfaceReference const & ref ) 00124 : m_pUnoI( ref.m_pUnoI ) 00125 { 00126 if (m_pUnoI != 0) 00127 (*m_pUnoI->acquire)( m_pUnoI ); 00128 } 00129 00130 //______________________________________________________________________________ 00131 inline UnoInterfaceReference & UnoInterfaceReference::set( 00132 uno_Interface * pUnoI ) 00133 { 00134 if (pUnoI != 0) 00135 (*pUnoI->acquire)( pUnoI ); 00136 if (m_pUnoI != 0) 00137 (*m_pUnoI->release)( m_pUnoI ); 00138 m_pUnoI = pUnoI; 00139 return *this; 00140 } 00141 00142 //______________________________________________________________________________ 00143 inline UnoInterfaceReference & UnoInterfaceReference::set( 00144 uno_Interface * pUnoI, __sal_NoAcquire ) 00145 { 00146 if (m_pUnoI != 0) 00147 (*m_pUnoI->release)( m_pUnoI ); 00148 m_pUnoI = pUnoI; 00149 return *this; 00150 } 00151 00152 //______________________________________________________________________________ 00153 inline void UnoInterfaceReference::clear() 00154 { 00155 if (m_pUnoI != 0) 00156 { 00157 (*m_pUnoI->release)( m_pUnoI ); 00158 m_pUnoI = 0; 00159 } 00160 } 00161 00162 //______________________________________________________________________________ 00163 inline void UnoInterfaceReference::dispatch( 00164 struct _typelib_TypeDescription const * pMemberType, 00165 void * pReturn, void * pArgs [], uno_Any ** ppException ) const 00166 { 00167 (*m_pUnoI->pDispatcher)( 00168 m_pUnoI, pMemberType, pReturn, pArgs, ppException ); 00169 } 00170 00171 } 00172 } 00173 } 00174 } 00175 00177 00178 #endif 00179 00180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */