46 #include <QtCore/qstringlist.h> 58 return (u >=
'a' && u <=
'z')
59 || (u >=
'A' && u <=
'Z')
60 || (u >=
'0' && u <=
'9')
67 return (u >=
'a' && u <=
'z')
68 || (u >=
'A' && u <=
'Z')
69 || (u >=
'0' && u <=
'9')
70 || (u ==
'_') || (u ==
'-');
76 return (u >=
'0' && u <=
'9');
96 for (
int i = 0; i < list.
count(); ++i) {
124 }
else if (argType == qMetaTypeId<QDBusArgument>()) {
125 argToString(qvariant_cast<QDBusArgument>(arg), out);
126 }
else if (argType == qMetaTypeId<QDBusObjectPath>()) {
131 }
else if (argType == qMetaTypeId<QDBusSignature>()) {
134 }
else if (argType == qMetaTypeId<QDBusUnixFileDescriptor>()) {
136 out +=
QLatin1String(qvariant_cast<QDBusUnixFileDescriptor>(arg).isValid() ?
"valid" :
"not valid");
138 }
else if (argType == qMetaTypeId<QDBusVariant>()) {
142 if (vUserType != qMetaTypeId<QDBusVariant>()
143 && vUserType != qMetaTypeId<QDBusSignature>()
144 && vUserType != qMetaTypeId<QDBusObjectPath>()
145 && vUserType != qMetaTypeId<QDBusArgument>())
165 bool doIterate =
false;
172 switch (elementType) {
184 out += QLatin1Char(
'{');
189 out += QLatin1Char(
'{');
206 if (doIterate && !busArg.
atEnd()) {
207 while (!busArg.
atEnd()) {
214 switch (elementType) {
225 out += QLatin1Char(
'}');
229 out += QLatin1Char(
'}');
236 out += QLatin1Char(
']');
248 return c != DBUS_TYPE_INVALID && strchr(
basicTypes, c) != NULL;
253 return c != DBUS_TYPE_INVALID && strchr(
fixedTypes, c) != NULL;
260 register char c = *signature;
261 if (c == DBUS_TYPE_INVALID)
266 return signature + 1;
269 if (c == DBUS_TYPE_ARRAY) {
273 if (c == DBUS_DICT_ENTRY_BEGIN_CHAR) {
281 return signature && *signature == DBUS_DICT_ENTRY_END_CHAR ? signature + 1 : 0;
287 if (c == DBUS_STRUCT_BEGIN_CHAR) {
294 if (*signature == DBUS_STRUCT_END_CHAR)
295 return signature + 1;
344 for (
int i = 0; i < part.
length(); ++i)
369 if (ifaceName.
isEmpty() || ifaceName.
length() > DBUS_MAXIMUM_NAME_LENGTH)
373 if (parts.
count() < 2)
376 for (
int i = 0; i < parts.
count(); ++i)
395 if (connName.
isEmpty() || connName.
length() > DBUS_MAXIMUM_NAME_LENGTH ||
400 if (parts.
count() < 1)
403 for (
int i = 0; i < parts.
count(); ++i) {
409 for (
int j = 0; j < part.
length(); ++j)
437 if (busName.
isEmpty() || busName.
length() > DBUS_MAXIMUM_NAME_LENGTH)
444 if (parts.
count() < 1)
447 for (
int i = 0; i < parts.
count(); ++i) {
455 for (
int j = 0; j < part.
length(); ++j)
474 if (memberName.
isEmpty() || memberName.
length() > DBUS_MAXIMUM_NAME_LENGTH)
480 for (
int j = 0; j < memberName.
length(); ++j)
528 for (
int i = 0; i < parts.
count(); ++i)
597 return data && *data ==
'\0';
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
void beginMapEntry()
Opens a D-Bus map entry suitable for appending the key and value entries.
void endArray()
Closes a D-Bus array opened with beginArray().
static bool isFixedType(int c)
static bool isValidCharacter(const QChar &c)
#define QT_END_NAMESPACE
This macro expands to.
bool isValidObjectPath(const QString &path)
Returns true if path is valid object path.
static bool argToString(const QDBusArgument &arg, QString &out)
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QDBusArgument class is used to marshall and demarshall D-Bus arguments.
void beginArray(int elementMetaTypeId)
Opens a new D-Bus array suitable for appending elements of meta-type id.
The QByteArray class provides an array of bytes.
void chop(int n)
Removes n characters from the end of the string.
static const char * validateSingleType(const char *signature)
int length() const
Returns the number of characters in this string.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
QString currentSignature() const
Returns the type signature of the D-Bus type this QDBusArgument object is currently pointing to...
The QDBusSignature class enables the programmer to identify the SIGNATURE type provided by the D-Bus ...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has type() List or StringList ; otherwise return...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
int count(const T &t) const
Returns the number of occurrences of value in the list.
void beginMap(int keyMetaTypeId, int valueMetaTypeId)
Opens a new D-Bus map suitable for appending elements.
The QString class provides a Unicode character string.
static const char basicTypes[]
bool isValidInterfaceName(const QString &ifaceName)
Returns true if this is ifaceName is a valid interface name.
static bool isValidNumber(const QChar &c)
The QChar class provides a 16-bit Unicode character.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static bool isValidCharacterNoDash(const QChar &c)
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
#define QT_BEGIN_NAMESPACE
This macro expands to.
qlonglong toLongLong(bool *ok=0) const
Returns the variant as a long long int if the variant has type() LongLong , Bool , ByteArray , Char , Double , Int , String , UInt , or ULongLong ; otherwise returns 0.
bool canConvert(Type t) const
Returns true if the variant's type can be cast to the requested type, t.
bool atEnd() const
Returns true if there are no more elements to be extracted from this QDBusArgument.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static bool isBasicType(int c)
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
qulonglong toULongLong(bool *ok=0) const
Returns the variant as as an unsigned long long int if the variant has type() ULongLong ...
bool isValidSignature(const QString &signature)
Returns true if signature is a valid D-Bus type signature for one or more types.
static const char * data(const QByteArray &arr)
static bool variantToString(const QVariant &arg, QString &out)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool isValidMemberName(const QString &memberName)
Returns true if memberName is a valid member name.
void removeFirst()
Removes the first item in the list.
bool isValidSingleSignature(const QString &signature)
Returns true if signature is a valid D-Bus type signature for exactly one full type.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
bool isValidErrorName(const QString &errorName)
Returns true if errorName is a valid error name.
const char * typeName() const
Returns the name of the type stored in the variant.
bool isValidFixedType(int c)
Returns true if c is a valid, fixed D-Bus type.
bool isValidUniqueConnectionName(const QString &connName)
Returns true if connName is a valid unique connection name.
QVariant asVariant() const
Returns the current argument in the form of a QVariant.
ElementType
This enum describes the type of element held by the argument.
const char * constData() const
Returns a pointer to the data stored in the byte array.
static const char fixedTypes[]
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
ElementType currentType() const
Returns the classification of the current element type.
bool isValidBasicType(int c)
Returns true if c is a valid, basic D-Bus type.
void endMapEntry()
Closes a D-Bus map entry opened with beginMapEntry().
int userType() const
Returns the storage type of the value stored in the variant.
void endMap()
Closes a D-Bus map opened with beginMap().
int count(char c) const
Returns the number of occurrences of character ch in the byte array.
void endStructure()
Closes a D-Bus structure opened with beginStructure().
The QDBusObjectPath class enables the programmer to identify the OBJECT_PATH type provided by the D-B...
double toDouble(bool *ok=0) const
Returns the variant as a double if the variant has type() Double , QMetaType::Float ...
void beginStructure()
Opens a new D-Bus structure suitable for appending new arguments.
static QByteArray memberName(const QMetaMethod &member)
bool isValidPartOfObjectPath(const QString &part)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
The QDBusUtil namespace contains a few functions that are of general use when dealing with D-Bus stri...
char at(int i) const
Returns the character at index position i in the byte array.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QString argumentToString(const QVariant &arg)
Dumps the contents of a QtDBus argument from arg into a string.
The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus type...
static const char oneLetterTypes[]
T qvariant_cast(const QVariant &value)
Returns the given value converted to the template type T.
bool isValidBusName(const QString &busName)
Returns true if busName is a valid bus name.