00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
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