Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CACanorusMLImport Class Reference

#include <canorusmlimport.h>

Inheritance diagram for CACanorusMLImport:
Inheritance graph
[legend]

Public Member Functions

 CACanorusMLImport (QTextStream *stream=0)
 
 CACanorusMLImport (const QString stream)
 
virtual ~CACanorusMLImport ()
 
void initCanorusMLImport ()
 
CADocumentimportDocumentImpl ()
 
bool startElement (const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes)
 
bool endElement (const QString &namespaceURI, const QString &localName, const QString &qName)
 
bool fatalError (const QXmlParseException &exception)
 
bool characters (const QString &ch)
 
- Public Member Functions inherited from CAImport
 CAImport (QTextStream *stream=0)
 
 CAImport (const QString stream)
 
virtual ~CAImport ()
 
virtual const QString readableStatus ()
 
void importDocument ()
 
void importSheet ()
 
void importStaff ()
 
void importVoice ()
 
void importLyricsContext ()
 
void importFunctionMarkContext ()
 
CADocumentimportedDocument ()
 
CASheetimportedSheet ()
 
CAStaffimportedStaff ()
 
CAVoiceimportedVoice ()
 
CALyricsContextimportedLyricsContext ()
 
CAFunctionMarkContextimportedFunctionMarkContext ()
 
- Public Member Functions inherited from CAFile
 CAFile ()
 
virtual ~CAFile ()
 
const int status ()
 
const int progress ()
 
void setStreamFromFile (const QString filename)
 
void setStreamToFile (const QString filename)
 
void setStreamFromDevice (QIODevice *device)
 
void setStreamToDevice (QIODevice *device)
 

Private Member Functions

void importMark (const QXmlAttributes &attributes)
 
void importResource (const QXmlAttributes &attributes)
 
CADocumentdocument ()
 

Private Attributes

CADocument_document
 
QString _version
 
QString _errorMsg
 
QStack< QString > _depth
 
CASheet_curSheet
 
CAContext_curContext
 
CAVoice_curVoice
 
CAKeySignature_curKeySig
 
CATimeSignature_curTimeSig
 
CAClef_curClef
 
CABarline_curBarline
 
CANote_curNote
 
CARest_curRest
 
CAMusElement_curMusElt
 
CAMark_curMark
 
CASlur_curTie
 
CASlur_curSlur
 
CATuplet_curTuplet
 
CASlur_curPhrasingSlur
 
CADiatonicPitch _curDiatonicPitch
 
CADiatonicKey _curDiatonicKey
 
CAPlayableLength _curPlayableLength
 
CAPlayableLength _curTempoPlayableLength
 
QHash< CALyricsContext *, int > _lcMap
 
QHash< CASyllable *, int > _syllableMap
 
QColor _color
 
QString _cha
 

Additional Inherited Members

- Signals inherited from CAImport
void documentImported (CADocument *)
 
void sheetImported (CASheet *)
 
void staffImported (CAStaff *)
 
void voiceImported (CAVoice *)
 
void lyricsContextImported (CALyricsContext *)
 
void functionMarkContextImported (CAFunctionMarkContext *)
 
void importDone (int status)
 
- Protected Member Functions inherited from CAImport
virtual CASheetimportSheetImpl ()
 
virtual CAStaffimportStaffImpl ()
 
virtual CAVoiceimportVoiceImpl ()
 
virtual CALyricsContextimportLyricsContextImpl ()
 
virtual CAFunctionMarkContextimportFunctionMarkContextImpl ()
 
QTextStream & in ()
 

Constructor & Destructor Documentation

CACanorusMLImport::CACanorusMLImport ( QTextStream *  stream = 0)

Copyright (c) 2006-2007, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.

References initCanorusMLImport().

Here is the call graph for this function:

CACanorusMLImport::CACanorusMLImport ( const QString  stream)

References initCanorusMLImport().

Here is the call graph for this function:

CACanorusMLImport::~CACanorusMLImport ( )
virtual

Member Function Documentation

bool CACanorusMLImport::characters ( const QString &  ch)

Stores the characters between the greater-lesser signs while parsing the XML file. This is usually needed for getting the property values stored not as node attributes, but between greater-lesser signs.

eg.

<length>127</length>

