Canorus  0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CACanorusMLImport Class Reference

Class for opening the Canorus documents. More...

#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 ()
 
void setStreamFromFile (const QString filename)
 
QString fileName ()
 
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)
 
void setStreamToString ()
 
QString getStreamAsString ()
 

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
 
CAMusElement_prevMusElt
 
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 ()
 
- Protected Member Functions inherited from CAFile
void setStatus (const int status)
 
void setProgress (const int progress)
 
QTextStream * stream ()
 
virtual void setStream (QTextStream *stream)
 
QFile * file ()
 
void setFile (QFile *file)
 
- Protected Attributes inherited from CAImport
QString _fileName
 

Detailed Description

Class for opening the Canorus documents.

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.

CACanorusMLImport class opens the XML based Canorus documents. It uses SAX parser for reading.

See also
CAImport, CACanorusMLExport

Constructor & Destructor Documentation

◆ CACanorusMLImport() [1/2]

CACanorusMLImport::CACanorusMLImport ( QTextStream *  stream = 0)

References initCanorusMLImport().

Here is the call graph for this function:

◆ CACanorusMLImport() [2/2]

CACanorusMLImport::CACanorusMLImport ( const QString  stream)

References initCanorusMLImport().

Here is the call graph for this function:

◆ ~CACanorusMLImport()

CACanorusMLImport::~CACanorusMLImport ( )
virtual

Member Function Documentation

◆ characters()

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.

◆ document()

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:

◆ endElement()

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, _prevMusElt, _syllableMap, _version, CAVoice::append(), CATuplet::assignTimes(), CAMusElement::Barline, CAPlayable::calculateTimeLength(), CAMusElement::Clef, CAContext::contextType(), CAKeySignature::Custom, CAMusElement::FunctionMark, CAMusElement::KeySignature, CAKeySignature::keySignatureType(), CAVoice::lastNote(), CAKeySignature::MajorMinor, CAMark::markType(), CAKeySignature::Modus, CAVoice::musElementList(), CAMusElement::musElementType(), CAKeySignature::setDiatonicKey(), CANote::setDiatonicPitch(), CADiatonicKey::setDiatonicPitch(), CAPlayable::setPlayableLength(), CADocument::sheetList(), CAContext::Staff, CAMark::Tempo, CAMusElement::TimeSignature, CAMusElement::timeStart(), CAPlayable::tuplet(), CANote::updateTies(), and CASheet::voiceList().

Here is the call graph for this function:

◆ fatalError()

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.

◆ importDocumentImpl()

CADocument * CACanorusMLImport::importDocumentImpl ( )
virtual

Reimplemented from CAImport.

References CAImport::_fileName, document(), CADocument::setFileName(), and CAFile::stream().

Here is the call graph for this function:

◆ importMark()

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

◆ importResource()

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

Imports the current resource.

References _document, CAFile::file(), CAImport::fileName(), 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:

◆ initCanorusMLImport()

void CACanorusMLImport::initCanorusMLImport ( )

◆ startElement()

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, _prevMusElt, _syllableMap, _version, CASheet::addContext(), CATuplet::addNote(), CAFiguredBassMark::addNumber(), CADocument::addSheet(), CAStaff::addVoice(), CABarline::barlineTypeFromString(), CAClef::clefTypeFromString(), CASheet::contextList(), CAContext::contextType(), CAKeySignature::Custom, CAFunctionMark::functionTypeFromString(), CADiatonicKey::genderFromString(), importMark(), importResource(), CAKeySignature::keySignatureTypeFromString(), CAKeySignature::MajorMinor, CAKeySignature::Modus, CAKeySignature::modusFromString(), CAPlayableLength::musicLengthFromString(), CASlur::noteStart(), CASlur::PhrasingSlurType, CARest::restTypeFromString(), CADocument::setArranger(), CAMusElement::setColor(), CADocument::setComments(), CADocument::setComposer(), CADocument::setCopyright(), CADocument::setDateCreated(), CADocument::setDateLastModified(), CADocument::setDedication(), CAVoice::setMidiChannel(), CAVoice::setMidiPitchOffset(), 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(), CAMusElement::setTimeLength(), CADocument::setTitle(), CAPlayable::setTuplet(), CADocument::sheetList(), CASlur::slurDirectionFromString(), CASlur::SlurPreferred, CASlur::slurStyleFromString(), CASlur::SlurType, CAContext::Staff, CAPlayable::staff(), CAVoice::staff(), CASheet::staffList(), CANote::stemDirectionFromString(), CANote::StemNeutral, CASlur::TieType, CATimeSignature::timeSignatureTypeFromString(), CAMusElement::timeStart(), and CAStaff::voiceList().

Member Data Documentation

◆ _cha

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().

◆ _color

QColor CACanorusMLImport::_color
private

Referenced by startElement().

◆ _curBarline

CABarline* CACanorusMLImport::_curBarline
private

◆ _curClef

CAClef* CACanorusMLImport::_curClef
private

◆ _curContext

CAContext* CACanorusMLImport::_curContext
private

◆ _curDiatonicKey

CADiatonicKey CACanorusMLImport::_curDiatonicKey
private

Referenced by endElement(), and startElement().

◆ _curDiatonicPitch

CADiatonicPitch CACanorusMLImport::_curDiatonicPitch
private

Referenced by endElement(), and startElement().

◆ _curKeySig

CAKeySignature* CACanorusMLImport::_curKeySig
private

◆ _curMark

CAMark* CACanorusMLImport::_curMark
private

◆ _curMusElt

CAMusElement* CACanorusMLImport::_curMusElt
private

◆ _curNote

CANote* CACanorusMLImport::_curNote
private

◆ _curPhrasingSlur

CASlur* CACanorusMLImport::_curPhrasingSlur
private

◆ _curPlayableLength

CAPlayableLength CACanorusMLImport::_curPlayableLength
private

Referenced by endElement(), and startElement().

◆ _curRest

CARest* CACanorusMLImport::_curRest
private

◆ _curSheet

CASheet* CACanorusMLImport::_curSheet
private

◆ _curSlur

CASlur* CACanorusMLImport::_curSlur
private

◆ _curTempoPlayableLength

CAPlayableLength CACanorusMLImport::_curTempoPlayableLength
private

Referenced by endElement(), and startElement().

◆ _curTie

CASlur* CACanorusMLImport::_curTie
private

◆ _curTimeSig

CATimeSignature* CACanorusMLImport::_curTimeSig
private

◆ _curTuplet

CATuplet* CACanorusMLImport::_curTuplet
private

◆ _curVoice

CAVoice* CACanorusMLImport::_curVoice
private

◆ _depth

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().

◆ _document

CACanorusMLImport::_document
private

Pointer to the document being read.

See also
CADocument

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

◆ _errorMsg

CACanorusMLImport::_errorMsg
private

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

See also
fatalError()

Referenced by fatalError(), and startElement().

◆ _lcMap

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

Referenced by endElement(), and startElement().

◆ _prevMusElt

CAMusElement* CACanorusMLImport::_prevMusElt
private

◆ _syllableMap

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

Referenced by endElement(), and startElement().

◆ _version

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: