alkimia  7.0.1
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 };
40 
41 AlkQuoteItem::AlkQuoteItem(QObject *parent) :
42  QObject(parent),
43  d(new Private)
44 {
45 }
46 
48 {
49 }
50 
51 AlkQuoteItem::AlkQuoteItem(const AlkQuoteItem& item, QObject* parent):
52  QObject(parent),
53  d(new Private)
54 {
55  setSymbol(item.symbol());
56  setDateTime(item.dateTime());
59  setHighValue(item.highValue());
60  setLowValue(item.lowValue());
62  setVolume(item.volume());
63  setMarketCap(item.marketCap());
66  setEbitda(item.ebitda());
67  setRecordId(item.recordId());
68 }
69 
70 const QString& AlkQuoteItem::symbol() const
71 {
72  return d->m_symbol;
73 }
74 
75 const QDateTime& AlkQuoteItem::dateTime() const
76 {
77  return d->m_dateTime;
78 }
79 
81 {
82  return d->m_currentValue;
83 }
84 
86 {
87  return d->m_openingValue;
88 }
89 
91 {
92  return d->m_highValue;
93 }
94 
96 {
97  return d->m_lowValue;
98 }
99 
101 {
102  return d->m_closingValue;
103 }
104 
106 {
107  return d->m_volume;
108 }
109 
111 {
112  return d->m_marketCap;
113 }
114 
116 {
117  return d->m_earnings;
118 }
119 
121 {
122  return d->m_changeToday;
123 }
124 
126 {
127  return d->m_ebitda;
128 }
129 
130 const QString& AlkQuoteItem::recordId() const
131 {
132  return d->m_id;
133 }
134 
135 void AlkQuoteItem::setSymbol(const QString& symbol)
136 {
137  d->m_symbol = symbol;
138 }
139 
140 void AlkQuoteItem::setDateTime(const QDateTime& dateTime)
141 {
142  d->m_dateTime = dateTime;
143 }
144 
146 {
147  d->m_currentValue = value;
148 }
149 
151 {
152  d->m_openingValue = value;
153 }
154 
156 {
157  d->m_highValue = value;
158 }
159 
161 {
162  d->m_lowValue = value;
163 }
164 
166 {
167  d->m_closingValue = value;
168 }
169 
171 {
172  d->m_marketCap = value;
173 }
174 
176 {
177  d->m_volume = value;
178 }
179 
181 {
182  d->m_earnings = value;
183 }
184 
186 {
187  d->m_changeToday = value;
188 }
189 
191 {
192  d->m_ebitda = value;
193 }
194 
195 void AlkQuoteItem::setRecordId(const QString& recordId)
196 {
197  d->m_id = recordId;
198 }
199 
200 
201 QDBusArgument& operator<<(QDBusArgument& argument, const AlkQuoteItem &item)
202 {
203  argument.beginStructure();
204  argument << item.symbol() << item.dateTime().toString(Qt::ISODate) << item.currentValue().toString()
205  << item.openingValue().toString()
206  << item.highValue().toString() << item.lowValue().toString() << item.closingValue().toString()
207  << item.marketCap().toString() << item.volume().toString() << item.earningsPerShare().toString()
208  << item.changeToday().toString() << item.ebitda().toString() << item.recordId();
209  argument.endStructure();
210  return argument;
211 }
212 
213 const QDBusArgument& operator>>(const QDBusArgument& argument, AlkQuoteItem &item)
214 {
215  argument.beginStructure();
216  QString symbol;
217  QString dateTime;
218  QString currentValue;
219  QString openingValue;
220  QString highValue;
221  QString lowValue;
222  QString closingValue;
223  QString marketCap;
224  QString volume;
225  QString earnings;
226  QString change;
227  QString ebitda;
228  QString recordId;
229 
230  argument >> symbol >> dateTime >> currentValue >> openingValue >> highValue >> lowValue
231  >> closingValue >> marketCap >> volume >> earnings >> change >> ebitda >> recordId;
232  item.setSymbol(symbol);
233  item.setDateTime(QDateTime::fromString(dateTime, Qt::ISODate));
234  item.setCurrentValue(AlkValue(currentValue, '.'));
235  item.setOpeningValue(AlkValue(openingValue, '.'));
236  item.setHighValue(AlkValue(highValue, '.'));
237  item.setLowValue(AlkValue(lowValue, '.'));
238  item.setClosingValue(AlkValue(closingValue, '.'));
239  item.setMarketCap(AlkValue(marketCap, '.'));
240  item.setVolume(AlkValue(volume, '.'));
241  item.setEarningsPerShare(AlkValue(earnings, '.'));
242  item.setChangeToday(AlkValue(change, '.'));
243  item.setEbitda(AlkValue(ebitda, '.'));
244  item.setRecordId(recordId);
245 
246  argument.endStructure();
247  return argument;
248 }
249 
Private *const d
Definition: alkquoteitem.h:129
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)