alkimia  8.0.2
alkquoteitem.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2011 Alvaro Soliverez asoliverez@kde.org *
3  * *
4  * This file is part of libalkimia. *
5  * *
6  * libalkimia is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public License *
8  * as published by the Free Software Foundation; either version 2.1 of *
9  * the License or (at your option) version 3 or any later version. *
10  * *
11  * libalkimia is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program. If not, see <http://www.gnu.org/licenses/> *
18  ***************************************************************************/
19 
20 #include "alkquoteitem.h"
21 
23 {
24 public:
25  QString m_symbol;
26  QDateTime m_dateTime;
37  QString m_id;
38 };
39 
41  : QObject(parent)
42  , d(new Private)
43 {
44 }
45 
47 {
48 }
49 
50 AlkQuoteItem::AlkQuoteItem(const AlkQuoteItem &item, QObject *parent)
51  : QObject(parent)
52  , d(new Private)
53 {
54  setSymbol(item.symbol());
55  setDateTime(item.dateTime());
58  setHighValue(item.highValue());
59  setLowValue(item.lowValue());
61  setVolume(item.volume());
62  setMarketCap(item.marketCap());
65  setEbitda(item.ebitda());
66  setRecordId(item.recordId());
67 }
68 
69 const QString &AlkQuoteItem::symbol() const
70 {
71  return d->m_symbol;
72 }
73 
74 const QDateTime &AlkQuoteItem::dateTime() const
75 {
76  return d->m_dateTime;
77 }
78 
80 {
81  return d->m_currentValue;
82 }
83 
85 {
86  return d->m_openingValue;
87 }
88 
90 {
91  return d->m_highValue;
92 }
93 
95 {
96  return d->m_lowValue;
97 }
98 
100 {
101  return d->m_closingValue;
102 }
103 
105 {
106  return d->m_volume;
107 }
108 
110 {
111  return d->m_marketCap;
112 }
113 
115 {
116  return d->m_earnings;
117 }
118 
120 {
121  return d->m_changeToday;
122 }
123 
125 {
126  return d->m_ebitda;
127 }
128 
129 const QString &AlkQuoteItem::recordId() const
130 {
131  return d->m_id;
132 }
133 
134 void AlkQuoteItem::setSymbol(const QString &symbol)
135 {
136  d->m_symbol = symbol;
137 }
138 
139 void AlkQuoteItem::setDateTime(const QDateTime &dateTime)
140 {
141  d->m_dateTime = dateTime;
142 }
143 
145 {
146  d->m_currentValue = value;
147 }
148 
150 {
151  d->m_openingValue = value;
152 }
153 
155 {
156  d->m_highValue = value;
157 }
158 
160 {
161  d->m_lowValue = value;
162 }
163 
165 {
166  d->m_closingValue = value;
167 }
168 
170 {
171  d->m_marketCap = value;
172 }
173 
175 {
176  d->m_volume = value;
177 }
178 
180 {
181  d->m_earnings = value;
182 }
183 
185 {
186  d->m_changeToday = value;
187 }
188 
190 {
191  d->m_ebitda = value;
192 }
193 
194 void AlkQuoteItem::setRecordId(const QString &recordId)
195 {
196  d->m_id = recordId;
197 }
198 
199 QDBusArgument &operator<<(QDBusArgument &argument, const AlkQuoteItem &item)
200 {
201  argument.beginStructure();
202  argument << item.symbol() << item.dateTime().toString(Qt::ISODate)
203  << item.currentValue().toString()
204  << item.openingValue().toString()
205  << item.highValue().toString() << item.lowValue().toString()
206  << item.closingValue().toString()
207  << item.marketCap().toString() << item.volume().toString()
208  << item.earningsPerShare().toString()
209  << item.changeToday().toString() << item.ebitda().toString() << item.recordId();
210  argument.endStructure();
211  return argument;
212 }
213 
214 const QDBusArgument &operator>>(const QDBusArgument &argument, AlkQuoteItem &item)
215 {
216  argument.beginStructure();
217  QString symbol;
218  QString dateTime;
219  QString currentValue;
220  QString openingValue;
221  QString highValue;
222  QString lowValue;
223  QString closingValue;
224  QString marketCap;
225  QString volume;
226  QString earnings;
227  QString change;
228  QString ebitda;
229  QString recordId;
230 
231  argument >> symbol >> dateTime >> currentValue >> openingValue >> highValue >> lowValue
232  >> closingValue >> marketCap >> volume >> earnings >> change >> ebitda >> recordId;
233  item.setSymbol(symbol);
234  item.setDateTime(QDateTime::fromString(dateTime, Qt::ISODate));
235  item.setCurrentValue(AlkValue(currentValue, '.'));
236  item.setOpeningValue(AlkValue(openingValue, '.'));
237  item.setHighValue(AlkValue(highValue, '.'));
238  item.setLowValue(AlkValue(lowValue, '.'));
239  item.setClosingValue(AlkValue(closingValue, '.'));
240  item.setMarketCap(AlkValue(marketCap, '.'));
241  item.setVolume(AlkValue(volume, '.'));
242  item.setEarningsPerShare(AlkValue(earnings, '.'));
243  item.setChangeToday(AlkValue(change, '.'));
244  item.setEbitda(AlkValue(ebitda, '.'));
245  item.setRecordId(recordId);
246 
247  argument.endStructure();
248  return argument;
249 }
Private *const d
Definition: alkquoteitem.h:126
const AlkValue & earningsPerShare() const
const AlkValue & highValue() const
void setMarketCap(const AlkValue &value)
void setHighValue(const AlkValue &value)
void setChangeToday(const AlkValue &value)
void setCurrentValue(const AlkValue &value)
const QDBusArgument & operator>>(const QDBusArgument &argument, AlkQuoteItem &item)
const QString & recordId() const
void setDateTime(const QDateTime &datetime)
const AlkValue & closingValue() const
void setEarningsPerShare(const AlkValue &value)
void setClosingValue(const AlkValue &value)
void setSymbol(const QString &symbol)
AlkQuoteItem(QObject *parent=0)
const AlkValue & marketCap() const
void setLowValue(const AlkValue &value)
QDBusArgument & operator<<(QDBusArgument &argument, const AlkQuoteItem &item)
const AlkValue & changeToday() const
void setRecordId(const QString &recordId)
const AlkValue & currentValue() const
const QDateTime & dateTime() const
const AlkValue & openingValue() const
const AlkValue & lowValue() const
const QString & symbol() const
const AlkValue & volume() const
void setVolume(const AlkValue &value)
const AlkValue & ebitda() const
void setOpeningValue(const AlkValue &value)
void setEbitda(const AlkValue &value)