CALilyPondImport Class Reference

#include <lilypondimport.h>

Inheritance diagram for CALilyPondImport:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 CALilyPondImport (const QString in)
 CALilyPondImport (QTextStream *in=0)
void setTemplateVoice (CAVoice *voice)
virtual ~CALilyPondImport ()
const QString readableStatus ()

Private Types

enum  CALilyPondDepth { Score, Layout, Voice, Chord }

Private Member Functions

void initLilyPondImport ()
CAVoiceimportVoiceImpl ()
CALyricsContextimportLyricsContextImpl ()
CAVoicecurVoice ()
void setCurVoice (CAVoice *voice)
const QString parseNextElement ()
const QString peekNextElement ()
void addError (QString description, int lineError=0, int charError=0)
CALength playableLengthFromLilyPond (QString &playableElt, bool parse=false)
bool isNote (const QString elt)
CAPitch relativePitchFromLilyPond (QString &note, int prevPitch, bool parse=false)
bool isRest (const QString elt)
CARest::CARestType restTypeFromLilyPond (QString &rest, bool parse=false)
CAClef::CAPredefinedClefType predefinedClefTypeFromLilyPond (const QString clef)
int clefOffsetFromLilyPond (const QString clef)
CABarline::CABarlineType barlineTypeFromLilyPond (const QString bar)
signed char keySigAccsFromLilyPond (QString keySig, CAKeySignature::CAMajorMinorGender gender)
CAKeySignature::CAMajorMinorGender keySigGenderFromLilyPond (QString gender)
CATime timeSigFromLilyPond (QString time)
CAMusElementfindSharedElement (CAMusElement *elt)
QString & in ()
CALilyPondDepth curDepth ()
void pushDepth (CALilyPondDepth depth)
CALilyPondDepth popDepth ()
int curLine ()
int curChar ()
CAVoicetemplateVoice ()

Private Attributes

CAVoice_curVoice
CASlur_curSlur
CASlur_curPhrasingSlur
QStack< CALilyPondDepth_depth
int _curLine
int _curChar
QList< QString > _errors
QList< QString > _warnings
CAVoice_templateVoice

Static Private Attributes

static const QRegExp WHITESPACE_DELIMITERS = QRegExp("[\\s]")
static const QRegExp SYNTAX_DELIMITERS = QRegExp("[<>{}]")
static const QRegExp DELIMITERS

Classes

struct  CALength
struct  CAPitch
struct  CATime


Detailed Description

Definition at line 27 of file lilypondimport.h.


Member Enumeration Documentation

enum CALilyPondImport::CALilyPondDepth [private]

Enumerator:
Score 
Layout 
Voice 
Chord 

Definition at line 64 of file lilypondimport.h.


Constructor & Destructor Documentation

CALilyPondImport::CALilyPondImport ( const QString  in  ) 

Definition at line 42 of file lilypondimport.cpp.

References initLilyPondImport().

Here is the call graph for this function:

CALilyPondImport::CALilyPondImport ( QTextStream *  in = 0  ) 

Definition at line 47 of file lilypondimport.cpp.

References initLilyPondImport().

Here is the call graph for this function:

CALilyPondImport::~CALilyPondImport (  )  [virtual]

Definition at line 52 of file lilypondimport.cpp.


Member Function Documentation

void CALilyPondImport::setTemplateVoice ( CAVoice voice  )  [inline]

Definition at line 32 of file lilypondimport.h.

References _templateVoice.

Referenced by CAMainWin::sourceViewPortCommit().

const QString CALilyPondImport::readableStatus (  )  [virtual]

Reimplemented from CAImport.

Definition at line 668 of file lilypondimport.cpp.

References curChar(), curLine(), and CAFile::status().

Here is the call graph for this function:

void CALilyPondImport::initLilyPondImport (  )  [private]

Definition at line 55 of file lilypondimport.cpp.

References _curChar, _curLine, _curPhrasingSlur, _curSlur, and _templateVoice.

Referenced by CALilyPondImport().

Here is the caller graph for this function:

