Canorus  0.0
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
CAImport Class Reference

Base class for import filters. More...

#include <import.h>

Inheritance diagram for CAImport:
Inheritance graph
[legend]

Signals

void documentImported (CADocument *)
 
void sheetImported (CASheet *)
 
void staffImported (CAStaff *)
 
void voiceImported (CAVoice *)
 
void lyricsContextImported (CALyricsContext *)
 
void functionMarkContextImported (CAFunctionMarkContext *)
 
void importDone (int status)
 

Public Member Functions

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

Protected Member Functions

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

QString _fileName
 

Private Types

enum  CAImportPart {
  Undefined, Document, Sheet, Staff,
  Voice, LyricsContext, FunctionMarkContext
}
 

Private Member Functions

void setImportedDocument (CADocument *doc)
 
void setImportedSheet (CASheet *sheet)
 
void setImportedStaff (CAStaff *staff)
 
void setImportedVoice (CAVoice *voice)
 
void setImportedLyricsContext (CALyricsContext *lc)
 
void setImportedFunctionMarkContext (CAFunctionMarkContext *fmc)
 
void run ()
 
void setImportPart (CAImportPart part)
 
CAImportPart importPart ()
 

Private Attributes

CADocument_importedDocument
 
CASheet_importedSheet
 
CAStaff_importedStaff
 
CAVoice_importedVoice
 
CALyricsContext_importedLyricsContext
 
CAFunctionMarkContext_importedFunctionMarkContext
 
CAImportPart _importPart
 

Detailed Description

Base class for import filters.

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.

This class inherits CAFile and is the base class for any specific import filter (eg. LilyPond, CanorusML, MusicXML etc.).

If a developer wants to write a new import filter, he should: 1) Create a new class with the base class CAImport 2) Implement CAImport constructors and at least importDocumentImpl() function which returns the new CADocument. 3) Register the filter (put a new fileformat to CAFileFormats and add the filter to open/save dialogs in CACanorus)

Optionally: Developer should change the current status and progress while operations are in progress. He should also rewrite the readableStatus() function.

The following example illustrates the usage of import class:

CAMyImportFilter import();
import.setStreamFromFile("jingle bells.xml");
import.importDocument();
import.wait();
setDocument( import.importedDocument() );

In Python the example is even more direct using the string as an input method:

lilyString = '\\relative c { \\clef "treble" \\time 4/4 c4 d e f | f e d c | c1 \\bar "|." }'
myImport = CALilyPondImport( lilyString )
myImport.importVoice()
myImport.wait()
voice = myImport.importedVoice()
Note
Both stream and string can be used both in Canorus and scripting. The example is only for illustration.

Member Enumeration Documentation

◆ CAImportPart

enum CAImport::CAImportPart
private
Enumerator
Undefined 
Document 
Sheet 
Staff 
Voice 
LyricsContext 
FunctionMarkContext 

Constructor & Destructor Documentation

◆ CAImport() [1/2]

CAImport::CAImport ( QTextStream *  stream = 0)

◆ CAImport() [2/2]

CAImport::CAImport ( const QString  stream)

◆ ~CAImport()

CAImport::~CAImport ( )
virtual

References CAFile::stream().

Here is the call graph for this function:

Member Function Documentation

◆ documentImported

void CAImport::documentImported ( CADocument )
signal

Referenced by run().

Here is the caller graph for this function:

◆ fileName()

QString CAImport::fileName ( )

◆ functionMarkContextImported

void CAImport::functionMarkContextImported ( CAFunctionMarkContext )
signal

Referenced by run().

Here is the caller graph for this function:

◆ importDocument()

void CAImport::importDocument ( )

References Document, setImportPart(), and CAFile::setStatus().

Referenced by CACanImport::importDocumentImpl(), CAMainWin::openDocument(), CAAutoRecovery::openRecovery(), and CAMainWin::sourceViewCommit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importDocumentImpl()

virtual CADocument* CAImport::importDocumentImpl ( )
inlineprotectedvirtual

Reimplemented in CAMXLImport, CAMusicXmlImport, CAMidiImport, CACanorusMLImport, and CACanImport.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importDone

void CAImport::importDone ( int  status)
signal

Referenced by run().

Here is the caller graph for this function:

◆ importedDocument()

CADocument* CAImport::importedDocument ( )
inline

◆ importedFunctionMarkContext()

CAFunctionMarkContext* CAImport::importedFunctionMarkContext ( )
inline

◆ importedLyricsContext()

CALyricsContext* CAImport::importedLyricsContext ( )
inline

References _importedLyricsContext.

Referenced by CAMainWin::sourceViewCommit().

Here is the caller graph for this function:

◆ importedSheet()

CASheet* CAImport::importedSheet ( )
inline

References _importedSheet.

◆ importedStaff()

CAStaff* CAImport::importedStaff ( )
inline

References _importedStaff.

◆ importedVoice()

CAVoice* CAImport::importedVoice ( )
inline

References _importedVoice.

Referenced by CAMainWin::sourceViewCommit().

Here is the caller graph for this function:

◆ importFunctionMarkContext()

void CAImport::importFunctionMarkContext ( )

References FunctionMarkContext, setImportPart(), and CAFile::setStatus().

Here is the call graph for this function:

◆ importFunctionMarkContextImpl()

