Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
canorusmlimport.h
Go to the documentation of this file.
1 
8 #ifndef CANORUSMLIMPORT_H_
9 #define CANORUSMLIMPORT_H_
10 
11 #include <QStack>
12 #include <QHash>
13 #include <QXmlDefaultHandler>
14 #include <QColor>
15 
16 #include "import/import.h"
17 
18 #include "core/diatonicpitch.h"
19 #include "core/playablelength.h"
20 #include "core/diatonickey.h"
21 
22 class CAContext;
23 class CAKeySignature;
24 class CATimeSignature;
25 class CAClef;
26 class CABarline;
27 class CANote;
28 class CARest;
29 class CASlur;
30 class CASyllable;
31 class CAMusElement;
32 class CAMark;
33 class CATuplet;
34 
36 public:
37  CACanorusMLImport( QTextStream *stream=0 );
38  CACanorusMLImport( const QString stream );
39  virtual ~CACanorusMLImport();
40 
41  void initCanorusMLImport();
42 
44 
45  bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName,
46  const QXmlAttributes& attributes);
47  bool endElement(const QString& namespaceURI, const QString& localName,
48  const QString& qName);
49  bool fatalError(const QXmlParseException& exception);
50  bool characters(const QString& ch);
51 
52 private:
53  void importMark( const QXmlAttributes& attributes );
54  void importResource( const QXmlAttributes& attributes );
55 
56  inline CADocument *document() { return _document; }
58 
59  QString _version;
60  QString _errorMsg;
61  QStack<QString> _depth;
62 
63  // Pointers to the current elements when reading the XML file
83  QHash<CALyricsContext*, int> _lcMap; // lyrics context associated voice indices
84  QHash<CASyllable*, int> _syllableMap; // syllable associated voice indices
85  QColor _color; // foreground color of elements
86 
88  // Temporary properties for each XML stanza //
90  QString _cha;
91 };
92 
93 #endif /* CANORUSMLIMPORT_H_ */