#include <object.h>
Inheritance diagram for PObject:
Comparison functions | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
virtual Comparison | Compare (const PObject &obj) const |
Compare the two objects and return their relative rank. | |
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const |
Determine the byte wise comparison of two objects. | |
bool | operator== (const PObject &obj) const |
Compare the two objects. | |
bool | operator!= (const PObject &obj) const |
Compare the two objects. | |
bool | operator< (const PObject &obj) const |
Compare the two objects. | |
bool | operator> (const PObject &obj) const |
Compare the two objects. | |
bool | operator<= (const PObject &obj) const |
Compare the two objects. | |
bool | operator>= (const PObject &obj) const |
Compare the two objects. | |
Run Time Type functions | |
virtual const char * | GetClass (unsigned ancestor=0) const |
Get the current dynamic type of the object instance. | |
PBoolean | IsClass (const char *cls) const |
virtual PBoolean | InternalIsDescendant (const char *clsName) const |
Determine if the dynamic type of the current instance is a descendent of the specified class. | |
static const char * | Class () |
Get the name of the class as a C string. | |
I/O functions | |
virtual void | PrintOn (ostream &strm) const |
Output the contents of the object to the stream. | |
virtual void | ReadFrom (istream &strm) |
Input the contents of the object from the stream. | |
ostream & | operator<< (ostream &strm, const PObject &obj) |
Global function for using the standard << operator on objects descended from PObject. | |
istream & | operator>> (istream &strm, PObject &obj) |
Global function for using the standard >> operator on objects descended from PObject. | |
Public Member Functions | |
virtual | ~PObject () |
Miscellaneous functions | |
virtual PObject * | Clone () const |
Create a copy of the class on the heap. | |
virtual PINDEX | HashFunction () const |
This function yields a hash value required by the PDictionary class. | |
Protected Member Functions | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. |
This provides functionality provided to all classes, eg run-time types, default comparison operations, simple stream I/O and serialisation support.
enum PObject::Comparison |
Result of the comparison operation performed by the Compare()
function.
PObject::PObject | ( | ) | [inline, protected] |
Constructor for PObject, made protected so cannot ever create one on its own.
virtual PObject::~PObject | ( | ) | [inline, virtual] |
static const char* PObject::Class | ( | ) | [inline, static] |
Get the name of the class as a C string.
This is a static function which returns the type of a specific class.
When comparing class names, always use the strcmp()
function rather than comparing pointers. The pointers are not necessarily the same over compilation units depending on the compiler, platform etc.
virtual PObject* PObject::Clone | ( | ) | const [virtual] |
Create a copy of the class on the heap.
The exact semantics of the descendent class determine what is required to make a duplicate of the instance. Not all classes can even do a clone operation.
The main user of the clone function is the PDictionary
class as it requires copies of the dictionary keys.
The default behaviour is for this function to assert.
Reimplemented in PBaseArray< T >, PArray< T >, PBitArray, POrdinalKey, PSet< T >, PDictionary< K, D >, POrdinalDictionary< K >, PList< T >, PQueue< T >, PStack< T >, PSortedList< T >, PString, PCaselessString, PStringDictionary< K >, PTime, PTCPSocket, PTimeInterval, PASN_Null, PASN_Boolean, PASN_Integer, PASN_Enumeration, PASN_Real, PASN_ObjectId, PASN_BitString, PASN_OctetString, PASN_BMPString, PASN_Sequence, PASN_Set, PGloballyUniqueID, PHTTPSimpleAuth, PHTTPMultiSimpAuth, PASNObject, PASNInteger, PASNString, PASNIPAddress, PASNTimeTicks, PASNCounter, PASNGauge, PASNObjectID, PASNNull, PRFC1155_ObjectName, PRFC1155_ObjectSyntax, PRFC1155_SimpleSyntax, PRFC1155_ApplicationSyntax, PRFC1155_NetworkAddress, PRFC1155_IpAddress, PRFC1155_Counter, PRFC1155_Gauge, PRFC1155_TimeTicks, PRFC1155_Opaque, PSNMP_PDUs, PSNMP_VarBind, PSNMP_VarBindList, PSNMP_PDU, PSNMP_Trap_PDU, PSNMP_GetRequest_PDU, PSNMP_GetNextRequest_PDU, PSNMP_GetResponse_PDU, PSNMP_SetRequest_PDU, PSNMP_Message, PSocks4Socket, PSocks5Socket, PSocksUDPSocket, XMPP::JID, XMPP::BareJID, PBaseArray< PObject * >, PBaseArray< berval * >, PBaseArray< char * >, PArray< PBYTEArray >, PArray< PPluginService >, PArray< PDynaLink >, PArray< PXMLRPCVariableBase >, PArray< PODBC::Field >, PDictionary< PString, XMPP::Presence >, PDictionary< PRFC1155_ObjectName, PRFC1155_ObjectSyntax >, PDictionary< XMPP::JID, PNotifierList >, PDictionary< PString, PXMLRPCVariableBase >, PDictionary< PString, PLDAPAttributeBase >, PDictionary< PString, PNotifierList >, PList< PSafeObject >, PList< PNotifier >, PList< PMultiPartInfo >, and PQueue< PXML >.
virtual Comparison PObject::Compare | ( | const PObject & | obj | ) | const [virtual] |
Compare the two objects and return their relative rank.
This function is usually overridden by descendent classes to yield the ranking according to the semantics of the object.
The default function is to use the CompareObjectMemoryDirect()
function to do a byte wise memory comparison of the two objects.
LessThan
, EqualTo
or GreaterThan
according to the relative rank of the objects. Reimplemented in PAbstractArray, PArrayObjects, PChannel, POrdinalKey, PHashTable, PFile, PIndirectChannel, PIPSocket::Address, PAbstractList, PAbstractSortedList, PPipeChannel, PProcess, PString, PTime, PRemoteConnection, PSafePtrBase, PSafePtrMultiThreaded, PSmartPointer, PTimeInterval, PASN_Null, PASN_Boolean, PASN_Integer, PASN_Enumeration, PASN_Real, PASN_ObjectId, PASN_BitString, PASN_OctetString, PASN_ConstrainedString, PASN_BMPString, PASN_Choice, PASN_Sequence, PASN_Array, PDNS::NAPTRRecord, PHTTPClientAuthentication, PHTTPClientBasicAuthentication, PHTTPClientDigestAuthentication, PHTTPField, PServiceMacro, PIpAccessControlEntry, PMemoryFile, PDNS::SRVRecord, MXRecord, PSNMP_VarBind, PSNMP_PDU, PSNMP_Trap_PDU, PSNMP_Message, PURL, XMPP::JID, XMPP::BareJID, and XMPP::MUC::User.
virtual Comparison PObject::CompareObjectMemoryDirect | ( | const PObject & | obj | ) | const [virtual] |
Determine the byte wise comparison of two objects.
This is the default comparison operation for objects that do not explicitly override the Compare()
function.
The PCLASSINFO
macro declares an override of this function for the particular class. The user need not implement it.
LessThan
, EqualTo
or GreaterThan
according to the result memcpy()
function. virtual const char* PObject::GetClass | ( | unsigned | ancestor = 0 |
) | const [inline, virtual] |
Get the current dynamic type of the object instance.
When comparing class names, always use the strcmp()
function rather than comparing pointers. The pointers are not necessarily the same over compilation units depending on the compiler, platform etc.
The PCLASSINFO
macro declares an override of this function for the particular class. The user need not implement it.
virtual PINDEX PObject::HashFunction | ( | ) | const [virtual] |
This function yields a hash value required by the PDictionary
class.
A descendent class that is required to be the key of a dictionary should override this function. The precise values returned is dependent on the semantics of the class. For example, the PString
class overrides it to provide a hash function for distinguishing text strings.
The default behaviour is to return the value zero.
Reimplemented in PChannel, POrdinalKey, PString, PRemoteConnection, PGloballyUniqueID, and PURL.
virtual PBoolean PObject::InternalIsDescendant | ( | const char * | clsName | ) | const [inline, virtual] |
Determine if the dynamic type of the current instance is a descendent of the specified class.
The class name is usually provided by the Class()
static function of the desired class.
The PCLASSINFO
macro declares an override of this function for the particular class. The user need not implement it.
PBoolean PObject::IsClass | ( | const char * | cls | ) | const [inline] |
bool PObject::operator!= | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator< | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator<= | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator== | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator> | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator>= | ( | const PObject & | obj | ) | const [inline] |
Compare the two objects.
Reimplemented in PString.
virtual void PObject::PrintOn | ( | ostream & | strm | ) | const [virtual] |
Output the contents of the object to the stream.
The exact output is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator<<
function.
The default behaviour is to print the class name.
Reimplemented in PArgList, PAbstractArray, PCharArray, PCollection, POrdinalKey, PAbstractDictionary, PIPSocket::InterfaceEntry, PString, PRegularExpression, PTime, PThread, PTimeInterval, PVideoFrameInfo, PASN_Null, PASN_Boolean, PASN_Integer, PASN_Enumeration, PASN_Real, PASN_ObjectId, PASN_BitString, PASN_OctetString, PASN_ConstrainedString, PASN_BMPString, PASN_Choice, PASN_Sequence, PASN_Array, PASN_Stream, PDNS::NAPTRRecord, PGloballyUniqueID, PIpAccessControlEntry, PMIMEInfo, PASNObject, PASNInteger, PASNString, PASNUnsignedInteger, PASNObjectID, PASNNull, PASNSequence, PDNS::SRVRecord, MXRecord, PLDAPStructBase, PNatMethod, PSNMPVarBindingList, PXML, PXMLElement, PXMLRPCArrayBase, PXMLRPCStructBase, PSNMP_VarBind, PSNMP_PDU, PSNMP_Trap_PDU, PSNMP_Message, PURL, and XMPP::JID.
virtual void PObject::ReadFrom | ( | istream & | strm | ) | [virtual] |
Input the contents of the object from the stream.
The exact input is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator>>
function.
The default behaviour is to do nothing.
Reimplemented in PArgList, PAbstractArray, PCharArray, PString, PStringArray, PStringList, PSortedStringList, PStringSet, POrdinalToString, PStringToOrdinal, PStringToString, PTime, PTimeInterval, PGloballyUniqueID, PIpAccessControlEntry, PMIMEInfo, PXML, and PURL.
ostream& operator<< | ( | ostream & | strm, | |
const PObject & | obj | |||
) | [friend] |
istream& operator>> | ( | istream & | strm, | |
PObject & | obj | |||
) | [friend] |
Global function for using the standard >> operator on objects descended from PObject.
This simply calls the objects ReadFrom()
function.
strm
parameter. strm | Stream to read the objects contents from. |
obj | Object to read inormation into. |