A class used to depict a UPnP resource, which is either a UPnP device or a UPnP service. More...
#include <HResourceType>
Public Types | |
enum | Type { Undefined = 0 } |
enum | Token { , Domain = 0x02, Type = 0x04, TypeSuffix = 0x08, Version = 0x10 } |
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.) | |
H_UPNP_CORE_EXPORT bool | operator!= (const HResourceType &, const HResourceType &) |
H_UPNP_CORE_EXPORT quint32 | qHash (const HResourceType &key) |
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.
enum Type |
Specifies the type of the resource.
See UPnP v1.1 Device Architecture specification for more information.
enum VersionMatch |
This enumeration specifies how the version part of a HResourceType is matched against a target value.
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.
HResourceType | ( | ) |
HResourceType | ( | const QString & | resourceTypeAsStr ) |
Constructs a new, empty instance from the specified parameter.
resourceTypeAsStr | specifies the resource type following the one of the following formats: |
urn:schemas-upnp-org:device:deviceType:ver
for standard device typeurn:domain-name:device:deviceType:ver
for vendor defined device typeurn:schemas-upnp-org:service:serviceType:ver
for standard service typeurn:domain-name:service:serviceType:ver for
vendor defined service type~HResourceType | ( | ) |
Destroys the instance.
Type type | ( | ) | const [inline] |
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.
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.
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.
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.
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.
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);
tokens | specifies what components of the objects are included in the returned string. The default is to return everything. |
bool compare | ( | const HResourceType & | other, |
VersionMatch | versionMatch | ||
) | const |
Compares this object to the provided object according to the specified HResourceType::VersionMatch argument.
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. |
H_UPNP_CORE_EXPORT bool operator== | ( | const HResourceType & | , |
const HResourceType & | |||
) | [friend] |
Compares the two objects for equality.
H_UPNP_CORE_EXPORT bool operator!= | ( | const HResourceType & | , |
const HResourceType & | |||
) | [related] |
Compares the two objects for inequality.
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.
key | specifies the resource type from which the hash value is created. |