Herqq

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends | Related Functions

# HResourceType Class Reference
Common

This is a class used to depict a UPnP resource, which is either a UPnP device or a UPnP service. More...

`#include <HResourceType>`

List of all members.

## Public Types
enum | Type { Undefined = 0, StandardDeviceType, StandardServiceType, VendorSpecifiedDeviceType, VendorSpecifiedServiceType }
enum | VersionMatch { Ignore, Exact, Inclusive, EqualOrGreater }
enum | Token { None = 0x00, UrnPrefix = 0x01, Domain = 0x02, Type = 0x04, TypeSuffix = 0x08, Version = 0x10, All = 0x1f }
## Public Member Functions
| HResourceType ()
| HResourceType (const QString &resourceTypeAsStr)
| ~HResourceType ()
Type | type () const
bool | isValid () const
bool | isDeviceType () const
bool | isServiceType () const
bool | isStandardType () const
qint32 | version () const
QString | toString (Tokens tokens=All) const
bool | compare (const HResourceType &other, VersionMatch versionMatch) const
## Friends
H_UPNP_CORE_EXPORT bool | operator== (const HResourceType &, const HResourceType &)
## Related Functions
(Note that these are not member functions.)
bool | operator!= (const HResourceType &obj1, const HResourceType &obj2)
H_UPNP_CORE_EXPORT quint32 | qHash (const HResourceType &key)

## Detailed Description

This is a class used to depict a UPnP resource, which is either a UPnP device or a UPnP service.

Both UPnP device and service descriptions use the type concept to a give the corresponding device or service context that can be used in identification. In device descriptions the device type is specified following the format

    urn:schemas-upnp-org:device:deviceType:ver

or

    urn:domain-name:device:deviceType:ver

in case of a vendor defined type.

In service descriptions the service type is specified as

    urn:schemas-upnp-org:service:serviceType:ver

or

    urn:domain-name:service:serviceType:ver

in case of a vendor defined type.

For more information, see the device type and service type definitions in UDA v1.1 at pages 44 and 46, respectively.

This class abstracts the above service and device type concepts to a resource and helps in handling the various elements of a resource type.

Remarks:
  This class is not thread-safe.

## Member Enumeration Documentation

enum Type

Specifies the type of the resource.

See UPnP v1.1 Device Architecture specification for more information.

Enumerator:

  Undefined | No resource defined. This is used when the object is constructed using the default constructor.
  StandardDeviceType | The resource is urn:schemas-upnp-org:device:deviceType:ver.
  StandardServiceType | The resource is urn:schemas-upnp-org:service:serviceType:ver.
  VendorSpecifiedDeviceType | The resource is urn:domain-name:device:deviceType:ver.
  VendorSpecifiedServiceType | The resource is urn:domain-name:service:serviceType:ver.

enum VersionMatch

This enumeration specifies how the version part of a HResourceType is matched against a target value.

Enumerator:

  Ignore | The version part of HResoureType objects is ignored.
  Exact | The version part of HResourceType object has to be identical to the specified value.
  Inclusive | The version part of HResourceType object has to be less than or equal to the specified value.
  EqualOrGreater | The version part of HResourceType object has to be greater than or equal to the specified value.

enum Token

Enumeration that specifies the tokens or parts of a resource type.

For instance, if the resource type is defined as `urn:schemas-upnp-org:device:deviceType:ver` then the tokens are the parts separated by colons.

Enumerator:

  None | This is a special value used to denote "no tokens".
  UrnPrefix | The "urn:" token.
  Domain | The domain token, e.g. "schemas-upnp-org".
  Type | The type of the resource, e.g. "device" or "service".
  TypeSuffix | The type suffix of the resource, e.g. "deviceType" or "serviceType".
  Version | The version of the resource type. Most commonly this is an integer.
  All | This is a special value used to denote "all tokens".

## Constructor & Destructor Documentation

HResourceType | ( |  | ) |

Constructs a new, empty instance.

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

