alkimia  8.0.3
alkonlinequote.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2004 Ace Jones <acejones@users.sourceforge.net> *
3  * Copyright 2018 Ralf Habacker <ralf.habacker@freenet.de> *
4  * *
5  * This file is part of libalkimia. *
6  * *
7  * libalkimia is free software; you can redistribute it and/or *
8  * modify it under the terms of the GNU General Public License *
9  * as published by the Free Software Foundation; either version 2.1 of *
10  * the License or (at your option) version 3 or any later version. *
11  * *
12  * libalkimia is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/> *
19  ***************************************************************************/
20 
21 #ifndef ALKONLINEQUOTE_H
22 #define ALKONLINEQUOTE_H
23 
24 #include <alkimia/alk_export.h>
25 
26 #include <QObject>
27 #include <QDateTime>
28 #include <QString>
29 
31 
37 class ALK_EXPORT AlkOnlineQuote : public QObject
38 {
39  Q_OBJECT
40 public:
41  explicit AlkOnlineQuote(AlkOnlineQuotesProfile *profile = 0, QObject * = 0);
42  ~AlkOnlineQuote();
43 
51  class Errors
52  {
53  public:
54  enum Type {
64  URL,
65  };
66 
67  Errors();
68  Errors(Type type);
69  Errors(const Errors &e);
70  Errors &operator |=(Type t);
71  bool operator &(Type t) const;
72 
73  protected:
74  QList<Type> m_type;
75  };
76 
77  AlkOnlineQuotesProfile *profile();
78  void setProfile(AlkOnlineQuotesProfile *profile);
79 
85  void setAcceptLanguage(const QString &language);
86 
102 public slots:
103  bool launch(const QString &_symbol, const QString &_id, const QString &_source = QString());
104 
111  const Errors &errors();
112 
113 signals:
114  void quote(QString id, QString symbol, QDate date, double price);
115  void failed(QString id, QString symbol);
116  void status(QString s);
117  void error(QString s);
118 
119 private:
120  class Private;
121  Private *const d;
122 };
123 
124 #endif // ALKONLINEQUOTE_H
AlkOnlineQuote::status
void status(QString s)
AlkOnlineQuotesProfile
Definition: alkonlinequotesprofile.h:35
AlkOnlineQuote::Errors::Success
@ Success
Definition: alkonlinequote.h:63
AlkOnlineQuote::Errors::Type
Type
Definition: alkonlinequote.h:54
AlkOnlineQuote::Private
Definition: alkonlinequote.cpp:79
AlkOnlineQuote::Errors::URL
@ URL
Definition: alkonlinequote.h:64
AlkOnlineQuote::Errors::m_type
QList< Type > m_type
Definition: alkonlinequote.h:74
AlkOnlineQuote::d
Private *const d
Definition: alkonlinequote.h:120
AlkOnlineQuote::Errors::Price
@ Price
Definition: alkonlinequote.h:59
AlkOnlineQuote::failed
void failed(QString id, QString symbol)
AlkOnlineQuote::error
void error(QString s)
AlkOnlineQuote::Errors::None
@ None
Definition: alkonlinequote.h:55
AlkOnlineQuote::Errors::DateFormat
@ DateFormat
Definition: alkonlinequote.h:58
AlkOnlineQuote::Errors::Data
@ Data
Definition: alkonlinequote.h:56
AlkOnlineQuote::quote
void quote(QString id, QString symbol, QDate date, double price)
AlkOnlineQuote
Definition: alkonlinequote.h:38
AlkOnlineQuote::Errors
Definition: alkonlinequote.h:52
AlkOnlineQuote::Errors::Symbol
@ Symbol
Definition: alkonlinequote.h:62
AlkOnlineQuote::Errors::Script
@ Script
Definition: alkonlinequote.h:60
AlkOnlineQuote::Errors::Source
@ Source
Definition: alkonlinequote.h:61
AlkOnlineQuote::Errors::Date
@ Date
Definition: alkonlinequote.h:57