Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Signals | Public Member Functions | Protected Member Functions | 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 ()
 
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)
 

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)
 

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

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

Constructor & Destructor Documentation

CAImport::CAImport ( QTextStream *  stream = 0)
CAImport::CAImport ( const QString  stream)
CAImport::~CAImport ( )
virtual

References CAFile::stream().

Here is the call graph for this function:

Member Function Documentation

void CAImport::documentImported ( CADocument )
signal

Referenced by run().

Here is the caller graph for this function:

void CAImport::functionMarkContextImported ( CAFunctionMarkContext )
signal

Referenced by run().

Here is the caller graph for this function:

void CAImport::importDocument ( )

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

virtual CADocument* CAImport::importDocumentImpl ( )
inlineprotectedvirtual

Reimplemented in CACanorusMLImport, CAMidiImport, CAMusicXmlImport, and CACanImport.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAImport::importDone ( int  status)
signal

Referenced by run().

Here is the caller graph for this function:

CADocument* CAImport::importedDocument ( )
inline
CAFunctionMarkContext* CAImport::importedFunctionMarkContext ( )
inline
CALyricsContext* CAImport::importedLyricsContext ( )
inline

References _importedLyricsContext.

Referenced by CAMainWin::sourceViewPortCommit().

Here is the caller graph for this function:

CASheet* CAImport::importedSheet ( )
inline

References _importedSheet.

CAStaff* CAImport::importedStaff ( )
inline

References _importedStaff.

CAVoice* CAImport::importedVoice ( )
inline

References _importedVoice.

Referenced by CAMainWin::sourceViewPortCommit().

Here is the caller graph for this function:

void CAImport::importFunctionMarkContext ( )

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

Here is the call graph for this function:

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:

void CAImport::importLyricsContext ( )

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

Referenced by CAMainWin::sourceViewPortCommit().

Here is the call graph for this function:

Here is the caller graph for this function:

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:

CAImportPart CAImport::importPart ( )
inlineprivate

References _importPart.

Referenced by run().

Here is the caller graph for this function:

void CAImport::importSheet ( )

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

Here is the call graph for this function:

virtual CASheet* CAImport::importSheetImpl ( )
inlineprotectedvirtual

Reimplemented in CAMidiImport.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAImport::importStaff ( )

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

Here is the call graph for this function:

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:

void CAImport::importVoice ( )

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

Referenced by CAMainWin::sourceViewPortCommit().

Here is the call graph for this function:

Here is the caller graph for this function:

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:

QTextStream& CAImport::in ( )
inlineprotected

References CAFile::stream().

Here is the call graph for this function:

void CAImport::lyricsContextImported ( CALyricsContext )
signal

Referenced by run().

Here is the caller graph for this function:

const QString CAImport::readableStatus ( )
virtual

Implements CAFile.

Reimplemented in CAMidiImport, CALilyPondImport, and CAMusicXmlImport.

References CAFile::status().

Referenced by CAMainWin::openDocument(), and CAMusicXmlImport::readableStatus().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAImport::run ( )
private
void CAImport::setImportedDocument ( CADocument doc)
inlineprivate

References _importedDocument.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedFunctionMarkContext ( CAFunctionMarkContext fmc)
inlineprivate

References _importedFunctionMarkContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedLyricsContext ( CALyricsContext lc)
inlineprivate

References _importedLyricsContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedSheet ( CASheet sheet)
inlineprivate

References _importedSheet.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedStaff ( CAStaff staff)
inlineprivate

References _importedStaff.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedVoice ( CAVoice voice)
inlineprivate

References _importedVoice.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

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:

void CAImport::sheetImported ( CASheet )
signal

Referenced by run().

Here is the caller graph for this function:

void CAImport::staffImported ( CAStaff )
signal

Referenced by run().

Here is the caller graph for this function:

void CAImport::voiceImported ( CAVoice )
signal

Referenced by run().

Here is the caller graph for this function:

Member Data Documentation

CADocument* CAImport::_importedDocument
private
CAFunctionMarkContext* CAImport::_importedFunctionMarkContext
private
CALyricsContext* CAImport::_importedLyricsContext
private
CASheet* CAImport::_importedSheet
private

Referenced by importedSheet(), and setImportedSheet().

CAStaff* CAImport::_importedStaff
private

Referenced by importedStaff(), and setImportedStaff().

CAVoice* CAImport::_importedVoice
private

Referenced by importedVoice(), and setImportedVoice().

CAImportPart CAImport::_importPart
private

Referenced by importPart(), and setImportPart().


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