#include <service.h>
Public Methods | |
Service (const QString &url, const QString &attributes=QString::null) | |
Service (const Service &service) | |
Service & | operator= (const Service &other) |
bool | operator== (const Service &other) |
QString | url () const |
QString | serviceType () const |
QString | abstractServiceType () const |
bool | areAttributesSet () const |
QString | serializedAttributes () const |
void | setSerializedAttributes (const QString &attributes) |
QString | serializedAttributeValue (const QString &name) const |
bool | hasAttribute (const QString &attributeName) const |
bool | isList (const QString &attributeName) const |
bool | isTag (const QString &attributeName) const |
QString | getString (const QString &attributeName) const |
bool | getBool (const QString &attributeName) const |
int | getInt (const QString &attributeName) const |
QByteArray | getBlob (const QString &attributeName) const |
QStringList | getStringList (const QString &attributeName) const |
QValueVector< bool > | getBoolList (const QString &attributeName) const |
QValueVector< int > | getIntList (const QString &attributeName) const |
QValueVector< QByteArray > | getBlobList (const QString &attributeName) const |
void | remove (const QString &attributeName) |
void | setTag (const QString &attributeName) |
void | setString (const QString &attributeName, const QString &value) |
void | setBool (const QString &attributeName, bool value) |
void | setInt (const QString &attributeName, int value) |
void | setBlob (const QString &attributeName, const QByteArray &value) |
void | setStringList (const QString &attributeName, const QStringList &values) |
void | setBoolList (const QString &attributeName, const QValueVector< bool > &values) |
void | setIntList (const QString &attributeName, const QValueVector< int > &values) |
void | setBlob (const QString &attributeName, const QValueVector< QByteArray > &values) |
A service will be described using a Service URL and an optional list of attributes. Any valid URL can be used to describe the service, but usually the "service:" URL scheme is used. The syntax for such a simple Service URL is
service:srvtype://addrspecwhere "srvtype" specifies the protocol and "addrspec" the address. Examples of valid Service URLs are "service:http://www.kde.org", "service:lpr://printer.example.org/myqueue" and "service:http://your.server.org:8080". To provide more information about your service than just the protocol, port and address you can use abstract service types. A Service URL that uses an abstract service type has the form
service:abstract-type:concrete-typewhere "abstract-type" describes the kind of service and "concrete-type" specifies the protocol and address. Examples are "service:printer:lpr://printer.example.com/lp0" and "service:printer:ipp://printer.example.com/". Note that you cannot invent you own types but only take those that are registered at IANA. To create your own service type you must become a naming authority. Then you can use service types of the form "srvtype.naming-authority". Assuming that "kde" is the id of a IANA-registered naming authority, a valid Service URL would be "service:weatherp.kde://weather.example.com". You can find more information about Service URLs in the IETF RFCs 2608 and 3224.
Each service can have one or more attributes to carry additional information about the service. Attributes are name/value pairs. The name is a simple strings, the value can have several types: strings, binary objects (blobs), integers and boleans. It is possible to have a list of values in an attribute, but all list members must have the same type. Attributes can be used, for example, to describe the type of a printer or the email address of an administrator.
Service templates can be used to describe an abstract type, including the syntax of the concrete type and the attributes. The use of service templates is described in RFC 2609, you can find the existing service templates at http://www.iana.org/assignments/svrloc-templates.htm .
|
Creates a new Service with the given
|
|
Makes a deep copy of the given service.
|
|
Returns the abstract service type of the service. It is extracted from the URL. If the service does not use a abstract service scheme, it will return the same value as serviceType(). Otherwise it will return only the abstract part, e.g. "service:printer" for the URL "service:printer:ipp://printer.example.com/".
|
|
Checks whether attributes have been set in this Service object. When you do a query you will only get the attributes when you ask for them and the other server supports this, otherwise the flag will be false.
|
|
Returns the first blob value of the attribute with the given
|
|
Returns the blob values of the attribute with the given
|
|
Returns the first boolean value of the attribute with the given
|
|
Returns the boolean values of the attribute with the given
|
|
Returns the first integer value of the attribute with the given
|
|
Returns the int values of the attribute with the given
|
|
Returns the first string of the attribute with the given
|
|
Returns the values of the attribute with the given
|
|
Returns true if the attribute with the given
|
|
Returns true if the attribute with the given
|
|
Returns true if the attribute with the given
|
|
Makes a deep copy of the given service.
|
|
Compares the two services. Two services are equal when they have the same URL. The attributes will not be compared.
|
|
Removes the attribute
|
|
Returns the raw, encoded string with the attributes. It has the form (name=value,value,..),(name=value),...Reserved characters in the attribute name and values will be escaped. The exact format is described in RFC 2608.
|
|
Returns the value of the attribute value,value,..Reserved characters will be escaped.
|
|
Returns the service type of the service. It is extracted from the URL. If the URL does not use the "service:" URL scheme, the URL scheme is used, e.g. "http" will be returned for "http://www.kde.org". If the "service:" URL scheme is used, the complete service description will be returned, e.g. "service:printer:ipp" for the URL "service:printer:ipp://printer.example.com/".
|
|
Sets the value of the attribute to the given blob list. It is not recommended to set a blob list that is larger than a couple of hundred bytes. While the SLP standard allows it, a server is likely to limit the size of SLP messages and thus will no be able to return a blob of that size. Also note that because of the encoding the transmitted size will be three times as large as the binary.
|
|
Sets the value of the attribute to the given blob. It is not recommended to set a blob that is larger than a couple of hundred bytes. While the SLP standard allows it, a server is likely to limit the size of SLP messages and thus will no be able to return a blob of that size. Also note that because of the encoding the transmitted size will be three times as large as the binary.
|
|
Sets the value of the attribute to the given boolean.
|
|
Sets the value of the attribute to the given boolean list.
|
|
Sets the value of the attribute to the given integer.
|
|
Sets the value of the attribute to the given integer list.
|
|
Sets the raw, encoded attribute string. Replaces all existing attributes. The exact format is described in RFC 2608.
|
|
Sets the value of the attribute to the given string. Note that SLP attributes do not have real types, so you can also set an integer or boolean using setString() as long as they have the right syntax.
|
|
Sets the value of the attribute to the given string list.
|
|
Makes
|
|
Returns the URL of the service.
|