CAVoice * CALilyPondImport::importVoiceImpl (  )  [private, virtual]

Reimplemented from CAImport.

Definition at line 68 of file lilypondimport.cpp.

References _curPhrasingSlur, _curSlur, CALilyPondImport::CAPitch::accs, addError(), CAVoice::append(), barlineTypeFromLilyPond(), CALilyPondImport::CATime::beat, CALilyPondImport::CATime::beats, Chord, clefOffsetFromLilyPond(), CAVoice::cloneVoiceProperties(), curDepth(), curVoice(), CALilyPondImport::CALength::dotted, findSharedElement(), in(), isNote(), isRest(), keySigAccsFromLilyPond(), keySigGenderFromLilyPond(), CAVoice::lastMusElement(), CALilyPondImport::CALength::length, CAKeySignature::MajorMinor, CAMusElement::musElementType(), CAMusElement::musElementTypeToString(), CAMusElement::Note, parseNextElement(), peekNextElement(), CASlur::PhrasingSlurType, CALilyPondImport::CAPitch::pitch, playableLengthFromLilyPond(), popDepth(), predefinedClefTypeFromLilyPond(), pushDepth(), CAPlayable::Quarter, relativePitchFromLilyPond(), restTypeFromLilyPond(), setCurVoice(), CASlur::setNoteEnd(), CANote::setPhrasingSlurEnd(), CANote::setPhrasingSlurStart(), CANote::setSlurEnd(), CANote::setSlurStart(), CANote::setTieStart(), CABarline::Single, CASlur::SlurPreferred, CASlur::SlurType, CAPlayable::staff(), templateVoice(), CASlur::TieType, timeSigFromLilyPond(), CAKeySignature::Undefined, CAClef::Undefined, CABarline::Undefined, CAPlayable::Undefined, CANote::updateTies(), and Voice.

Here is the call graph for this function:

CALyricsContext * CALilyPondImport::importLyricsContextImpl (  )  [private, virtual]

Reimplemented from CAImport.

Definition at line 328 of file lilypondimport.cpp.

References CALyricsContext::addSyllable(), in(), parseNextElement(), CALyricsContext::repositSyllables(), CASyllable::setHyphenStart(), and CASyllable::setMelismaStart().

Here is the call graph for this function:

CAVoice* CALilyPondImport::curVoice (  )  [inline, private]

Definition at line 75 of file lilypondimport.h.

References _curVoice.

Referenced by findSharedElement(), and importVoiceImpl().

Here is the caller graph for this function:

void CALilyPondImport::setCurVoice ( CAVoice voice  )  [inline, private]

Definition at line 76 of file lilypondimport.h.

References _curVoice.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

const QString CALilyPondImport::parseNextElement (  )  [private]

Returns the first element in input stream ended with one of the delimiters and shorten input stream for the element.

Todo:
Only one-character syntax delimiters are supported so far.
See also:
peekNextElement()

Definition at line 358 of file lilypondimport.cpp.

References DELIMITERS, and in().

Referenced by importLyricsContextImpl(), and importVoiceImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

const QString CALilyPondImport::peekNextElement (  )  [private]

Returns the first element in input stream ended with one of the delimiters but don't shorten the stream.

See also:
parseNextElement()

Definition at line 387 of file lilypondimport.cpp.

References DELIMITERS, and in().

Referenced by importVoiceImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

void CALilyPondImport::addError ( QString  description,
int  lineError = 0,
int  charError = 0 
) [private]

Definition at line 61 of file lilypondimport.cpp.

References _curChar, _curLine, and _errors.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CALilyPondImport::CALength CALilyPondImport::playableLengthFromLilyPond ( QString &  elt,
bool  parse = false 
) [private]

Generates playable lentgth and number of dots from the note/rest string in LilyPond syntax. If the playable element doesn't include length, { CAPlayable::CAPlayableLength::Undefined, 0 } is returned. This function also shortens the given string for the playable length, if parse is True.

See also:
relativePitchFromString()

Definition at line 516 of file lilypondimport.cpp.