virtual CAFunctionMarkContext* CAImport::importFunctionMarkContextImpl ( )
inlineprotectedvirtual

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importLyricsContext()

void CAImport::importLyricsContext ( )

References LyricsContext, setImportPart(), and CAFile::setStatus().

Referenced by CAMainWin::sourceViewCommit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importLyricsContextImpl()

virtual CALyricsContext* CAImport::importLyricsContextImpl ( )
inlineprotectedvirtual

Reimplemented in CALilyPondImport.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importPart()

CAImportPart CAImport::importPart ( )
inlineprivate

References _importPart.

Referenced by run().

Here is the caller graph for this function:

◆ importSheet()

void CAImport::importSheet ( )

References setImportPart(), CAFile::setStatus(), and Sheet.

Here is the call graph for this function:

◆ importSheetImpl()

virtual CASheet* CAImport::importSheetImpl ( )
inlineprotectedvirtual

Reimplemented in CAMidiImport, and CALilyPondImport.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importStaff()

void CAImport::importStaff ( )

References setImportPart(), CAFile::setStatus(), and Staff.

Here is the call graph for this function:

◆ importStaffImpl()

virtual CAStaff* CAImport::importStaffImpl ( )
inlineprotectedvirtual

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importVoice()

void CAImport::importVoice ( )

References setImportPart(), CAFile::setStatus(), and Voice.

Referenced by CAMainWin::sourceViewCommit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importVoiceImpl()

virtual CAVoice* CAImport::importVoiceImpl ( )
inlineprotectedvirtual

Reimplemented in CALilyPondImport.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ in()

QTextStream& CAImport::in ( )
inlineprotected

References CAFile::stream().

Here is the call graph for this function:

◆ lyricsContextImported

void CAImport::lyricsContextImported ( CALyricsContext )
signal

Referenced by run().

Here is the caller graph for this function:

◆ readableStatus()

const QString CAImport::readableStatus ( )
virtual

Implements CAFile.

Reimplemented in CAMusicXmlImport, CAMidiImport, and CALilyPondImport.

References CAFile::status().

Referenced by CAMusicXmlImport::readableStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

void CAImport::run ( )
private

◆ setImportedDocument()

void CAImport::setImportedDocument ( CADocument doc)
inlineprivate

References _importedDocument.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

◆ setImportedFunctionMarkContext()

void CAImport::setImportedFunctionMarkContext ( CAFunctionMarkContext fmc)
inlineprivate

References _importedFunctionMarkContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

◆ setImportedLyricsContext()

void CAImport::setImportedLyricsContext ( CALyricsContext lc)
inlineprivate

References _importedLyricsContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

◆ setImportedSheet()

void CAImport::setImportedSheet ( CASheet sheet)
inlineprivate

References _importedSheet.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

◆ setImportedStaff()

void CAImport::setImportedStaff ( CAStaff staff)
inlineprivate

References _importedStaff.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

◆ setImportedVoice()

void CAImport::setImportedVoice ( CAVoice voice)
inlineprivate

References _importedVoice.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

◆ setImportPart()

void CAImport::setImportPart ( CAImportPart  part)
inlineprivate

References _importPart.

Referenced by CAImport(), importDocument(), importFunctionMarkContext(), importLyricsContext(), importSheet(), importStaff(), and importVoice().

Here is the caller graph for this function:

◆ setStreamFromFile()

void CAImport::setStreamFromFile ( const QString  filename)

Extends CAFile::setStreamFromFile by storing the filename in a public variable for use in the pmidi midi file parser.

References _fileName, and CAFile::setStreamFromFile().

Referenced by CAMXLImport::importDocumentImpl(), CAMXLImport::openContainer(), CAMainWin::openDocument(), and CAAutoRecovery::openRecovery().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sheetImported

void CAImport::sheetImported ( CASheet )
signal

Referenced by run().

Here is the caller graph for this function:

◆ staffImported

void CAImport::staffImported ( CAStaff )
signal

Referenced by run().

Here is the caller graph for this function:

◆ voiceImported

void CAImport::voiceImported ( CAVoice )
signal

Referenced by run().

Here is the caller graph for this function:

Member Data Documentation

◆ _fileName

QString CAImport::_fileName
protected

◆ _importedDocument

CADocument* CAImport::_importedDocument
private

◆ _importedFunctionMarkContext

CAFunctionMarkContext* CAImport::_importedFunctionMarkContext
private

◆ _importedLyricsContext

CALyricsContext* CAImport::_importedLyricsContext
private

◆ _importedSheet

CASheet* CAImport::_importedSheet
private

Referenced by importedSheet(), and setImportedSheet().

◆ _importedStaff

CAStaff* CAImport::_importedStaff
private

Referenced by importedStaff(), and setImportedStaff().

◆ _importedVoice

CAVoice* CAImport::_importedVoice
private

Referenced by importedVoice(), and setImportedVoice().

◆ _importPart

CAImportPart CAImport::_importPart
private

Referenced by importPart(), and setImportPart().


The documentation for this class was generated from the following files:
CAImport::importVoice
void importVoice()
Definition: import.cpp:178
CACanorus::rebuildUI
static void rebuildUI(CADocument *document, CASheet *sheet)
Definition: canorus.cpp:326
CALilyPondImport
Definition: lilypondimport.h:29
CAImport::importedDocument
CADocument * importedDocument()
Definition: import.h:40