Functions | |
| bool | isValidPartOfObjectPath (const QString &part) |
| bool | isValidInterfaceName (const QString &ifaceName) |
| bool | isValidUniqueConnectionName (const QString &connName) |
| bool | isValidBusName (const QString &busName) |
| bool | isValidMemberName (const QString &memberName) |
| bool | isValidErrorName (const QString &errorName) |
| bool | isValidObjectPath (const QString &path) |
| bool | isValidSignature (const QString &signature) |
| bool | isValidSingleSignature (const QString &signature) |
| QDBUS_EXPORT bool QDBusUtil::isValidBusName | ( | const QString & | busName | ) |
Returns true if busName is a valid bus name.
A valid bus name is either a valid unique connection name or follows the rules: is not empty does not exceed 255 characters in length be composed of dot-separated string components that contain only ASCII letters, digits, hyphens or underscores ("_"), but don't start with a digit contains at least two such elements
Definition at line 134 of file qdbusutil.cpp.
References QList< T >::at(), QList< T >::count(), QRegExp::exactMatch(), i, QString::isEmpty(), isValidUniqueConnectionName(), QString::length(), and QString::startsWith().
Referenced by QDBusConnectionPrivate::getNameOwner(), main(), and QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate().
00135 { 00136 if (busName.isEmpty() || busName.length() > DBUS_MAXIMUM_NAME_LENGTH) 00137 return false; 00138 00139 if (busName.startsWith(QLatin1Char(':'))) 00140 return isValidUniqueConnectionName(busName); 00141 00142 QStringList parts = busName.split(QLatin1Char('.')); 00143 if (parts.count() < 1) 00144 return false; 00145 00146 QRegExp regex(QLatin1String("[a-zA-Z_-][a-zA-Z0-9_-]*")); 00147 for (int i = 0; i < parts.count(); ++i) 00148 if (!regex.exactMatch(parts.at(i))) 00149 return false; 00150 00151 return true; 00152 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidErrorName | ( | const QString & | errorName | ) |
Returns true if errorName is a valid error name. Valid error names are valid interface names and vice-versa, so this function is actually an alias for isValidInterfaceName.
Definition at line 174 of file qdbusutil.cpp.
References isValidInterfaceName().
00175 { 00176 return isValidInterfaceName(errorName); 00177 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidInterfaceName | ( | const QString & | ifaceName | ) |
Returns true if this is ifaceName is a valid interface name.
Valid interface names must: not be empty not exceed 255 characters in length be composed of dot-separated string components that contain only ASCII letters, digits and the underscore ("_") character contain at least two such components
Definition at line 78 of file qdbusutil.cpp.
References QList< T >::at(), QList< T >::count(), i, QString::isEmpty(), isValidMemberName(), QString::length(), and QString::split().
Referenced by QDBusConnection::connect(), QDBusConnection::disconnect(), QDBusXmlParser::interfaces(), isValidErrorName(), listAllInterfaces(), main(), QDBusXmlParser::object(), parseAnnotations(), QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(), and splitInterfaceAndName().
00079 { 00080 if (ifaceName.isEmpty() || ifaceName.length() > DBUS_MAXIMUM_NAME_LENGTH) 00081 return false; 00082 00083 QStringList parts = ifaceName.split(QLatin1Char('.')); 00084 if (parts.count() < 2) 00085 return false; // at least two parts 00086 00087 for (int i = 0; i < parts.count(); ++i) 00088 if (!isValidMemberName(parts.at(i))) 00089 return false; 00090 00091 return true; 00092 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidMemberName | ( | const QString & | memberName | ) |
Returns true if memberName is a valid member name. A valid member name does not exceed 255 characters in length, is not empty, is composed only of ASCII letters, digits and underscores, but does not start with a digit.
Definition at line 160 of file qdbusutil.cpp.
References QRegExp::exactMatch(), QByteArray::isEmpty(), QByteArray::length(), and QTest::memberName().
Referenced by QDBusXmlParser::interfaces(), isValidInterfaceName(), main(), and splitInterfaceAndName().
00161 { 00162 if (memberName.isEmpty() || memberName.length() > DBUS_MAXIMUM_NAME_LENGTH) 00163 return false; 00164 00165 QRegExp regex(QLatin1String("[a-zA-Z_][a-zA-Z0-9_]*")); 00166 return regex.exactMatch(memberName); 00167 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidObjectPath | ( | const QString & | path | ) |
Returns true if path is valid object path.
Valid object paths follow the rules: start with the slash character ("/") do not end in a slash, unless the path is just the initial slash do not contain any two slashes in sequence contain slash-separated parts, each of which is composed of ASCII letters, digits and underscores ("_")
Definition at line 192 of file qdbusutil.cpp.
References QList< T >::at(), QList< T >::count(), i, isValidPartOfObjectPath(), path, and QList< T >::removeFirst().
Referenced by QDBusObjectPath::check(), main(), QDBusXmlParser::object(), QDBusConnection::objectRegisteredAt(), QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(), QDBusConnection::registerObject(), and QDBusConnection::unregisterObject().
00193 { 00194 if (path == QLatin1String("/")) 00195 return true; 00196 00197 if (!path.startsWith(QLatin1Char('/')) || path.indexOf(QLatin1String("//")) != -1 || 00198 path.endsWith(QLatin1Char('/'))) 00199 return false; 00200 00201 QStringList parts = path.split(QLatin1Char('/')); 00202 Q_ASSERT(parts.count() >= 1); 00203 parts.removeFirst(); // it starts with /, so we get an empty first part 00204 00205 for (int i = 0; i < parts.count(); ++i) 00206 if (!isValidPartOfObjectPath(parts.at(i))) 00207 return false; 00208 00209 return true; 00210 }
Here is the call graph for this function:

| bool QDBusUtil::isValidPartOfObjectPath | ( | const QString & | part | ) |
Definition at line 48 of file qdbusutil.cpp.
References c, i, QString::isEmpty(), QString::length(), u, and QString::unicode().
Referenced by isValidObjectPath().
00049 { 00050 if (part.isEmpty()) 00051 return false; // can't be valid if it's empty 00052 00053 const QChar *c = part.unicode(); 00054 for (int i = 0; i < part.length(); ++i) { 00055 register ushort u = c[i].unicode(); 00056 if (!((u >= 'a' && u <= 'z') || 00057 (u >= 'A' && u <= 'Z') || 00058 (u >= '0' && u <= '9') || 00059 u == '_')) 00060 return false; 00061 } 00062 return true; 00063 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidSignature | ( | const QString & | signature | ) |
Returns true if signature is a valid D-Bus type signature for one or more types. This function returns true if it can all of signature into valid, individual types and no characters remain in signature.
Definition at line 220 of file qdbusutil.cpp.
References QString::toUtf8().
Referenced by QDBusSignature::check().
00221 { 00222 return dbus_signature_validate(signature.toUtf8(), 0); 00223 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidSingleSignature | ( | const QString & | signature | ) |
Returns true if signature is a valid D-Bus type signature for exactly one full type. This function tries to convert the type signature into a D-Bus type and, if it succeeds and no characters remain in the signature, it returns true.
Definition at line 231 of file qdbusutil.cpp.
References QString::toUtf8().
Referenced by QDBusXmlParser::interfaces(), and parseArgs().
00232 { 00233 return dbus_signature_validate_single(signature.toUtf8(), 0); 00234 }
Here is the call graph for this function:

| QDBUS_EXPORT bool QDBusUtil::isValidUniqueConnectionName | ( | const QString & | connName | ) |
Returns true if connName is a valid unique connection name.
Unique connection names start with a colon (":") and are followed by a list of dot-separated components composed of ASCII letters, digits, the hypen or the underscore ("_") character.
Definition at line 101 of file qdbusutil.cpp.
References QList< T >::at(), QList< T >::count(), QRegExp::exactMatch(), i, QString::isEmpty(), QString::length(), QString::mid(), QString::split(), and QString::startsWith().
Referenced by QDBusConnectionPrivate::getNameOwner(), and isValidBusName().
00102 { 00103 if (connName.isEmpty() || connName.length() > DBUS_MAXIMUM_NAME_LENGTH || 00104 !connName.startsWith(QLatin1Char(':'))) 00105 return false; 00106 00107 QStringList parts = connName.mid(1).split(QLatin1Char('.')); 00108 if (parts.count() < 1) 00109 return false; 00110 00111 QRegExp regex(QLatin1String("[a-zA-Z0-9_-]+")); 00112 for (int i = 0; i < parts.count(); ++i) 00113 if (!regex.exactMatch(parts.at(i))) 00114 return false; 00115 00116 return true; 00117 }
Here is the call graph for this function:

1.5.1