References CALilyPondImport::CALength::dotted, CALilyPondImport::CALength::length, and CAPlayable::Undefined.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

bool CALilyPondImport::isNote ( const QString  elt  )  [private]

Returns true, if the given LilyPond element is a note.

See also:
isRest()

Definition at line 443 of file lilypondimport.cpp.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CALilyPondImport::CAPitch CALilyPondImport::relativePitchFromLilyPond ( QString &  constNName,
int  prevPitch,
bool  parse = false 
) [private]

Generates the note pitch and number of accidentals from the note written in LilyPond syntax.

See also:
playableLengthFromLilyPond()

Definition at line 461 of file lilypondimport.cpp.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

bool CALilyPondImport::isRest ( const QString  elt  )  [private]

Returns true, if the given LilyPond element is a rest.

See also:
isNote()

Definition at line 452 of file lilypondimport.cpp.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CARest::CARestType CALilyPondImport::restTypeFromLilyPond ( QString &  elt,
bool  parse = false 
) [private]

Genarates rest type from the LilyPond syntax for the given rest. This function also shortens the given string for the rest type, if parse is True.

Definition at line 548 of file lilypondimport.cpp.

References CARest::Hidden, and CARest::Normal.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CAClef::CAPredefinedClefType CALilyPondImport::predefinedClefTypeFromLilyPond ( const QString  constClef  )  [private]

Genarates clef type from the LilyPond syntax for the given clef from format "clefType".

Definition at line 565 of file lilypondimport.cpp.

References CAClef::Alto, CAClef::Baritone, CAClef::Bass, CAClef::French, CAClef::Mezzosoprano, CAClef::Percussion, CAClef::Soprano, CAClef::Subbass, CAClef::Tablature, CAClef::Tenor, CAClef::Treble, and CAClef::Varbaritone.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

int CALilyPondImport::clefOffsetFromLilyPond ( const QString  constClef  )  [private]

Returns the Canorus octava or whichever interval above or below the clef.

Definition at line 589 of file lilypondimport.cpp.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CABarline::CABarlineType CALilyPondImport::barlineTypeFromLilyPond ( const QString  bar  )  [private]

Genarates barline type from the LilyPond syntax for the given barline from format "barlineType".

Definition at line 653 of file lilypondimport.cpp.

References CABarline::Dotted, CABarline::Double, CABarline::End, CABarline::RepeatClose, CABarline::RepeatCloseOpen, CABarline::RepeatOpen, CABarline::Single, and CABarline::Undefined.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

signed char CALilyPondImport::keySigAccsFromLilyPond ( QString  keySig,
CAKeySignature::CAMajorMinorGender  gender 
) [private]

Returns the number and type of accidentals for the given key signature.

Definition at line 611 of file lilypondimport.cpp.

References CAKeySignature::Major.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CAKeySignature::CAMajorMinorGender CALilyPondImport::keySigGenderFromLilyPond ( QString  gender  )  [private]

Returns the key signature gender from format \genderType.

Definition at line 628 of file lilypondimport.cpp.

References CAKeySignature::Major, CAKeySignature::Minor, and CAKeySignature::Undefined.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CALilyPondImport::CATime CALilyPondImport::timeSigFromLilyPond ( QString  timeSig  )  [private]

Returns the time signature beat and beats in beats/beat format.

Definition at line 640 of file lilypondimport.cpp.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CAMusElement * CALilyPondImport::findSharedElement ( CAMusElement elt  )  [private]

Gathers a list of music elements with the given element's start time and returns the first music element in the gathered list with the same attributes.

This method is usually called when voices have "shared" music elements (barlines, clefs etc.). However, in LilyPond syntax the music element can/should be present in all the voices. This function finds this shared music element, if it already exists.

If the music element with the same properties exists, user should delete its own instance and add an already existing instance of the returned shared music element to the voice.

See also:
CAMusElement::compare()

Definition at line 422 of file lilypondimport.cpp.

References CAVoice::contains(), curVoice(), CAStaff::getEltByType(), CAMusElement::musElementType(), CAVoice::staff(), and CAMusElement::timeStart().

