|
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 #ifndef _CPPUHELPER_WEAK_HXX_ 00020 #define _CPPUHELPER_WEAK_HXX_ 00021 00022 #include <osl/interlck.h> 00023 #include <rtl/alloc.h> 00024 #include <cppuhelper/weakref.hxx> 00025 #include <cppuhelper/queryinterface.hxx> 00026 #include <com/sun/star/uno/XWeak.hpp> 00027 #include "cppuhelperdllapi.h" 00028 00029 00030 namespace cppu 00031 { 00032 00033 class OWeakConnectionPoint; 00034 00043 class CPPUHELPER_DLLPUBLIC OWeakObject : public ::com::sun::star::uno::XWeak 00044 { 00045 friend class OWeakConnectionPoint; 00046 00047 protected: 00054 virtual ~OWeakObject() SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 00055 00060 void disposeWeakConnectionPoint(); 00061 00067 oslInterlockedCount m_refCount; 00068 00070 00073 OWeakConnectionPoint * m_pWeakConnectionPoint; 00074 00077 void * m_pReserved; 00078 00080 00081 public: 00083 // these are here to force memory de/allocation to sal lib. 00084 inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(()) 00085 { return ::rtl_allocateMemory( nSize ); } 00086 inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(()) 00087 { ::rtl_freeMemory( pMem ); } 00088 inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(()) 00089 { return pMem; } 00090 inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(()) 00091 {} 00093 00094 #ifdef _MSC_VER 00095 00098 OWeakObject() SAL_THROW(()); 00099 #else 00100 00102 inline OWeakObject() SAL_THROW(()) 00103 : m_refCount( 0 ) 00104 , m_pWeakConnectionPoint( 0 ) 00105 {} 00106 #endif 00107 00111 inline OWeakObject( const OWeakObject & rObj ) SAL_THROW(()) 00112 : com::sun::star::uno::XWeak() 00113 , m_refCount( 0 ) 00114 , m_pWeakConnectionPoint( 0 ) 00115 { 00116 (void) rObj; 00117 } 00122 inline OWeakObject & SAL_CALL operator = ( const OWeakObject &) 00123 SAL_THROW(()) 00124 { return *this; } 00125 00132 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 00133 const ::com::sun::star::uno::Type & rType ) 00134 throw (::com::sun::star::uno::RuntimeException); 00137 virtual void SAL_CALL acquire() 00138 throw (); 00141 virtual void SAL_CALL release() 00142 throw (); 00143 00148 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAdapter > SAL_CALL queryAdapter() 00149 throw (::com::sun::star::uno::RuntimeException); 00150 00155 inline SAL_CALL operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () SAL_THROW(()) 00156 { return this; } 00157 }; 00158 00159 } 00160 00161 #endif 00162 00163 00164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1.7.3