libosmscout  1.1.1
VoiceProvider.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_CLIENT_QT_VOICEPROVIDER_H
2 #define OSMSCOUT_CLIENT_QT_VOICEPROVIDER_H
3 
4 /*
5  OSMScout - a Qt backend for libosmscout and libosmscout-map
6  Copyright (C) 2020 Lukas Karas
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22 
23 #include <QObject>
24 #include <QString>
25 #include <QUrl>
26 
27 #include <QJsonDocument>
28 #include <QJsonArray>
29 #include <QJsonObject>
30 
32 
33 namespace osmscout {
34 
39 {
40  Q_OBJECT
41 
42 private:
43  bool valid=false;
44  QString uri;
45  QString listUri;
46  QString name;
47 
48 public:
49  VoiceProvider() = default;
50 
51  inline VoiceProvider(const VoiceProvider &o):
52  QObject(o.parent()),
53  valid(o.valid), uri(o.uri), listUri(o.listUri), name(o.name){};
54 
55  inline VoiceProvider(const QString &name, const QString &uri, const QString &listUri):
56  valid(true), uri(uri), listUri(listUri), name(name) {}
57 
58  ~VoiceProvider() override = default;
59 
60  inline void operator=(const VoiceProvider &o)
61  {
62  valid = o.valid;
63  uri = o.uri;
64  listUri = o.listUri;
65  name = o.name;
66  }
67 
68  inline QString getName() const
69  {
70  return name;
71  }
72 
73  inline QString getUri() const
74  {
75  return uri;
76  }
77 
78  inline QUrl getListUri(QString locale="en") const
79  {
80  return listUri.arg(locale);
81  }
82 
83  inline bool isValid() const
84  {
85  return valid;
86  }
87 
88  static VoiceProvider fromJson(QJsonValue obj);
89 };
90 
91 }
92 
93 Q_DECLARE_METATYPE(osmscout::VoiceProvider)
94 
95 #endif // OSMSCOUT_CLIENT_QT_VOICEPROVIDER_H
#define OSMSCOUT_CLIENT_QT_API
Definition: ClientQtImportExport.h:45
VoiceProvider(const VoiceProvider &o)
Definition: VoiceProvider.h:51
bool isValid() const
Definition: VoiceProvider.h:83
Definition: Area.h:38
QString getUri() const
Definition: VoiceProvider.h:73
Definition: VoiceProvider.h:38
QString getName() const
Definition: VoiceProvider.h:68
QUrl getListUri(QString locale="en") const
Definition: VoiceProvider.h:78
VoiceProvider(const QString &name, const QString &uri, const QString &listUri)
Definition: VoiceProvider.h:55
void operator=(const VoiceProvider &o)
Definition: VoiceProvider.h:60