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

#include <lilypondimport.h>

Inheritance diagram for CALilyPondImport:
Inheritance graph
[legend]

Classes

struct  CATime
 

Public Member Functions

 CALilyPondImport (const QString in)
 
 CALilyPondImport (QTextStream *in=0)
 
void setTemplateVoice (CAVoice *voice)
 
virtual ~CALilyPondImport ()
 
const QString readableStatus ()
 
- Public Member Functions inherited from CAImport
 CAImport (QTextStream *stream=0)
 
 CAImport (const QString stream)
 
virtual ~CAImport ()
 
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 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)
 
CAPlayableLength playableLengthFromLilyPond (QString &playableElt, bool parse=false)
 
bool isNote (const QString elt)
 
CADiatonicPitch relativePitchFromLilyPond (QString &note, CADiatonicPitch 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)
 
CADiatonicKey::CAGender diatonicKeyGenderFromLilyPond (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
 

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 CADocumentimportDocumentImpl ()
 
virtual CASheetimportSheetImpl ()
 
virtual CAStaffimportStaffImpl ()
 
virtual CAFunctionMarkContextimportFunctionMarkContextImpl ()
 
QTextStream & in ()
 

Member Enumeration Documentation

Enumerator
Score 
Layout 
Voice 
Chord 

Constructor & Destructor Documentation

CALilyPondImport::CALilyPondImport ( const QString  in)

References initLilyPondImport().

Here is the call graph for this function:

CALilyPondImport::CALilyPondImport ( QTextStream *  in = 0)

References initLilyPondImport().

Here is the call graph for this function:

CALilyPondImport::~CALilyPondImport ( )
virtual

Member Function Documentation

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

References _curChar, _curLine, and _errors.

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".

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:

int CALilyPondImport::clefOffsetFromLilyPond ( const QString  constClef)
private

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

Referenced by importVoiceImpl().

Here is the caller graph for this function:

int CALilyPondImport::curChar ( )
inlineprivate

References _curChar.

Referenced by readableStatus().

Here is the caller graph for this function:

CALilyPondDepth CALilyPondImport::curDepth ( )
inlineprivate

References _depth.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

int CALilyPondImport::curLine ( )
inlineprivate

References _curLine.

Referenced by readableStatus().

Here is the caller graph for this function:

CAVoice* CALilyPondImport::curVoice ( )
inlineprivate

References _curVoice.

Referenced by findSharedElement(), and importVoiceImpl().

Here is the caller graph for this function:

CADiatonicKey::CAGender CALilyPondImport::diatonicKeyGenderFromLilyPond ( QString  gender)
private

Returns the key signature gender from format \genderType.

References CADiatonicKey::Major, and CADiatonicKey::Minor.

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

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:

CALyricsContext * CALilyPondImport::importLyricsContextImpl ( )
privatevirtual
CAVoice * CALilyPondImport::importVoiceImpl ( )
privatevirtual
QString& CALilyPondImport::in ( )
inlineprivate

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:

void CALilyPondImport::initLilyPondImport ( )
private

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

Referenced by CALilyPondImport().

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

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

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

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

References DELIMITERS, and in().

Referenced by importVoiceImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References CAPlayableLength::dotted(), CAPlayableLength::setDotted(), and CAPlayableLength::setMusicLength().

Referenced by importVoiceImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

CALilyPondDepth CALilyPondImport::popDepth ( )
inlineprivate

References _depth.

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".

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:

void CALilyPondImport::pushDepth ( CALilyPondDepth  depth)
inlineprivate

References _depth.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

const QString CALilyPondImport::readableStatus ( )
virtual

Reimplemented from CAImport.

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

Here is the call graph for this function:

CADiatonicPitch CALilyPondImport::relativePitchFromLilyPond ( QString &  constNName,
CADiatonicPitch  prevPitch,
bool  parse = false 
)
private

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

See Also
playableLengthFromLilyPond()

References CADiatonicPitch::noteName().

Referenced by importVoiceImpl().

Here is the call graph for this function:

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.

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

Referenced by importVoiceImpl().

Here is the caller graph for this function:

void CALilyPondImport::setCurVoice ( CAVoice voice)
inlineprivate

References _curVoice.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

void CALilyPondImport::setTemplateVoice ( CAVoice voice)
inline

References _templateVoice.

Referenced by CAMainWin::sourceViewPortCommit().

Here is the caller graph for this function:

CAVoice* CALilyPondImport::templateVoice ( )
inlineprivate

References _templateVoice.

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.

Referenced by importVoiceImpl().

Here is the caller graph for this function:

Member Data Documentation

int CALilyPondImport::_curChar
private
int CALilyPondImport::_curLine
private
CASlur* CALilyPondImport::_curPhrasingSlur
private
CASlur* CALilyPondImport::_curSlur
private
CAVoice* CALilyPondImport::_curVoice
private

Referenced by curVoice(), and setCurVoice().

QStack<CALilyPondDepth> CALilyPondImport::_depth
private

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

QList<QString> CALilyPondImport::_errors
private

Referenced by addError().

CAVoice* CALilyPondImport::_templateVoice
private
QList<QString> CALilyPondImport::_warnings
private
const QRegExp CALilyPondImport::DELIMITERS
staticprivate
Initial value:

Combined WHITESPACE_DELIMITERS and SYNTAX_DELIMITERS.

Referenced by parseNextElement(), and peekNextElement().

const QRegExp CALilyPondImport::SYNTAX_DELIMITERS = QRegExp("[<>{}]")
staticprivate

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()
const QRegExp CALilyPondImport::WHITESPACE_DELIMITERS = QRegExp("[\\s]")
staticprivate

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

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