Herqq
Public Member Functions | Friends | Related Functions

HServiceId Class Reference

Class that represents the service identifier of a UPnP service. More...

#include <HServiceId>

List of all members.

Public Member Functions

 HServiceId ()
 HServiceId (const QString &serviceId)
 HServiceId (const HServiceId &other)
HServiceIdoperator= (const HServiceId &other)
 ~HServiceId ()
bool isValid (HValidityCheckLevel level) const
bool isStandardType () const
QString urn (bool completeUrn=true) const
QString suffix () const
QString toString () const

Friends

H_UPNP_CORE_EXPORT bool operator== (const HServiceId &, const HServiceId &)
H_UPNP_CORE_EXPORT quint32 qHash (const HServiceId &key)

Related Functions

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

Detailed Description

Class that represents the service identifier of a UPnP service.

Service identifiers are found in UPnP device descriptions and they use the following format within services defined by the UPnP Forum:

urn:upnp-org:serviceId:serviceID 

In the above format only the tailing serviceID varies. Every service identifier of a standard service type has to begin with urn:upnp-org:serviceId:.

With a vendor defined service the format for a service identifier is:

urn:domain-name:serviceId:serviceID 

Note, according to the UDA specification Period characters in the Vendor Domain Name MUST be replaced with hyphens in accordance with RFC 2141.

In both formats, the last serviceID component is the service identifier suffix.

Note:
For interoperability reasons the class does not enforce the prefix prior to the actual serviceID to be exactly as defined in the UDA. However, you can call isValid() to check if the instance contains strictly valid information.
Remarks:
This class is not thread-safe.

Constructor & Destructor Documentation

Constructs a new, empty instance.

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

See also:
isValid
HServiceId ( const QString &  serviceId)

Constructs a new instance.

Parameters:
serviceIdspecifies the contents of the object. If the provided argument is invalid an empty instance is created. For an object to be strictly valid the parameter has to follow either of the formats exactly:
  • urn:upnp-org:serviceId:serviceID for service identifiers belonging to a standard service type.
  • urn:domain-name:serviceId:serviceID for service identifiers belonging to a vendor defined service type.

The postfix serviceID is the service identifier suffix.

Note:
a valid object will be constructed when the specified string contains the following tokens separated by a colon: "urn", "domain-name", "some string" and "some string". Case sensitivity is forced only when checking for strict validity.
See also:
isValid()
HServiceId ( const HServiceId other)

Creates a new instance based on the other instance provided.

Parameters:
otherspecifies the other instance.
~HServiceId ( )

Destroys the instance.


Member Function Documentation

HServiceId& operator= ( const HServiceId other)

Assigns the contents of the other instance to this.

Parameters:
otherspecifies the other instance.
Returns:
a reference to this instance.
bool isValid ( HValidityCheckLevel  level) const

Indicates if the service identifier is properly defined.

Parameters:
levelspecifies whether the contents of the object are checked for strict validity. Only an object that is strictly valid contains information as defined in the UDA.
Returns:
true in case the object is considered valid in terms of the requested strictness.
bool isStandardType ( ) const

Indicates whether the service identifier belongs to a standard service type defined by the UPnP forum or to a vendor defined service.

Return values:
truein case the service identifier belongs to a standard service type defined by the UPnP forum.
falsein case the service identifier belongs to a vendor defined service type or the object is invalid.
See also:
isValid()
QString urn ( bool  completeUrn = true) const

Returns the URN of the service identifier.

Parameters:
completeUrnspecifies whether the prefix urn is returned as well. If the argument is false, only the actual URN is returned. i.e if the service identifier is defined as urn:upnp-org:serviceId:MyServiceId only upnp-org is returned.
Returns:
the URN of the service identifier if the object is valid. If the object is not valid, an empty string is returned.
See also:
isValid()
QString suffix ( ) const

Returns the service identifier suffix.

Returns:
the service identifier suffix if the object is valid. For instance, if the service identifier is defined as urn:upnp-org:serviceId:MyServiceId, the suffix identifier and thus the value returned is "MyServiceId". If the object is not valid, an empty string is returned.
See also:
isValid()
QString toString ( ) const

Returns a string representation of the instance.

Returns:
a string representation of the instance. The returned string follows the format defined by UDA if the object is valid. In case of a valid object, the return value is the string that was used to construct the object. If the object is invalid, the returned string is empty.
See also:
isValid()

Friends And Related Function Documentation

H_UPNP_CORE_EXPORT bool operator== ( const HServiceId ,
const HServiceId  
) [friend]

Compares the two objects for equality.

Returns:
true in case the provided objects are equal, false otherwise.
H_UPNP_CORE_EXPORT quint32 qHash ( const HServiceId key) [friend]

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

Parameters:
keyspecifies the service ID from which the hash value is created.
Returns:
a value that can be used as a unique key in a hash-map identifying the resource type object.
bool operator!= ( const HServiceId obj1,
const HServiceId obj2 
) [related]

Compares the two objects for inequality.

Returns:
true in case the provided objects are not equal, false otherwise.