Would set _cha value to "127".

See Also
startElement(), endElement()

References _cha.

CACanorusMLImport::document ( )
inlineprivate

Returns the newly created document when reading the XML file.

References _document.

Referenced by importDocumentImpl().

Here is the caller graph for this function:

bool CACanorusMLImport::endElement ( const QString &  namespaceURI,
const QString &  localName,
const QString &  qName 
)

This function is called automatically by Qt SAX parser while reading the CanorusML source. This function is called when a node has been closed (</nodeName>). Attributes for closed notes are usually not set in CanorusML format. That's why we need to store local node attributes (set when the node is opened) each time.

The function returns true, if the node was successfully recognized and parsed; otherwise false.

See Also
startElement()

References _cha, _curBarline, _curClef, _curContext, _curDiatonicKey, _curDiatonicPitch, _curKeySig, _curMark, _curMusElt, _curNote, _curPlayableLength, _curRest, _curSheet, _curTempoPlayableLength, _curTimeSig, _curTuplet, _curVoice, _depth, _document, _lcMap, _syllableMap, _version, CAVoice::append(), CATuplet::assignTimes(), CAMusElement::Barline, CAPlayable::calculateTimeLength(), CAMusElement::Clef, CAVoice::contains(), CAContext::contextType(), CAMusElement::FunctionMark, CAMusElement::KeySignature, CAKeySignature::keySignatureType(), CAVoice::lastNote(), CAKeySignature::MajorMinor, CAMark::markType(), CAMusElement::musElementType(), CAKeySignature::setDiatonicKey(), CANote::setDiatonicPitch(), CADiatonicKey::setDiatonicPitch(), CAPlayable::setPlayableLength(), CADocument::sheetAt(), CADocument::sheetCount(), CAContext::Staff, CASheet::staffAt(), CASheet::staffCount(), CAStaff::synchronizeVoices(), CAMark::Tempo, CAMusElement::TimeSignature, CAMusElement::timeStart(), CAPlayable::tuplet(), CANote::updateTies(), and CASheet::voiceList().

Here is the call graph for this function:

bool CACanorusMLImport::fatalError ( const QXmlParseException &  exception)

This method should be called when a critical error occurs while parsing the XML source.

See Also
startElement(), endElement()

References _errorMsg.

CADocument * CACanorusMLImport::importDocumentImpl ( )
virtual

Opens a CanorusML source in and creates a document out of it. mainWin is needed for any UI settings stored in the file (the last viewports positions, current sheet etc.). CACanorusML uses SAX parser for reading.

Reimplemented from CAImport.

References document(), and CAFile::stream().

Here is the call graph for this function:

void CACanorusMLImport::importMark ( const QXmlAttributes &  attributes)
private
void CACanorusMLImport::importResource ( const QXmlAttributes &  attributes)
private

Imports the current resource.

References _document, CAFile::file(), CAResourceCtl::importResource(), CAResource::resourceTypeFromString(), and CAResource::setDescription().

Referenced by startElement().

Here is the call graph for this function:

Here is the caller graph for this function:

void CACanorusMLImport::initCanorusMLImport ( )
bool CACanorusMLImport::startElement ( const QString &  namespaceURI,
const QString &  localName,
const QString &  qName,
const QXmlAttributes &  attributes 
)

This function is called automatically by Qt SAX parser while reading the CanorusML source. This function is called when a new node is opened. It already reads node attributes.

The function returns true, if the node was successfully recognized and parsed; otherwise false.

See Also
endElement()

