comparison data/fileio/ModelReader.h @ 15:11e298cdb9e7

add - EasaierSessionManager - Easaier menus - Interval model
author lbajardsilogic
date Mon, 14 May 2007 13:10:49 +0000
parents
children e006f4a57f86
comparison
equal deleted inserted replaced
14:819ad579459f 15:11e298cdb9e7
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /* Sound Access
4 EASAIER client application.
5 Silogic 2007. Laure Bajard.
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. See the file
11 COPYING included with this distribution for more information.
12 */
13
14 #ifndef _MODEL_READER_H_
15 #define _MODEL_READER_H_
16
17 #include <QXmlDefaultHandler>
18
19 #include <map>
20
21 class Document;
22 class Layer;
23 class Model;
24 class Pane;
25
26 class ModelReader
27 {
28 public:
29 ModelReader(Document *document, Layer * layer = 0, Pane* pane = 0);
30 virtual ~ModelReader(){}
31
32 bool parse(const QString & filename);
33
34 private:
35 Document *m_document;
36 Layer *m_layer;
37 Pane *m_pane;
38
39 };
40
41 class ModelHandler : public QXmlDefaultHandler
42 {
43 public:
44 ModelHandler(Document *document, Layer * layer = 0, Pane* pane = 0);
45
46 bool startElement(const QString &namespaceURI, const QString &localName,
47 const QString &qName, const QXmlAttributes &attributes);
48 bool endElement(const QString &namespaceURI, const QString &localName,
49 const QString &qName);
50 bool characters(const QString &str);
51 bool error(const QXmlParseException &exception);
52 bool fatalError(const QXmlParseException &exception);
53
54 bool readModel(const QXmlAttributes &attributes);
55 bool readDatasetStart(const QXmlAttributes &attributes);
56 bool readRowData(const QString &text);
57 bool addPointToDataset(const QXmlAttributes &attributes);
58 bool addBinToDataset(const QXmlAttributes &attributes);
59 bool addRowToDataset(const QXmlAttributes &attributes);
60 bool addIntervalToDataset(const QXmlAttributes &attributes);
61
62 bool readLayer(const QXmlAttributes &attributes);
63
64 private:
65 Document *m_document;
66 Layer *m_layer;
67 Pane *m_pane;
68
69 Model *m_model;
70
71 bool m_inData;
72 bool m_inRow;
73 int m_rowNumber;
74
75 QString m_datasetSeparator;
76
77 };
78
79 #endif