File indexing completed on 2024-07-14 04:54:59

0001 /*
0002     SPDX-FileCopyrightText: 2011 Alvaro Soliverez asoliverez @kde.org
0003 
0004     This file is part of libalkimia.
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #include "alkcompany.h"
0010 
0011 #include <QDBusMetaType>
0012 #include <QDBusArgument>
0013 
0014 class AlkCompany::Private
0015 {
0016 public:
0017     QString m_symbol;
0018     QString m_name;
0019     QString m_type;
0020     QString m_exchange;
0021     QString m_id;
0022 };
0023 
0024 AlkCompany::AlkCompany(QObject *parent)
0025     : QObject(parent)
0026     , d(new Private)
0027 {
0028 }
0029 
0030 AlkCompany::~AlkCompany()
0031 {
0032 }
0033 
0034 AlkCompany::AlkCompany(const AlkCompany &company, QObject *parent)
0035     : QObject(parent)
0036     , d(new Private)
0037 {
0038     setName(company.name());
0039     setSymbol(company.symbol());
0040     setType(company.type());
0041     setExchange(company.exchange());
0042     setRecordId(company.recordId());
0043 }
0044 
0045 const QString &AlkCompany::symbol() const
0046 {
0047     return d->m_symbol;
0048 }
0049 
0050 const QString &AlkCompany::name() const
0051 {
0052     return d->m_name;
0053 }
0054 
0055 const QString &AlkCompany::type() const
0056 {
0057     return d->m_type;
0058 }
0059 
0060 const QString &AlkCompany::exchange() const
0061 {
0062     return d->m_exchange;
0063 }
0064 
0065 const QString &AlkCompany::recordId() const
0066 {
0067     return d->m_id;
0068 }
0069 
0070 void AlkCompany::setSymbol(const QString &symbol)
0071 {
0072     d->m_symbol = symbol;
0073 }
0074 
0075 void AlkCompany::setName(const QString &name)
0076 {
0077     d->m_name = name;
0078 }
0079 
0080 void AlkCompany::setType(const QString &type)
0081 {
0082     d->m_type = type;
0083 }
0084 
0085 void AlkCompany::setExchange(const QString &exchange)
0086 {
0087     d->m_exchange = exchange;
0088 }
0089 
0090 void AlkCompany::setRecordId(const QString &recordId)
0091 {
0092     d->m_id = recordId;
0093 }
0094 
0095 QDBusArgument &operator<<(QDBusArgument &argument, const AlkCompany &company)
0096 {
0097     argument.beginStructure();
0098     argument << company.symbol() << company.name() << company.type() << company.exchange()
0099              << company.recordId();
0100     argument.endStructure();
0101     return argument;
0102 }
0103 
0104 const QDBusArgument &operator>>(const QDBusArgument &argument, AlkCompany &company)
0105 {
0106     argument.beginStructure();
0107     QString symbol;
0108     QString name;
0109     QString type;
0110     QString exchange;
0111     QString id;
0112     argument >> symbol >> name >> type >> exchange >> id;
0113     company.setSymbol(symbol);
0114     company.setName(name);
0115     company.setType(type);
0116     company.setExchange(exchange);
0117     company.setRecordId(id);
0118     argument.endStructure();
0119     return argument;
0120 }