Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/import/canorusmlimport.h
Go to the documentation of this file.
00001 
00008 #ifndef CANORUSMLIMPORT_H_
00009 #define CANORUSMLIMPORT_H_
00010 
00011 #include <QStack>
00012 #include <QHash>
00013 #include <QXmlDefaultHandler>
00014 #include <QColor>
00015 
00016 #include "import/import.h"
00017 
00018 #include "core/diatonicpitch.h"
00019 #include "core/playablelength.h"
00020 #include "core/diatonickey.h"
00021 
00022 class CAContext;
00023 class CAKeySignature;
00024 class CATimeSignature;
00025 class CAClef;
00026 class CABarline;
00027 class CANote;
00028 class CARest;
00029 class CASlur;
00030 class CASyllable;
00031 class CAMusElement;
00032 class CAMark;
00033 class CATuplet;
00034 
00035 class CACanorusMLImport : public CAImport, public QXmlDefaultHandler {
00036 public:
00037         CACanorusMLImport( QTextStream *stream=0 );
00038         CACanorusMLImport( const QString stream );
00039         virtual ~CACanorusMLImport();
00040 
00041         void initCanorusMLImport();
00042 
00043         CADocument* importDocumentImpl();
00044 
00045         bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName,
00046                           const QXmlAttributes& attributes);
00047         bool endElement(const QString& namespaceURI, const QString& localName,
00048                         const QString& qName);
00049         bool fatalError(const QXmlParseException& exception);
00050         bool characters(const QString& ch);
00051 
00052 private:
00053         void importMark( const QXmlAttributes& attributes );
00054         void importResource( const QXmlAttributes& attributes );
00055 
00056         inline CADocument *document() { return _document; }
00057         CADocument     *_document;
00058 
00059         QString         _version;
00060         QString         _errorMsg;
00061         QStack<QString> _depth;
00062 
00063         // Pointers to the current elements when reading the XML file
00064         CASheet         *_curSheet;
00065         CAContext       *_curContext;
00066         CAVoice         *_curVoice;
00067         CAKeySignature  *_curKeySig;
00068         CATimeSignature *_curTimeSig;
00069         CAClef          *_curClef;
00070         CABarline       *_curBarline;
00071         CANote          *_curNote;
00072         CARest          *_curRest;
00073         CAMusElement    *_curMusElt;
00074         CAMark          *_curMark;
00075         CASlur          *_curTie;
00076         CASlur          *_curSlur;
00077         CATuplet        *_curTuplet;
00078         CASlur          *_curPhrasingSlur;
00079         CADiatonicPitch  _curDiatonicPitch;
00080         CADiatonicKey    _curDiatonicKey;
00081         CAPlayableLength _curPlayableLength;
00082         CAPlayableLength _curTempoPlayableLength;
00083         QHash<CALyricsContext*, int> _lcMap;       // lyrics context associated voice indices
00084         QHash<CASyllable*, int>      _syllableMap; // syllable associated voice indices
00085         QColor           _color; // foreground color of elements
00086 
00088         // Temporary properties for each XML stanza //
00090         QString _cha;
00091 };
00092 
00093 #endif /* CANORUSMLIMPORT_H_ */