See also:
  isValid()

HResourceType | ( | const QString & | resourceTypeAsStr | ) |

Constructs a new, empty instance from the specified parameter.

Parameters:

  resourceTypeAsStr | specifies the resource type following the one of the following formats:

- `urn:schemas-upnp-org:device:deviceType:ver` for standard device type

- `urn:domain-name:device:deviceType:ver` for vendor defined device type

- `urn:schemas-upnp-org:service:serviceType:ver` for standard service type

- `urn:domain-name:service:serviceType:ver for` vendor defined service type

See also:
  isValid()

~HResourceType | ( |  | ) |

Destroys the instance.

## Member Function Documentation

Type type | ( |  | ) | const`[inline]`

Returns the type of the resource.

Returns:
  The type of the resource.

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

Indicates if the object is valid.

This method is provided for convenience. It simply checks if the type() is HResourceType::Undefined.

Returns:
  true in case the object represents a valid resource type.

bool isDeviceType | ( |  | ) | const`[inline]`

Indicates whether or not the resource type is a device type.

This method is provided for convenience. It checks if the type is either HResourceType::StandardDeviceType or HResourceType::VendorSpecifiedDeviceType.

Returns:
  true in case the resource type is a device type.

bool isServiceType | ( |  | ) | const`[inline]`

Indicates whether or not the resource type is a service type.

This method is provided for convenience. It checks if the type is either HResourceType::StandardServiceType or HResourceType::VendorSpecifiedServiceType.

Returns:
  true in case the resource type is a service type.

bool isStandardType | ( |  | ) | const`[inline]`

Indicates whether or not the resource type is a standard type defined by the UPnP forum.

This method is provided for convenience. It checks if the type is either HResourceType::StandardDeviceType or HResourceType::StandardServiceType.

Return values:

  true | in case the resource type is defined by the UPnP forum.
  false | in case the resource type is vendor defined.

qint32 version | ( |  | ) | const

Returns the version of the resource type.

Returns:
  the version of the resource type if the object is valid. In case the object is invalid -1 is returned.

See also:
  isValid()

QString toString | ( | Tokens | tokens = `All` | ) | const

Returns a string representation of the object.

A resource type can be broken into 5 tokens, which are depicted in the Token enum. This function is used to retrieve an arbitrary combination of these tokens as a string. For instance, if you would like to retrieve the resource type, resource type suffix and the version as a string you would issue:

     QString retVal = tokens(
         HResourceType::Type | HResourceType::TypeSuffix | HResourceType::Version);

Parameters:

  tokens | specifies what components of the objects are included in the returned string. The default is to return everything.

Returns:
  a string representation of the object as defined by the provided tokens if the object is valid. Otherwise an empty string is returned.

Remarks:
  By default the contents of the object are returned in full.

bool compare | ( | const HResourceType & | other,
|  | VersionMatch | versionMatch
| ) |  | const

Compares this object to the provided object according to the specified HResourceType::VersionMatch argument.

Parameters:

  other | specifies the other `HResourceType` object.
  versionMatch | specifies how the version information in the objects are compared against one another. The target of the comparison is always this object. Therefore if the `versionMatch` is set to HResourceType::Inclusive, the specified other object defines the upper bound for the comparison.

Returns:
  true in case the two objects are considered a match taking into account the specified HResourceType::VersionMatch argument.

## Friends And Related Function Documentation

H_UPNP_CORE_EXPORT bool operator== | ( | const HResourceType & | ,
|  | const HResourceType & |
| ) |  | `[friend]`

Compares the two objects for equality.

Returns:
  true in case the object are logically equivalent.

bool operator!= | ( | const HResourceType & | obj1,
|  | const HResourceType & | obj2
| ) |  | `[related]`

Compares the two objects for inequality.

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

H_UPNP_CORE_EXPORT quint32 qHash | ( | const HResourceType & | key | ) | `[related]`

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

Parameters:

  key | specifies the resource type 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.