796bce0ec4b9cf9f777f865537e4234b9b36094e
[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();
18     
19     void setContent(QDomDocument &);
20     void setContent(const QString &xmlFile);
21
22     // Returns false if document is not set or it's invalid
23     bool isValid();
24
25     QList<QChar> letters();
26     QStringList manufacturers(const QChar &letter);
27     QList<Model> models(const QString &manufacturer);
28
29 private:
30     void parse(const QString &xmlFile);
31     void parse(QDomDocument &doc);
32     QStringList parseMfgs(QDomElement &charEl);
33     QList<Model> parseModels(QDomElement &mfgEl);
34     void printMaps();
35     
36 private:
37     bool valid;
38     QMap<QChar, QStringList> mfgMap;
39     QMap<QString, QList<Model> > modelMap;
40 };
41
42 #endif // _REMOTELIST_H_
43
44
45