/** template implementation to hold a weak reference to an instance of type reference_type */ template <class reference_type> class SAL_WARN_UNUSED WeakReference
{ public: /** constructs an empty reference */ inline WeakReference();
/** constructs a reference with a pointer to a class derived from WeakBase */ inline WeakReference( reference_type* pReference );
/** constructs a reference from another reference */ inline WeakReference( const WeakReference< reference_type >& rWeakRef );
/** move a reference from another reference */ inline WeakReference( WeakReference< reference_type >&& rWeakRef );
/** returns true if the reference object is not null and still alive */ inlinebool is() const;
/** returns true if the reference object is not null and still alive */ operatorbool() const { return is(); }
/** returns the pointer to the reference object or null */ inline reference_type * get() const;
/** sets this reference to the given object or null */ inlinevoid reset( reference_type* pReference );
/** resets this reference to null */ inlinevoid reset();
/** returns the pointer to the reference object or null */ inline reference_type * operator->() const;
/** returns a ref to the reference object */ inline reference_type& operator*() const;
/** returns true if this instance references pReferenceObject */ inlinebooloperator== (const reference_type * pReferenceObject) const;
/** returns true if this instance and the given weakref reference the same object */ inlinebooloperator== (const WeakReference<reference_type> & handle) const;
/** only needed for using this class with stl containers */ inlinebooloperator!= (const WeakReference<reference_type> & handle) const;
/** only needed for using this class with stl containers */ inlinebooloperator< (const WeakReference<reference_type> & handle) const;
/** only needed for using this class with stl containers */ inlinebooloperator> (const WeakReference<reference_type> & handle) const;
/** derive your implementation classes from this class if you want them to support weak references */ class TOOLS_DLLPUBLIC WeakBase
{ template<typename T> friendclass WeakReference;
public:
WeakBase() {} virtual ~WeakBase(); /** clears the reference pointer in all living weak references for this instance. Furthercreatedweakreferenceswillalsobeinvalid. Youshouldcallthismethodinthed'torofyourderivedclassesforanearly invalidateofalllivingweakreferenceswhileyourobjectisalreadyinside itd'tor.
*/ inlinevoid clearWeak();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.