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