Public Member Functions | Friends | Related Functions

# HUdn Class Reference
[Common]

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)
bool | isValid (HValidityCheckLevel checkLevel) const
QUuid | value () const
QString | toString () const
QString | toSimpleUuid () const
## 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.)
H_UPNP_CORE_EXPORT bool | operator!= (const HUdn &, const HUdn &)

## Detailed Description

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, but it is lightweight to be used by-value.

## 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:

  | value | specifies 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:

  | value | specifies 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

## Member Function Documentation

bool isValid | ( | HValidityCheckLevel | checkLevel | ) | const`[inline]`

Indicates if the UDN is defined or not.

Parameters:

  | checkLevel | specifies 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.

## 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:

  | key | specifies 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.

H_UPNP_CORE_EXPORT bool operator!= | ( | const HUdn & | ,
|  | const HUdn & |  |
| ) |  |  | `[related]`

Compares the two objects for inequality.

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