Sunday, 3 July 2011

alkuser.cpp

#include "alkuser.h"

#include<QDBusMetaType>
#include<QDBusArgument>

class AlkUser::Private
{
public:
    QString m_name;
    Q_String m_account_no;
    Q_String m_contact;
    Q_String m_type;
    Q_String m_amount;
}

AlkUser::AlkUser(QObject *Parent) :
QObject(parent),
d(new Private)
{
}

AlkUser::~Alkuser(){}

AlkUser::AlkUser(const AlkUser &user,QObject *parent):
QObject(parent),
d(new Private)
{
    setName(user.name());
    setAccount_no(user.account());
    setContact(user.contact());
    setType(user.type);
    setAmount(user.amount);
}

const QString& AlkUser::name()
{
return d->m_name;
}

const QString& AlkUser::account()
{
    return d->m_account_no;
}

const QString& AlkUser::contact()
{
    return d->m_contact;
}

const QString& AlkUser::type()
{
    return d->m_type;
}

const QString& AlkUser::amount()
{
    return d->m_amount;
}

void AlkUser::setName(QString &name)
{
    d->m_name=name;
}

void AlkUser::setAccount(QString &account_no)
{
    d->m_account_no=account_no;
}

void AlkUser::setContact(QString &contact)
{
    d->m_contact=contact;
}

void AlkUser::setType(QString &type)
{
    d->m_type=type;
}

void AlkUser::setAmount(QString &amount)
{
    d->m_amount=amount;
}

QDBusArgument& operator<<(QDBusArgument &argument,AlkUser &user)
{
    argument.beginStructure();
        argument << user.name() << user.account() << user.contact() << user.type() << user.amount();
        argument.endStructure();
    return argument;
}

const QDBusArgument& operator>>(QDBusArgument &argument,AlkUser &user)
{
    argument.beginStructure();
        QString name;
        QString account;
        QString contact;
        QString type;
        QString amount;
        argument >> name >> account >> contact >> type >> amount;
        user.setName(name);
        user.setAccount(account);
        user.setContact(contact);
        user.setType(type);
        user.setAmount(amount);
    argument.endStructure();
    return argument;
}

No comments:

Post a Comment