Regina 7.3 Calculation Engine
|
Gives access to the final remains of a packet that is in the process of being destroyed. More...
#include <packet/packet.h>
Public Member Functions | |
PacketShell (const Packet *packet) | |
Creates a new shell referring to the given packet. More... | |
PacketShell (const PacketShell &shell)=default | |
Creates a copy of the given shell. More... | |
PacketShell & | operator= (const PacketShell &shell)=default |
Sets this to be a copy of the given shell. More... | |
bool | operator== (const PacketShell &shell) const |
Identifies if this and the given shell refer to the same underlying packet. More... | |
bool | operator== (const Packet *packet) const |
Identifies if this shell refers to the given packet. More... | |
bool | operator!= (const PacketShell &shell) const |
Identifies if this and the given shell refer to different underlying packets. More... | |
bool | operator!= (const Packet *packet) const |
Identifies if this shell does not refer to the given packet. More... | |
const std::string & | label () const |
Returns the label associated with this individual packet. More... | |
std::string | humanLabel () const |
Returns the label associated with this individual packet, adjusted if necessary for human-readable output. More... | |
bool | hasTag (const std::string &tag) const |
Determines whether this packet has the given associated tag. More... | |
bool | hasTags () const |
Determines whether this packet has any associated tags at all. More... | |
const std::set< std::string > & | tags () const |
Returns the set of all tags associated with this packet. More... | |
std::string | internalID () const |
Returns a unique string ID that identifies this packet. More... | |
Gives access to the final remains of a packet that is in the process of being destroyed.
The main use of this class is to pass packet details to the callback function PacketListener::packetBeingDestroyed().
All functions in this class mirror the corresponding Packet functions, and are safe to call during PacketListener::packetBeingDestroyed().
This class works with raw Packet pointers, not std::shared_ptr, because it typically only becomes relevant when a Packet is already in the process of being destroyed (and so it is improper for a new shared pointer to suddenly appear and try to claim ownership of the packet again).
These are lightweight objects, small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions. Copies of a PacketShell will give access to the remains of the same underlying packet.
|
inline |
Creates a new shell referring to the given packet.
packet | the packet to refer to. |
|
default |
Creates a copy of the given shell.
Both shells will refer to the same underlying packet.
shell | the shell to clone. |
|
inline |
Determines whether this packet has the given associated tag.
See Packet::tags() for further details on packet tags.
tag | the tag to search for. |
true
if the given tag is found, false
otherwise.
|
inline |
Determines whether this packet has any associated tags at all.
See Packet::tags() for further details on packet tags.
true
if this packet has any tags, false
otherwise.
|
inline |
Returns the label associated with this individual packet, adjusted if necessary for human-readable output.
See Packet::label() and Packet::humanLabel() for further details on packet labels.
|
inline |
Returns a unique string ID that identifies this packet.
The user has no control over this ID and it is not human readable, but it is guaranteed to be unique to this packet, and to remain fixed throughout the lifetime of the program for this packet.
See Packet::internalID() for further details.
|
inline |
Returns the label associated with this individual packet.
See Packet::label() and Packet::humanLabel() for further details on packet labels.
The reference that is returned should be only used as a temporary, since the underlying packet (and therefore the string that is referenced) is in the process of being destroyed.
|
inline |
Identifies if this shell does not refer to the given packet.
This test is also available the other way around (with PacketShell on the right); this reversed test is defined as a global function.
packet | the packet to test against; this may be null . |
true
if and only if this shell does not refer to the given packet.
|
inline |
Identifies if this and the given shell refer to different underlying packets.
shell | the shell to compare with this. |
true
if and only if both shells refer to different packets.
|
default |
Sets this to be a copy of the given shell.
Both shells will refer to the same underlying packet.
shell | the shell to clone. |
|
inline |
Identifies if this shell refers to the given packet.
This test is also available the other way around (with PacketShell on the right); this reversed test is defined as a global function.
packet | the packet to test against; this may be null . |
true
if and only if this shell refers to the given packet.
|
inline |
Identifies if this and the given shell refer to the same underlying packet.
shell | the shell to compare with this. |
true
if and only if both shells refer to the same packet.
|
inline |
Returns the set of all tags associated with this packet.
See Packet::tags() for further details on packet tags.
The reference that is returned should be only used as a temporary, since the underlying packet (and therefore the set that is referenced) is in the process of being destroyed.