Referenced by importVoiceImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

QString& CALilyPondImport::in (  )  [inline, private]

Reimplemented from CAImport.

Definition at line 103 of file lilypondimport.h.

References CAFile::stream().

Referenced by importLyricsContextImpl(), importVoiceImpl(), parseNextElement(), and peekNextElement().

Here is the call graph for this function:

Here is the caller graph for this function:

CALilyPondDepth CALilyPondImport::curDepth (  )  [inline, private]

Definition at line 104 of file lilypondimport.h.

References _depth.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

void CALilyPondImport::pushDepth ( CALilyPondDepth  depth  )  [inline, private]

Definition at line 105 of file lilypondimport.h.

References _depth.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

CALilyPondDepth CALilyPondImport::popDepth (  )  [inline, private]

Definition at line 106 of file lilypondimport.h.

References _depth.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

int CALilyPondImport::curLine (  )  [inline, private]

Definition at line 107 of file lilypondimport.h.

References _curLine.

Referenced by readableStatus().

Here is the caller graph for this function:

int CALilyPondImport::curChar (  )  [inline, private]

Definition at line 108 of file lilypondimport.h.

References _curChar.

Referenced by readableStatus().

Here is the caller graph for this function:

CAVoice* CALilyPondImport::templateVoice (  )  [inline, private]

Definition at line 119 of file lilypondimport.h.

References _templateVoice.

Referenced by importVoiceImpl().

Here is the caller graph for this function:


Member Data Documentation

const QRegExp CALilyPondImport::WHITESPACE_DELIMITERS = QRegExp("[\\s]") [static, private]

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

Delimiters which separate various music elements in LilyPond syntax. These are new lines, tabs, blanks etc.

See also:
nextElement(), parseNextElement()

Definition at line 42 of file lilypondimport.h.

const QRegExp CALilyPondImport::SYNTAX_DELIMITERS = QRegExp("[<>{}]") [static, private]

Delimiters which separate various music elements in LilyPond syntax, but are specific for LilyPond syntax. They are reported as its own element when parsing the next element.

See also:
nextElement(), parseNextElement()

Definition at line 43 of file lilypondimport.h.

const QRegExp CALilyPondImport::DELIMITERS [static, private]

Initial value:

Combined WHITESPACE_DELIMITERS and SYNTAX_DELIMITERS.

Definition at line 44 of file lilypondimport.h.

Referenced by parseNextElement(), and peekNextElement().

CAVoice* CALilyPondImport::_curVoice [private]

Definition at line 111 of file lilypondimport.h.

Referenced by curVoice(), and setCurVoice().

CASlur* CALilyPondImport::_curSlur [private]

Definition at line 112 of file lilypondimport.h.

Referenced by importVoiceImpl(), and initLilyPondImport().

CASlur* CALilyPondImport::_curPhrasingSlur [private]

Definition at line 113 of file lilypondimport.h.

Referenced by importVoiceImpl(), and initLilyPondImport().

QStack<CALilyPondDepth> CALilyPondImport::_depth [private]

Definition at line 114 of file lilypondimport.h.

Referenced by curDepth(), popDepth(), and pushDepth().

int CALilyPondImport::_curLine [private]

Definition at line 115 of file lilypondimport.h.

Referenced by addError(), curLine(), and initLilyPondImport().

int CALilyPondImport::_curChar [private]

Definition at line 115 of file lilypondimport.h.

Referenced by addError(), curChar(), and initLilyPondImport().

QList<QString> CALilyPondImport::_errors [private]

Definition at line 116 of file lilypondimport.h.

Referenced by addError().

QList<QString> CALilyPondImport::_warnings [private]

Definition at line 117 of file lilypondimport.h.

CAVoice* CALilyPondImport::_templateVoice [private]

Definition at line 120 of file lilypondimport.h.

Referenced by initLilyPondImport(), setTemplateVoice(), and templateVoice().


The documentation for this class was generated from the following files:
Generated on Sat Feb 9 13:15:49 2008 for Canorus by  doxygen 1.5.3