Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QDBusMetaType Class Reference

\inmodule QtDBus More...

#include <qdbusmetatype.h>

+ Collaboration diagram for QDBusMetaType:

Public Types

typedef void(* MarshallFunction) (QDBusArgument &, const void *)
 
typedef void(* DemarshallFunction) (const QDBusArgument &, void *)
 

Static Public Member Functions

static void registerMarshallOperators (QMetaType typeId, MarshallFunction, DemarshallFunction)
 
static bool marshall (QDBusArgument &, QMetaType id, const void *data)
 
static bool demarshall (const QDBusArgument &, QMetaType id, void *data)
 
static void registerCustomType (QMetaType type, const QByteArray &signature)
 
static QMetaType signatureToMetaType (const char *signature)
 
static const char * typeToSignature (QMetaType type)
 

Detailed Description

\inmodule QtDBus

Meta-type registration system for the Qt D-Bus module.

The QDBusMetaType class allows you to register class types for marshalling and demarshalling over D-Bus. D-Bus supports a very limited set of primitive types, but allows one to extend the type system by creating compound types, such as arrays (lists) and structs. In order to use them with Qt D-Bus, those types must be registered.

See \l {qdbustypesystem.html}{Qt D-Bus Type System} for more information on the type system and how to register additional types.

See also
{qdbustypesystem.html}{Qt D-Bus Type System}, qDBusRegisterMetaType(), QMetaType, QVariant, QDBusArgument

Definition at line 16 of file qdbusmetatype.h.

Member Typedef Documentation

◆ DemarshallFunction

QDBusMetaType::DemarshallFunction

Definition at line 20 of file qdbusmetatype.h.

◆ MarshallFunction

QDBusMetaType::MarshallFunction

Definition at line 19 of file qdbusmetatype.h.

Member Function Documentation

◆ demarshall()

bool QDBusMetaType::demarshall ( const QDBusArgument arg,
QMetaType  metaType,
void data 
)
static

Executes the demarshalling of type metaType (whose data will be placed in data) from the D-Bus marshalling argument arg. Returns true if the demarshalling succeeded, or false if an error occurred.

Definition at line 230 of file qdbusmetatype.cpp.

References arg, QSet< T >::cend(), QSet< T >::constFind(), copy(), QMetaType::id(), info, QDBusMetaTypeId::init(), it, and Q_UNUSED.

Referenced by copyArgument(), QDBusAbstractInterfacePrivate::property(), qDBusReplyFill(), and writeProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ marshall()

bool QDBusMetaType::marshall ( QDBusArgument arg,
QMetaType  metaType,
const void data 
)
static

Executes the marshalling of type metaType (whose data is contained in data) to the D-Bus marshalling argument arg. Returns true if the marshalling succeeded, or false if an error occurred.

Definition at line 199 of file qdbusmetatype.cpp.

References arg, QSet< T >::cend(), QSet< T >::constFind(), QMetaType::id(), info, QDBusMetaTypeId::init(), and it.

Referenced by QDBusMarshaller::appendRegisteredType(), and QDBusArgumentPrivate::createSignature().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerCustomType()

void QDBusMetaType::registerCustomType ( QMetaType  type,
const QByteArray signature 
)
static

Registers the meta type type to be represeneted by the given D-Bus signature.

This is used in qdbuscpp2xml for custom types which aren't known to the C++ type system.

Definition at line 355 of file qdbusmetatype.cpp.

References info.

Referenced by parseCmdLine().

+ Here is the caller graph for this function:

◆ registerMarshallOperators()

void QDBusMetaType::registerMarshallOperators ( QMetaType  metaType,
MarshallFunction  mf,
DemarshallFunction  df 
)
static

Registers the marshalling and demarshalling functions for meta type metaType.

Definition at line 179 of file qdbusmetatype.cpp.

References info.

Referenced by QDBusArgument::qDBusRegisterMetaType().

+ Here is the caller graph for this function:

◆ signatureToMetaType()

QMetaType QDBusMetaType::signatureToMetaType ( const char *  signature)
static

Definition at line 273 of file qdbusmetatype.cpp.

References DBUS_TYPE_ARRAY, DBUS_TYPE_BOOLEAN, DBUS_TYPE_BYTE, DBUS_TYPE_DOUBLE, DBUS_TYPE_INT16, DBUS_TYPE_INT32, DBUS_TYPE_INT64, DBUS_TYPE_OBJECT_PATH, DBUS_TYPE_SIGNATURE, DBUS_TYPE_STRING, DBUS_TYPE_UINT16, DBUS_TYPE_UINT32, DBUS_TYPE_UINT64, DBUS_TYPE_UNIX_FD, DBUS_TYPE_VARIANT, QDBusMetaTypeId::init(), QDBusMetaTypeId::objectpath(), Q_FALLTHROUGH, QDBusMetaTypeId::signature(), QDBusMetaTypeId::unixfd(), QMetaType::UnknownType, and QDBusMetaTypeId::variant().

Referenced by addFunction(), QDBusArgumentPrivate::createSignature(), generateInterfaceXml(), and generateInterfaceXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ typeToSignature()

const char * QDBusMetaType::typeToSignature ( QMetaType  type)
static

Returns the D-Bus signature equivalent to the supplied meta type id type.

More types can be registered with the qDBusRegisterMetaType() function.

See also
QDBusUtil::isValidSingleSignature(), signatureToType(), QVariant::metaType()

Definition at line 375 of file qdbusmetatype.cpp.

References QSet< T >::constFind(), QDBusArgumentPrivate::createSignature(), DBUS_TYPE_ARRAY_AS_STRING, DBUS_TYPE_BOOLEAN_AS_STRING, DBUS_TYPE_BYTE_AS_STRING, DBUS_TYPE_DOUBLE_AS_STRING, DBUS_TYPE_INT16_AS_STRING, DBUS_TYPE_INT32_AS_STRING, DBUS_TYPE_INT64_AS_STRING, DBUS_TYPE_OBJECT_PATH_AS_STRING, DBUS_TYPE_SIGNATURE_AS_STRING, DBUS_TYPE_STRING_AS_STRING, DBUS_TYPE_UINT16_AS_STRING, DBUS_TYPE_UINT32_AS_STRING, DBUS_TYPE_UINT64_AS_STRING, DBUS_TYPE_UNIX_FD_AS_STRING, DBUS_TYPE_VARIANT_AS_STRING, QSet< T >::end(), info, QDBusMetaTypeId::init(), it, QDBusMetaTypeId::objectpath(), QDBusMetaTypeId::signature(), QDBusMetaTypeId::unixfd(), and QDBusMetaTypeId::variant().

Referenced by addFunction(), QDBusMarshaller::append(), QDBusMarshaller::appendVariantInternal(), QDBusMarshaller::beginArray(), QDBusMarshaller::beginMap(), copyArgument(), findSlot(), generateInterfaceXml(), generateInterfaceXml(), QDBusMessagePrivate::makeLocal(), QDBusConnectionPrivate::prepareHook(), QDBusAbstractInterfacePrivate::property(), qDBusParametersForMethod(), qDBusReplyFill(), readAllProperties(), and QDBusPendingCallPrivate::setMetaTypes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: