QDBusUtil Namespace

The QDBusUtil namespace contains a few functions that are of general use when dealing with D-Bus strings. More...

Header: #include <QDBusUtil>

Functions

QString argumentToString(const QVariant &arg)
bool isValidBasicType(int type)
bool isValidBusName(const QString &busName)
bool isValidErrorName(const QString &errorName)
bool isValidFixedType(int type)
bool isValidInterfaceName(const QString &ifaceName)
bool isValidMemberName(QStringView memberName)
bool isValidObjectPath(const QString &path)
bool isValidPartOfObjectPath(QStringView part)
bool isValidSignature(const QString &signature)
bool isValidSingleSignature(const QString &signature)
bool isValidUniqueConnectionName(QStringView connName)

Detailed Description

\inmoduleQtDBus \internal

Function Documentation

QString QDBusUtil::argumentToString(const QVariant &arg)

\internal\since 4.5 Dumps the contents of a Qt D-Bus argument from arg into a string.

bool QDBusUtil::isValidBasicType(int type)

Returns true if c is a valid, basic D-Bus type.

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

See also isValidUniqueConnectionName().

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.

bool QDBusUtil::isValidFixedType(int type)

Returns true if c is a valid, fixed D-Bus type.

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

bool QDBusUtil::isValidMemberName(QStringView 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.

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 ("_")

bool QDBusUtil::isValidPartOfObjectPath(QStringView part)

\internal See isValidObjectPath

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.

See also isValidSingleSignature().

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.

bool QDBusUtil::isValidUniqueConnectionName(QStringView 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 hyphen or the underscore ("_") character.