File Information
Library: UPnP
Package: Core
Header: Poco/UPnP/URN.h
Description
A Uniform Resource Name, or URN, is a variant of an URI that stores a structured name used to identify an entity. In UPnP, URNs are used to identify devices, device types and service types, as well as SSDP notification types.
This class is used to create and parse the different kinds of URNs used by UPnP:
- UUID-based URNs (uuid:<device-UUID>[...]), as used for USNs.
- Root Device (upnp:rootdevice), for announcing a root device with SSDP.
- URNs containing device or service name, type and version (urn:<domain-name>:<name>:<type>:<version>)
- Service IDs (urn:upnp-org:serviceId:serviceID), as used in XML device descriptions.
URN supports full value semantics, including comparison operators. Note, however, that copying URN values may be expensive.
Note: some device manufacturers use strings like "uuid:UPnP_Thomson TG585 v7-1_00-1F-9F-E9-24-14" for their UUIDs. Since these are not valid UUIDs we don't use the Poco::UUID class for storing them.
Member Summary
Member Functions: clear, domain, empty, majorVersion, matches, minorVersion, name, operator !=, operator <, operator <=, operator =, operator ==, operator >, operator >=, scheme, swap, toString, type, uuid, version
Enumerations
Type
URN_UUID = 0
uuid:<device-UUID>
upnp:rootdevice
urn:<domain-name>:device:<type>:<version>
urn:<domain-name>:service:<type>:<version>
urn:upnp-org:serviceId:<serviceId>
Constructors
URN
URN();
Creates an empty URN.
URN
Creates a root device URN.
Note: type must always be URN_ROOT_DEVICE.
URN
Creates a URN by copying another one.
URN
explicit URN(
const std::string & urn
);
Creates a URN by parsing the given string.
URN
explicit URN(
const Poco::UUID & uuid
);
URN
URN(
Type type,
const std::string & serviceId
);
Creates a URN of type URN_SERVICEID using the given serviceId.
Type must be URN_SERVICEID.
URN
URN(
Type type,
const std::string & name,
const std::string & version
);
Creates a URN of type URN_DEVICE or URN_SERVICE, using the given name and version. The domain is set to "schemas-upnp-org".
Type must be URN_DEVICE or URN_SERVICE.
URN
URN(
Type type,
const std::string & domain,
const std::string & name,
const std::string & version
);
Creates a URN of type URN_DEVICE or URN_SERVICE, using the given domain, name and version.
Type must be URN_DEVICE or URN_SERVICE.
Destructor
~URN
~URN();
Destroys the URN.
Member Functions
clear
void clear();
Clears the URN.
domain
const std::string & domain() const;
Returns the URN domain part (e.g. "schemas-upnp-org").
empty
bool empty() const;
Returns true iff the URN is empty.
majorVersion
int majorVersion() const;
Returns the major version number.
A version is set for types URN_DEVICE and URN_SERVICE only.
matches
bool matches(
const URN & urn
) const;
Compares type, scheme, domain and name and checks whether this URN's version is greater or equal to urn's version.
matches
bool matches(
const std::string & urn
) const;
Compares type, scheme, domain and name and checks whether this URN's version is greater or equal to urn's version.
minorVersion
int minorVersion() const;
Returns the minor version number.
A version is set for types URN_DEVICE and URN_SERVICE only.
name
const std::string & name() const;
Returns the name of the service/device.
operator !=
bool operator != (
const URN & urn
) const;
operator !=
bool operator != (
const std::string & urn
) const;
operator <
bool operator < (
const URN & urn
) const;
operator <
bool operator < (
const std::string & urn
) const;
operator <=
bool operator <= (
const URN & urn
) const;
operator <=
bool operator <= (
const std::string & urn
) const;
operator =
URN & operator = (
const URN & urn
);
Assignment operator.
operator =
URN & operator = (
const std::string & urn
);
Parses an URN from the given string and assigns it.
operator ==
bool operator == (
const URN & urn
) const;
operator ==
bool operator == (
const std::string & urn
) const;
operator >
bool operator > (
const URN & urn
) const;
operator >
bool operator > (
const std::string & urn
) const;
operator >=
bool operator >= (
const URN & urn
) const;
operator >=
bool operator >= (
const std::string & urn
) const;
scheme
const std::string & scheme() const;
Returns the URN scheme part, which will be one of "uuid", "upnp" or "urn".
swap
void swap(
URN & urn
);
Exchanges the URN with another one.
toString
const std::string & toString() const;
Converts a URN to a string.
type
URN::Type type() const;
Returns the type of the URN.
uuid
const std::string & uuid() const;
version
const std::string & version() const;
Returns the version string (<major>.<minor>).
A version is set for types URN_DEVICE and URN_SERVICE only.
Variables
DEVICE
static const std::string DEVICE;
ROOTDEVICE
static const std::string ROOTDEVICE;
SCHEMAS_UPNP_ORG
static const std::string SCHEMAS_UPNP_ORG;
SERVICE
static const std::string SERVICE;
SERVICEID
static const std::string SERVICEID;
UPNP_ORG
static const std::string UPNP_ORG;
UPNP_SCHEME
static const std::string UPNP_SCHEME;
URN_SCHEME
static const std::string URN_SCHEME;
UUID_SCHEME
static const std::string UUID_SCHEME;