<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>Complete Member List for TQGuardedPtr</h1>
<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>Complete Member List for TQGuardedPtr</h1>
<p>This is the complete list of member functions for
<p>This is the complete list of member functions for
<ahref="ntqguardedptr.html">TQGuardedPtr</a>, including inherited members.
<ahref="tqguardedptr.html">TQGuardedPtr</a>, including inherited members.
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" license file included in the distribution for a complete license
.\" statement.
.\" statement.
@ -7,35 +7,35 @@
.ad l
.ad l
.nh
.nh
.SH NAME
.SH NAME
QGuardedPtr \- Template class that provides guarded pointers to TQObjects
TQGuardedPtr \- Template class that provides guarded pointers to TQObjects
.SH SYNOPSIS
.SH SYNOPSIS
\fC#include <ntqguardedptr.h>\fR
\fC#include <tqguardedptr.h>\fR
.PP
.PP
.SS "Public Members"
.SS "Public Members"
.in +1c
.in +1c
.ti -1c
.ti -1c
.BI "\fBQGuardedPtr\fR ()"
.BI "\fBTQGuardedPtr\fR ()"
.br
.br
.ti -1c
.ti -1c
.BI "\fBQGuardedPtr\fR ( T * p )"
.BI "\fBTQGuardedPtr\fR ( T * p )"
.br
.br
.ti -1c
.ti -1c
.BI "\fBQGuardedPtr\fR ( const QGuardedPtr<T> & p )"
.BI "\fBTQGuardedPtr\fR ( const TQGuardedPtr<T> & p )"
.br
.br
.ti -1c
.ti -1c
.BI "\fB~QGuardedPtr\fR ()"
.BI "\fB~TQGuardedPtr\fR ()"
.br
.br
.ti -1c
.ti -1c
.BI "QGuardedPtr<T> & \fBoperator=\fR ( const QGuardedPtr<T> & p )"
.BI "TQGuardedPtr<T> & \fBoperator=\fR ( const TQGuardedPtr<T> & p )"
.br
.br
.ti -1c
.ti -1c
.BI "QGuardedPtr<T> & \fBoperator=\fR ( T * p )"
.BI "TQGuardedPtr<T> & \fBoperator=\fR ( T * p )"
.br
.br
.ti -1c
.ti -1c
.BI "bool \fBoperator==\fR ( const QGuardedPtr<T> & p ) const"
.BI "bool \fBoperator==\fR ( const TQGuardedPtr<T> & p ) const"
.br
.br
.ti -1c
.ti -1c
.BI "bool \fBoperator!=\fR ( const QGuardedPtr<T> & p ) const"
.BI "bool \fBoperator!=\fR ( const TQGuardedPtr<T> & p ) const"
.br
.br
.ti -1c
.ti -1c
.BI "bool \fBisNull\fR () const"
.BI "bool \fBisNull\fR () const"
@ -51,9 +51,9 @@ QGuardedPtr \- Template class that provides guarded pointers to TQObjects
.br
.br
.in -1c
.in -1c
.SH DESCRIPTION
.SH DESCRIPTION
The QGuardedPtr class is a template class that provides guarded pointers to TQObjects.
The TQGuardedPtr class is a template class that provides guarded pointers to TQObjects.
.PP
.PP
A guarded pointer, \fCQGuardedPtr<X>\fR, behaves like a normal C++ pointer \fCX*\fR, except that it is automatically set to 0 when the referenced object is destroyed (unlike normal C++ pointers, which become "dangling pointers" in such cases). \fCX\fR must be a subclass of TQObject.
A guarded pointer, \fCTQGuardedPtr<X>\fR, behaves like a normal C++ pointer \fCX*\fR, except that it is automatically set to 0 when the referenced object is destroyed (unlike normal C++ pointers, which become "dangling pointers" in such cases). \fCX\fR must be a subclass of TQObject.
.PP
.PP
Guarded pointers are useful whenever you need to store a pointer to a TQObject that is owned by someone else and therefore might be destroyed while you still hold a reference to it. You can safely test the pointer for validity.
Guarded pointers are useful whenever you need to store a pointer to a TQObject that is owned by someone else and therefore might be destroyed while you still hold a reference to it. You can safely test the pointer for validity.
.PP
.PP
@ -61,7 +61,7 @@ Example:
.PP
.PP
.nf
.nf
.br
.br
QGuardedPtr<TQLabel> label = new TQLabel( 0, "label" );
TQGuardedPtr<TQLabel> label = new TQLabel( 0, "label" );
.br
.br
label->setText( "I like guarded pointers" );
label->setText( "I like guarded pointers" );
.br
.br
@ -81,49 +81,49 @@ Example:
.PP
.PP
The program will output \fCThe label has been destroyed\fR rather than dereferencing an invalid address in \fClabel->show()\fR.
The program will output \fCThe label has been destroyed\fR rather than dereferencing an invalid address in \fClabel->show()\fR.
.PP
.PP
The functions and operators available with a QGuardedPtr are the same as those available with a normal unguarded pointer, except the pointer arithmetic operators (++, --, -, and +), which are normally used only with arrays of objects. Use them like normal pointers and you will not need to read this class documentation.
The functions and operators available with a TQGuardedPtr are the same as those available with a normal unguarded pointer, except the pointer arithmetic operators (++, --, -, and +), which are normally used only with arrays of objects. Use them like normal pointers and you will not need to read this class documentation.
.PP
.PP
For creating guarded pointers, you can construct or assign to them from an X* or from another guarded pointer of the same type. You can compare them with each other using operator==() and operator!=(), or test for 0 with isNull(). And you can dereference them using either the \fC*x\fR or the \fCx->member\fR notation.
For creating guarded pointers, you can construct or assign to them from an X* or from another guarded pointer of the same type. You can compare them with each other using operator==() and operator!=(), or test for 0 with isNull(). And you can dereference them using either the \fC*x\fR or the \fCx->member\fR notation.
.PP
.PP
A guarded pointer will automatically cast to an X*, so you can freely mix guarded and unguarded pointers. This means that if you have a QGuardedPtr<TQWidget>, you can pass it to a function that requires a TQWidget*. For this reason, it is of little value to declare functions to take a QGuardedPtr as a parameter; just use normal pointers. Use a QGuardedPtr when you are storing a pointer over time.
A guarded pointer will automatically cast to an X*, so you can freely mix guarded and unguarded pointers. This means that if you have a TQGuardedPtr<TQWidget>, you can pass it to a function that requires a TQWidget*. For this reason, it is of little value to declare functions to take a TQGuardedPtr as a parameter; just use normal pointers. Use a TQGuardedPtr when you are storing a pointer over time.
.PP
.PP
Note again that class \fIX\fR must inherit TQObject, or a compilation or link error will result.
Note again that class \fIX\fR must inherit TQObject, or a compilation or link error will result.
.PP
.PP
See also Object Model.
See also Object Model.
.SH MEMBER FUNCTION DOCUMENTATION
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QGuardedPtr::QGuardedPtr ()"
.SH "TQGuardedPtr::TQGuardedPtr ()"
Constructs a 0 guarded pointer.
Constructs a 0 guarded pointer.
.PP
.PP
See also isNull().
See also isNull().
.SH "QGuardedPtr::QGuardedPtr ( T * p )"
.SH "TQGuardedPtr::TQGuardedPtr ( T * p )"
Constructs a guarded pointer that points to same object as \fIp\fR points to.
Constructs a guarded pointer that points to same object as \fIp\fR points to.
.SH "QGuardedPtr::QGuardedPtr ( const QGuardedPtr<T> & p )"
.SH "TQGuardedPtr::TQGuardedPtr ( const TQGuardedPtr<T> & p )"
Copy one guarded pointer from another. The constructed guarded pointer points to the same object that \fIp\fR points to (which may be 0).
Copy one guarded pointer from another. The constructed guarded pointer points to the same object that \fIp\fR points to (which may be 0).
.SH "QGuardedPtr::~QGuardedPtr ()"
.SH "TQGuardedPtr::~TQGuardedPtr ()"
Destroys the guarded pointer. Just like a normal pointer, destroying a guarded pointer does \fInot\fR destroy the object being pointed to.
Destroys the guarded pointer. Just like a normal pointer, destroying a guarded pointer does \fInot\fR destroy the object being pointed to.
.SH "bool QGuardedPtr::isNull () const"
.SH "bool TQGuardedPtr::isNull () const"
Returns \fCTRUE\fR if the referenced object has been destroyed or if there is no referenced object; otherwise returns FALSE.
Returns \fCTRUE\fR if the referenced object has been destroyed or if there is no referenced object; otherwise returns FALSE.
.SH "QGuardedPtr::operator T * () const"
.SH "TQGuardedPtr::operator T * () const"
Cast operator; implements pointer semantics. Because of this function you can pass a QGuardedPtr<X> to a function where an X* is required.
Cast operator; implements pointer semantics. Because of this function you can pass a TQGuardedPtr<X> to a function where an X* is required.
.SH "bool QGuardedPtr::operator!= ( const QGuardedPtr<T> & p ) const"
.SH "bool TQGuardedPtr::operator!= ( const TQGuardedPtr<T> & p ) const"
Inequality operator; implements pointer semantics, the negation of operator==(). Returns TRUE if \fIp\fR and this guarded pointer are not pointing to the same object; otherwise returns FALSE.
Inequality operator; implements pointer semantics, the negation of operator==(). Returns TRUE if \fIp\fR and this guarded pointer are not pointing to the same object; otherwise returns FALSE.
.SH "T & QGuardedPtr::operator* () const"
.SH "T & TQGuardedPtr::operator* () const"
Dereference operator; implements pointer semantics. Just use this operator as you would with a normal C++ pointer.
Dereference operator; implements pointer semantics. Just use this operator as you would with a normal C++ pointer.
.SH "T * QGuardedPtr::operator-> () const"
.SH "T * TQGuardedPtr::operator-> () const"
Overloaded arrow operator; implements pointer semantics. Just use this operator as you would with a normal C++ pointer.
Overloaded arrow operator; implements pointer semantics. Just use this operator as you would with a normal C++ pointer.
.SH "QGuardedPtr<T> & QGuardedPtr::operator= ( const QGuardedPtr<T> & p )"
.SH "TQGuardedPtr<T> & TQGuardedPtr::operator= ( const TQGuardedPtr<T> & p )"
Assignment operator. This guarded pointer then points to the same object as \fIp\fR points to.
Assignment operator. This guarded pointer then points to the same object as \fIp\fR points to.
.SH "QGuardedPtr<T> & QGuardedPtr::operator= ( T * p )"
.SH "TQGuardedPtr<T> & TQGuardedPtr::operator= ( T * p )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
.PP
Assignment operator. This guarded pointer then points to the same object as \fIp\fR points to.
Assignment operator. This guarded pointer then points to the same object as \fIp\fR points to.
.SH "bool QGuardedPtr::operator== ( const QGuardedPtr<T> & p ) const"
.SH "bool TQGuardedPtr::operator== ( const TQGuardedPtr<T> & p ) const"
Equality operator; implements traditional pointer semantics. Returns TRUE if both \fIp\fR and this guarded pointer are 0, or if both \fIp\fR and this pointer point to the same object; otherwise returns FALSE.
Equality operator; implements traditional pointer semantics. Returns TRUE if both \fIp\fR and this guarded pointer are 0, or if both \fIp\fR and this pointer point to the same object; otherwise returns FALSE.
.PP
.PP
See also operator!=().
See also operator!=().
.SH "SEE ALSO"
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqguardedptr.html
.BR http://doc.trolltech.com/tqguardedptr.html
.BR http://www.trolltech.com/faq/tech.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
@ -203,7 +203,7 @@ TQObjects organize themselves in object trees. When you create a TQObject with a
.PP
.PP
Every object has an object name() and can report its className() and whether it inherits() another class in the TQObject inheritance hierarchy.
Every object has an object name() and can report its className() and whether it inherits() another class in the TQObject inheritance hierarchy.
.PP
.PP
When an object is deleted, it emits a destroyed() signal. You can catch this signal to avoid dangling references to TQObjects. The QGuardedPtr class provides an elegant way to use this feature.
When an object is deleted, it emits a destroyed() signal. You can catch this signal to avoid dangling references to TQObjects. The TQGuardedPtr class provides an elegant way to use this feature.
.PP
.PP
TQObjects can receive events through event() and filter the events of other objects. See installEventFilter() and eventFilter() for details. A convenience handler, childEvent(), can be reimplemented to catch child events.
TQObjects can receive events through event() and filter the events of other objects. See installEventFilter() and eventFilter() for details. A convenience handler, childEvent(), can be reimplemented to catch child events.