Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

regina::NPacketListener Class Reference
[Basic Packet Types]

An object that can be registered to listen for packet events. More...

#include <npacketlistener.h>

List of all members.

Public Member Functions

virtual ~NPacketListener ()
 Destroys this listener.
void unregisterFromAllPackets ()
 Unregisters this listener from any packets to which it is currently listening.
virtual void packetWasChanged (NPacket *packet)
 Called when the contents of the packet have been changed.
virtual void packetWasRenamed (NPacket *packet)
 Called when the packet label has been changed.
virtual void packetToBeDestroyed (NPacket *packet)
 Called when the packet is about to be destroyed.
virtual void childWasAdded (NPacket *packet, NPacket *child)
 Called when a child packet has been inserted directly beneath the packet.
virtual void childWasRemoved (NPacket *packet, NPacket *child)
 Called when a child packet has been removed from directly beneath the packet.
virtual void childrenWereReordered (NPacket *packet)
 Called when the child packets directly beneath the packet have been reordered.

Friends

class NPacket
 Allow packets to automatically deregister listeners as they are destroyed.


Detailed Description

An object that can be registered to listen for packet events.

A packet listener can be registered to listen for events on a packet by calling NPacket::listen().

Each time that one of the events listed in this class occurs, the packet will call the appropriate routine for all registered packet listeners.

Note that these events are mutually exclusive, i.e., any event will cause at most one routine to be called for each listener. For instance, if a packet is renamed then packetWasRenamed() will be called but packetWasChanged() will not.

No guarantees are made as to the order in which the different packet listeners are notified of an event.

Note that when a listener is destroyed, it is automatically unregistered from any packets to which it is currently listening. Similarly, when a packet is destroyed all listeners are automatically unregistered.

Python:
Not present.


Constructor & Destructor Documentation

virtual regina::NPacketListener::~NPacketListener  )  [virtual]
 

Destroys this listener.

This listener will be unregistered from any packets to which it is currently listening.


Member Function Documentation

void regina::NPacketListener::childrenWereReordered NPacket packet  )  [inline, virtual]
 

Called when the child packets directly beneath the packet have been reordered.

The default implementation of this routine is to do nothing.

Parameters:
packet the packet being listened to.

void regina::NPacketListener::childWasAdded NPacket packet,
NPacket child
[inline, virtual]
 

Called when a child packet has been inserted directly beneath the packet.

The default implementation of this routine is to do nothing.

Parameters:
packet the packet being listened to.
child the child packet that was added.

void regina::NPacketListener::childWasRemoved NPacket packet,
NPacket child
[inline, virtual]
 

Called when a child packet has been removed from directly beneath the packet.

Note that the child packet may be about to be destroyed (although this destruction will not have happened yet).

The default implementation of this routine is to do nothing.

Parameters:
packet the packet being listened to.
child the child packet that was removed.

void regina::NPacketListener::packetToBeDestroyed NPacket packet  )  [inline, virtual]
 

Called when the packet is about to be destroyed.

Note that this event is called before the packet is destroyed, not after.

When an entire packet subtree is to be destroyed, child packets will notify their listeners of the impending destruction before parent packets will.

The default implementation of this routine is to do nothing.

Parameters:
packet the packet being listened to.

void regina::NPacketListener::packetWasChanged NPacket packet  )  [inline, virtual]
 

Called when the contents of the packet have been changed.

The default implementation of this routine is to do nothing.

Parameters:
packet the packet being listened to.

void regina::NPacketListener::packetWasRenamed NPacket packet  )  [inline, virtual]
 

Called when the packet label has been changed.

The default implementation of this routine is to do nothing.

Parameters:
packet the packet being listened to.

void regina::NPacketListener::unregisterFromAllPackets  ) 
 

Unregisters this listener from any packets to which it is currently listening.


Friends And Related Function Documentation

friend class NPacket [friend]
 

Allow packets to automatically deregister listeners as they are destroyed.


The documentation for this class was generated from the following file:
Copyright © 1999-2004, Ben Burton
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).