alkimia  8.0.3
alkonlinequotesource.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2018 Ralf Habacker <ralf.habacker@freenet.de> *
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 #ifndef ALKONLINEQUOTESOURCE_H
21 #define ALKONLINEQUOTESOURCE_H
22 
23 #include <alkimia/alkonlinequotesprofile.h>
24 
25 #include <QString>
26 
28 
35 class ALK_EXPORT AlkOnlineQuoteSource
36 {
37 public:
38 
40  explicit AlkOnlineQuoteSource(const QString &name, AlkOnlineQuotesProfile *profile);
41  explicit AlkOnlineQuoteSource(const QString &name, const QString &url, const QString &sym,
42  const QString &price, const QString &date, const QString &dateformat,
43  bool skipStripping = false);
45 
48 
49  friend void swap(AlkOnlineQuoteSource& first, AlkOnlineQuoteSource& second);
50 
51  bool isEmpty();
52  bool isValid();
53 
54  bool read();
55  bool write();
56  void rename(const QString &name);
57  void remove();
58 
59  QString name() const;
60  QString url() const;
61  QString sym() const;
62  QString price() const;
63  QString date() const;
64  QString dateformat() const;
65  QString financeQuoteName() const;
66 
67  bool skipStripping() const;
68  bool isGHNS();
69  bool isReadOnly();
70  bool isFinanceQuote() const;
71  static bool isFinanceQuote(const QString &name);
72 
73  void setName(const QString &name);
74  void setUrl(const QString &url);
75  void setSym(const QString &symbol);
76  void setPrice(const QString &price);
77  void setDate(const QString &date);
78  void setDateformat(const QString &dateformat);
79  void setSkipStripping(bool state);
80  void setGHNS(bool state);
81 
82  QString ghnsWriteFileName();
83  void setProfile(AlkOnlineQuotesProfile *profile);
84  AlkOnlineQuotesProfile *profile();
85 
86 protected:
87  class Private;
89 };
90 
91 inline void swap(AlkOnlineQuoteSource& first, AlkOnlineQuoteSource& second) // krazy:exclude=inline
92 {
93  using std::swap;
94  swap(first.d, second.d);
95 }
96 
97 #endif // ALKONLINEQUOTESOURCE_H
void swap(AlkOnlineQuoteSource &first, AlkOnlineQuoteSource &second)