Herqq
Public Member Functions | Static Public Member Functions | Friends | Related Functions

HUdn Class Reference

This is a class used to depict a Unique Device Name (UDN), which is a unique device identifier that has to remain the same over time for a specific device instance. More...

#include <HUdn>

List of all members.

Public Member Functions

 HUdn ()
 HUdn (const QUuid &value)
 HUdn (const QString &value)
 ~HUdn ()
bool isValid (HValidityCheckLevel checkLevel) const
QUuid value () const
QString toString () const
QString toSimpleUuid () const

Static Public Member Functions

static HUdn createUdn ()

Friends

H_UPNP_CORE_EXPORT quint32 qHash (const HUdn &)
H_UPNP_CORE_EXPORT bool operator== (const HUdn &, const HUdn &)

Related Functions

(Note that these are not member functions.)
bool operator!= (const HUdn &obj1, const HUdn &obj2)

Detailed Description

This is a class used to depict a Unique Device Name (UDN), which is a unique device identifier that has to remain the same over time for a specific device instance.

A valid UDN follows the format "uuid:"+"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", where the five hex fields form up a valid UUID.

Remarks:
This class is not thread-safe.

Constructor & Destructor Documentation

HUdn ( )

Constructs a new, empty instance.

Instance created by this constructor is not valid, i.e. isValid() will return false.

See also:
isValid
HUdn ( const QUuid &  value)

Constructs a new instance based on the provided value.

Parameters:
valuespecifies the UUID of the UDN. If the provided UUID is invalid, the created HUdn is invalid as well.
See also:
isValid
HUdn ( const QString &  value)

Constructs a new instance based on the provided value.

Parameters:
valuespecifies the string from which the object is constructed. The argument has to contain a valid UUID and it can be prefixed with "uuid:". The UUID part in turn must be formatted along the requirements of QUuid: the string "must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the argument does not form a proper UUID, the created UDN is invalid.
See also:
isValid
~HUdn ( )

Destroys the instance.


Member Function Documentation

bool isValid ( HValidityCheckLevel  checkLevel) const [inline]

Indicates if the UDN is defined or not.

Parameters:
checkLevelspecifies whether the check should be done strictly according to the UDA specifications (1.0 & 1.1). That is, the UDN has to contain a proper UUID. If checkLevel is false the UDN is considered valid if it is not empty.
Returns:
true in case the UDN is valid considering the checkLevel argument.
QUuid value ( ) const

Returns the UUID component of the UDN.

Returns:
The UUID component of the UDN.
Remarks:
if the UDN is not strictly valid, i.e. isValid(true) returns false, this method will return a null QUuid.
QString toString ( ) const

Returns the complete UDN value.

Returns:
the complete UDN value when the UDN is valid. For instance, "uuid:5d794fc2-5c5e-4460-a023-f04a51363300" is a valid UDN. Otherwise an empty string is returned.
QString toSimpleUuid ( ) const

Returns the UUID component of the UDN as string.

Returns:
the UUID component of the UDN as string when the UDN is valid. For instance, if the complete UDN is "uuid:5d794fc2-5c5e-4460-a023-f04a51363300", this method will return "5d794fc2-5c5e-4460-a023-f04a51363300". Otherwise an empty string is returned.
HUdn createUdn ( ) [static]

Creates a new strictly valid UDN.

Returns:
a new strictly valid UDN.

Friends And Related Function Documentation

H_UPNP_CORE_EXPORT quint32 qHash ( const HUdn ) [friend]

Returns a value that can be used as a unique key in a hash-map identifying the UDN object.

Parameters:
keyspecifies the UDN from which the hash value is created.
Returns:
a value that can be used as a unique key in a hash-map identifying the UDN object.
H_UPNP_CORE_EXPORT bool operator== ( const HUdn ,
const HUdn  
) [friend]

Compares the two objects for equality.

Returns:
true in case the object are logically equivalent.
bool operator!= ( const HUdn obj1,
const HUdn obj2 
) [related]

Compares the two objects for inequality.

Returns:
true in case the objects are not logically equivalent.