mirror of
https://invent.kde.org/network/krfb
synced 2024-07-08 12:05:49 +00:00
Support for encoded attribute values
svn path=/trunk/kdenetwork/krfb/; revision=168233
This commit is contained in:
parent
ea496a3925
commit
6c5421eb52
|
@ -110,6 +110,16 @@ void KServiceRegistry::unregisterService(const QString &serviceURL) {
|
|||
this);
|
||||
}
|
||||
|
||||
QString KServiceRegistry::encodeAttributeValue(const QString &value) {
|
||||
char *n;
|
||||
if (SLPEscape(value.latin1(), &n, SLP_TRUE) == SLP_OK) {
|
||||
QString r(n);
|
||||
SLPFree(n);
|
||||
return r;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
KServiceRegistry::KServiceRegistry(const QString &lang) :
|
||||
|
@ -139,4 +149,15 @@ bool KServiceRegistry::registerService(const QString &, QMap<QString,QString>, u
|
|||
void KServiceRegistry::unregisterService(const QString &) {
|
||||
}
|
||||
|
||||
QString KServiceRegistry::encodeAttributeValue(const QString &value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QString KServiceRegistry::createCommaList(const QStringList &values) {
|
||||
return values.join(",");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO: put private variables and SLP-dependencies in private class
|
||||
*/
|
||||
|
||||
#ifndef __KSERVICEREGISTRY_H
|
||||
#define __KSERVICEREGISTRY_H
|
||||
|
||||
|
@ -30,8 +34,8 @@
|
|||
#endif
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qmap.h>
|
||||
#include <qvaluelist.h>
|
||||
|
||||
/**
|
||||
* KServiceRegistry allows you to announce your service using SLP (RFC 2608).
|
||||
|
@ -101,6 +105,23 @@ class KServiceRegistry {
|
|||
*/
|
||||
bool available();
|
||||
|
||||
/**
|
||||
* Creates a comma-separated string of lists, as required by many functions.
|
||||
* @param map the items of this list will be converted
|
||||
* @return the comma-separated list
|
||||
*/
|
||||
static QString createCommaList(const QStringList &values);
|
||||
|
||||
/**
|
||||
* Encodes an QString for use as a attribute value. This will escape
|
||||
* all characters that are not allowed. This method is only available
|
||||
* when a SLP library is available, otherwise it will return the
|
||||
* given value.
|
||||
* @param value the value string to encode
|
||||
* @return the encoded value string
|
||||
*/
|
||||
static QString encodeAttributeValue(const QString &value);
|
||||
|
||||
/**
|
||||
* Registers the given service.
|
||||
* @param serviceURL the service URL to register
|
||||
|
|
Loading…
Reference in New Issue
Block a user