File indexing completed on 2024-05-12 05:37:16

0001 /*
0002     SPDX-FileCopyrightText: 2011 Ivan Cukic <ivan.cukic(at)kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "ActivityData.h"
0008 
0009 #include <QDBusMetaType>
0010 #include <QMetaType>
0011 
0012 class ActivityDataStaticInit
0013 {
0014 public:
0015     ActivityDataStaticInit()
0016     {
0017         qDBusRegisterMetaType<ActivityData>();
0018         qDBusRegisterMetaType<QList<ActivityData>>();
0019     }
0020 
0021     static ActivityDataStaticInit _instance;
0022 };
0023 
0024 ActivityDataStaticInit ActivityDataStaticInit::_instance;
0025 
0026 ActivityData::ActivityData()
0027 {
0028 }
0029 
0030 ActivityData::ActivityData(const ActivityData &source)
0031     : id(source.id)
0032 {
0033     score = source.score;
0034 }
0035 
0036 ActivityData &ActivityData::operator=(const ActivityData &source)
0037 {
0038     if (&source != this) {
0039         score = source.score;
0040         id = source.id;
0041     }
0042 
0043     return *this;
0044 }
0045 
0046 QDBusArgument &operator<<(QDBusArgument &arg, const ActivityData r)
0047 {
0048     arg.beginStructure();
0049 
0050     arg << r.id;
0051     arg << r.score;
0052 
0053     arg.endStructure();
0054 
0055     return arg;
0056 }
0057 
0058 const QDBusArgument &operator>>(const QDBusArgument &arg, ActivityData &r)
0059 {
0060     arg.beginStructure();
0061 
0062     arg >> r.id;
0063     arg >> r.score;
0064 
0065     arg.endStructure();
0066 
0067     return arg;
0068 }
0069 
0070 QDebug operator<<(QDebug dbg, const ActivityData &r)
0071 {
0072     dbg << "ActivityData(" << r.score << r.id << ")";
0073     return dbg.space();
0074 }