yhkylin-backup-tools/common/mydefine.cpp

33 lines
1.3 KiB
C++
Raw Normal View History

2021-08-06 10:20:03 +08:00
#include "mydefine.h"
#include <QDBusMetaType>
// Marshall the MyStructure data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const BackupWrapper &backupWrapper)
{
argument.beginStructure();
argument << backupWrapper.m_type << backupWrapper.m_comment << backupWrapper.m_backupName
<< backupWrapper.m_uuid << backupWrapper.m_backupPaths << backupWrapper.m_backupExcludePaths
<< backupWrapper.m_note << backupWrapper.m_frontUserName << backupWrapper.m_frontUid
<< backupWrapper.m_gid;
argument.endStructure();
return argument;
}
// Retrieve the MyStructure data from the D-Bus argument
const QDBusArgument &operator>>(const QDBusArgument &argument, BackupWrapper &backupWrapper)
{
argument.beginStructure();
argument >> backupWrapper.m_type >> backupWrapper.m_comment >> backupWrapper.m_backupName
>> backupWrapper.m_uuid >> backupWrapper.m_backupPaths >> backupWrapper.m_backupExcludePaths
>> backupWrapper.m_note >> backupWrapper.m_frontUserName >> backupWrapper.m_frontUid
>> backupWrapper.m_gid;
argument.endStructure();
return argument;
}
void BackupWrapper::registerMetaType()
{
qRegisterMetaType<BackupWrapper>("BackupWrapper");
qDBusRegisterMetaType<BackupWrapper>();
}