Type info
Title Helper for weak references to objects that are not refcounted
Posted by [EMAIL PROTECTED]
Affected ,tools
Effective from SRC680_m152


Summary

Helper for weak references to objects that are not refcounted


Description
the template classes WeakReference and WeakBase are helper to
implement weak references to implementation objects that are not
refcounted.

THIS IS NOT THREADSAFE
THIS IS NOT FOR USE WITH UNO OBJECTS

Use this only to have 'safe' pointers to legacy implementation objects
that you
don't own but that you reference with a pointer.

Example:

#ifndef _TOOLS_WEAKBASE_H_
#include <tools/weakbase.h>
#endif

class ImplClass : public tools::WeakBase< ImplClass >
{
~ImplClass() { clearWeek(); } // not needed but safer, see method
description
...
};

class UserClass
{
tools::WeakReference< ImplClass > mxWeakRef;

UserClass( ImplClass* pOjbect ) : mxWeakRef( pObject ) {}

DoSomething()
{
if( mxWeakRef.is() )
mxWeakRef->DoSomethingMore();
}
};


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to