References _color, _curBarline, _curClef, _curContext, _curDiatonicKey, _curDiatonicPitch, _curKeySig, _curMark, _curMusElt, _curNote, _curPhrasingSlur, _curPlayableLength, _curRest, _curSheet, _curSlur, _curTempoPlayableLength, _curTie, _curTimeSig, _curTuplet, _curVoice, _depth, _document, _errorMsg, _lcMap, _syllableMap, _version, CASheet::addContext(), CATuplet::addNote(), CADocument::addSheet(), CAStaff::addVoice(), CABarline::barlineTypeFromString(), CAClef::clefTypeFromString(), CASheet::contextCount(), CAContext::contextType(), CAFunctionMark::functionTypeFromString(), CADiatonicKey::genderFromString(), importMark(), importResource(), CAKeySignature::keySignatureTypeFromString(), CAKeySignature::MajorMinor, CAKeySignature::Modus, CAKeySignature::modusFromString(), CAPlayableLength::musicLengthFromString(), CASlur::PhrasingSlurType, CARest::restTypeFromString(), CADocument::setArranger(), CAMusElement::setColor(), CADocument::setComments(), CADocument::setComposer(), CADocument::setCopyright(), CADocument::setDateCreated(), CADocument::setDateLastModified(), CADocument::setDedication(), CAVoice::setMidiChannel(), CAVoice::setMidiProgram(), CASlur::setNoteEnd(), CANote::setPhrasingSlurEnd(), CANote::setPhrasingSlurStart(), CADocument::setPoet(), CASlur::setSlurDirection(), CANote::setSlurEnd(), CANote::setSlurStart(), CASlur::setSlurStyle(), CANote::setStemDirection(), CADocument::setSubtitle(), CADocument::setTextTranslator(), CANote::setTieStart(), CADocument::setTimeEdited(), CADocument::setTitle(), CAPlayable::setTuplet(), CADocument::sheetCount(), CASlur::slurDirectionFromString(), CASlur::SlurPreferred, CASlur::slurStyleFromString(), CASlur::SlurType, CAContext::Staff, CAVoice::staff(), CAPlayable::staff(), CASheet::staffCount(), CANote::stemDirectionFromString(), CANote::StemNeutral, CASlur::TieType, CATimeSignature::timeSignatureTypeFromString(), and CAStaff::voiceCount().

Member Data Documentation

CACanorusMLImport::_cha
private

Current characters being read using characters() method between the greater/lesser separators in XML file.

See Also
characters()

Referenced by characters(), and endElement().

QColor CACanorusMLImport::_color
private

Referenced by startElement().

CABarline* CACanorusMLImport::_curBarline
private
CAClef* CACanorusMLImport::_curClef
private
CAContext* CACanorusMLImport::_curContext
private
CADiatonicKey CACanorusMLImport::_curDiatonicKey
private

Referenced by endElement(), and startElement().

CADiatonicPitch CACanorusMLImport::_curDiatonicPitch
private

Referenced by endElement(), and startElement().

CAKeySignature* CACanorusMLImport::_curKeySig
private
CAMark* CACanorusMLImport::_curMark
private
CAMusElement* CACanorusMLImport::_curMusElt
private
CANote* CACanorusMLImport::_curNote
private
CASlur* CACanorusMLImport::_curPhrasingSlur
private
CAPlayableLength CACanorusMLImport::_curPlayableLength
private

Referenced by endElement(), and startElement().

CARest* CACanorusMLImport::_curRest
private
CASheet* CACanorusMLImport::_curSheet
private
CASlur* CACanorusMLImport::_curSlur
private
CAPlayableLength CACanorusMLImport::_curTempoPlayableLength
private

Referenced by endElement(), and startElement().

CASlur* CACanorusMLImport::_curTie
private
CATimeSignature* CACanorusMLImport::_curTimeSig
private
CATuplet* CACanorusMLImport::_curTuplet
private
CAVoice* CACanorusMLImport::_curVoice
private
CACanorusMLImport::_depth
private

Stack which represents the current depth of the document while SAX parsing. It contains the tag names as the values.

See Also
startElement(), endElement()

Referenced by endElement(), and startElement().

CACanorusMLImport::_document
private

Pointer to the document being read.

See Also
CADocument

Referenced by document(), endElement(), importResource(), initCanorusMLImport(), and startElement().

CACanorusMLImport::_errorMsg
private

The error message content stored as QString, if the error happens.

See Also
fatalError()

Referenced by fatalError(), and startElement().

QHash<CALyricsContext*, int> CACanorusMLImport::_lcMap
private

Referenced by endElement(), and startElement().

QHash<CASyllable*, int> CACanorusMLImport::_syllableMap
private

Referenced by endElement(), and startElement().

CACanorusMLImport::_version
private

Document program version - which Canorus saved the file?

See Also
startElement(), endElement()

Referenced by endElement(), importMark(), and startElement().


The documentation for this class was generated from the following files: