Integration of remotelist to main code
[irwi] / src / remotelist.h
1 #ifndef _REMOTELIST_H_
2 #define _REMOTELIST_H_
3
4 #include <QDomDocument>
5 #include <QStringList>
6 #include <QMap>
7 #include <QList>
8 #include "model.h"
9
10 class RemoteList
11 {
12 public:
13     RemoteList();
14     RemoteList(const RemoteList &);
15     RemoteList(QDomDocument &);
16     RemoteList(const QString &xmlFile);
17     RemoteList(QIODevice);
18     ~RemoteList();
19     
20     void setContent(QDomDocument &);
21     void setContent(const QString &xmlFile);
22
23     // Returns false if document is not set or it's invalid
24     bool isValid();
25
26     QStringList letters();
27     QStringList manufacturers(const QString &letter);
28     QList<Model> models(const QString &manufacturer);
29
30 private:
31     void parse(const QString &xmlFile);
32     void parse(QDomDocument &doc);
33     QStringList parseMfgs(QDomElement &charEl);
34     QList<Model> parseModels(QDomElement &mfgEl);
35     void printMaps();
36     
37 private:
38     bool valid;
39     QMap<QString, QStringList> mfgMap;
40     QMap<QString, QList<Model> > modelMap;
41 };
42
43 #endif // _REMOTELIST_H_
44
45
46