CAImport Class Reference

Base class for import filters. More...

#include <import.h>

Inheritance diagram for CAImport:

Inheritance graph
[legend]

List of all members.

Signals

void documentImported (CADocument *)
void sheetImported (CASheet *)
void staffImported (CAStaff *)
void voiceImported (CAVoice *)
void lyricsContextImported (CALyricsContext *)
void functionMarkingContextImported (CAFunctionMarkingContext *)
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 importFunctionMarkingContext ()
CADocumentimportedDocument ()
CASheetimportedSheet ()
CAStaffimportedStaff ()
CAVoiceimportedVoice ()
CALyricsContextimportedLyricsContext ()
CAFunctionMarkingContextimportedFunctionMarkingContext ()

Protected Member Functions

virtual CADocumentimportDocumentImpl ()
virtual CASheetimportSheetImpl ()
virtual CAStaffimportStaffImpl ()
virtual CAVoiceimportVoiceImpl ()
virtual CALyricsContextimportLyricsContextImpl ()
virtual
CAFunctionMarkingContext
importFunctionMarkingContextImpl ()
QTextStream & in ()

Private Types

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

Private Member Functions

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

Private Attributes

CADocument_importedDocument
CASheet_importedSheet
CAStaff_importedStaff
CAVoice_importedVoice
CALyricsContext_importedLyricsContext
CAFunctionMarkingContext_importedFunctionMarkingContext
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() );
          CACanorus::rebuildUI();

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.

Definition at line 20 of file import.h.


Member Enumeration Documentation

enum CAImport::CAImportPart [private]

Enumerator:
Undefined 
Document 
Sheet 
Staff 
Voice 
LyricsContext 
FunctionMarkingContext 

Definition at line 84 of file import.h.


Constructor & Destructor Documentation

CAImport::CAImport ( QTextStream *  stream = 0  ) 

Definition at line 53 of file import.cpp.

References setImportedDocument(), setImportedFunctionMarkingContext(), setImportedLyricsContext(), setImportedSheet(), setImportedStaff(), setImportedVoice(), setImportPart(), CAFile::setStream(), and Undefined.

Here is the call graph for this function:

CAImport::CAImport ( const QString  stream  ) 

Definition at line 66 of file import.cpp.

References setImportedDocument(), setImportedFunctionMarkingContext(), setImportedLyricsContext(), setImportedSheet(), setImportedStaff(), setImportedVoice(), setImportPart(), CAFile::setStream(), and Undefined.

Here is the call graph for this function:

CAImport::~CAImport (  )  [virtual]

Definition at line 79 of file import.cpp.

References CAFile::stream().

Here is the call graph for this function:


Member Function Documentation

const QString CAImport::readableStatus (  )  [virtual]

Implements CAFile.

Reimplemented in CALilyPondImport.

Definition at line 179 of file import.cpp.

References CAFile::status().

Referenced by CAMainWin::openDocument().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAImport::importDocument (  ) 

Definition at line 143 of file import.cpp.

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:

void CAImport::importSheet (  ) 

Definition at line 149 of file import.cpp.

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

Here is the call graph for this function:

void CAImport::importStaff (  ) 

Definition at line 155 of file import.cpp.

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

Here is the call graph for this function:

void CAImport::importVoice (  ) 

Definition at line 161 of file import.cpp.

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

Referenced by CAMainWin::sourceViewPortCommit().

Here is the call graph for this function:

void CAImport::importLyricsContext (  ) 

Definition at line 167 of file import.cpp.

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

Referenced by CAMainWin::sourceViewPortCommit().

Here is the call graph for this function:

void CAImport::importFunctionMarkingContext (  ) 

Definition at line 173 of file import.cpp.

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

Here is the call graph for this function:

CADocument* CAImport::importedDocument (  )  [inline]

Definition at line 37 of file import.h.

References _importedDocument.

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

Here is the caller graph for this function:

CASheet* CAImport::importedSheet (  )  [inline]

Definition at line 38 of file import.h.

References _importedSheet.

CAStaff* CAImport::importedStaff (  )  [inline]

Definition at line 39 of file import.h.

References _importedStaff.

CAVoice* CAImport::importedVoice (  )  [inline]

Definition at line 40 of file import.h.

References _importedVoice.

Referenced by CAMainWin::sourceViewPortCommit().

CALyricsContext* CAImport::importedLyricsContext (  )  [inline]

Definition at line 41 of file import.h.

References _importedLyricsContext.

Referenced by CAMainWin::sourceViewPortCommit().

CAFunctionMarkingContext* CAImport::importedFunctionMarkingContext (  )  [inline]

Definition at line 42 of file import.h.

References _importedFunctionMarkingContext.

void CAImport::documentImported ( CADocument  )  [signal]

Referenced by run().

void CAImport::sheetImported ( CASheet  )  [signal]

Referenced by run().

void CAImport::staffImported ( CAStaff  )  [signal]

Referenced by run().

void CAImport::voiceImported ( CAVoice  )  [signal]

Referenced by run().

void CAImport::lyricsContextImported ( CALyricsContext  )  [signal]

Referenced by run().

void CAImport::functionMarkingContextImported ( CAFunctionMarkingContext  )  [signal]

Referenced by run().

void CAImport::importDone ( int  status  )  [signal]

Referenced by run().

virtual CADocument* CAImport::importDocumentImpl (  )  [inline, protected, virtual]

Reimplemented in CACanImport, and CACanorusMLImport.

Definition at line 57 of file import.h.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual CASheet* CAImport::importSheetImpl (  )  [inline, protected, virtual]

Definition at line 58 of file import.h.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual CAStaff* CAImport::importStaffImpl (  )  [inline, protected, virtual]

Definition at line 59 of file import.h.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual CAVoice* CAImport::importVoiceImpl (  )  [inline, protected, virtual]

Reimplemented in CALilyPondImport.

Definition at line 60 of file import.h.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual CALyricsContext* CAImport::importLyricsContextImpl (  )  [inline, protected, virtual]

Reimplemented in CALilyPondImport.

Definition at line 61 of file import.h.

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual CAFunctionMarkingContext* CAImport::importFunctionMarkingContextImpl (  )  [inline, protected, virtual]

Definition at line 62 of file import.h.

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 (  )  [inline, protected]

Reimplemented in CALilyPondImport.

Definition at line 64 of file import.h.

References CAFile::stream().

Here is the call graph for this function:

void CAImport::setImportedDocument ( CADocument doc  )  [inline, private]

Definition at line 70 of file import.h.

References _importedDocument.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedSheet ( CASheet sheet  )  [inline, private]

Definition at line 71 of file import.h.

References _importedSheet.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedStaff ( CAStaff staff  )  [inline, private]

Definition at line 72 of file import.h.

References _importedStaff.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedVoice ( CAVoice voice  )  [inline, private]

Definition at line 73 of file import.h.

References _importedVoice.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedLyricsContext ( CALyricsContext lc  )  [inline, private]

Definition at line 74 of file import.h.

References _importedLyricsContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::setImportedFunctionMarkingContext ( CAFunctionMarkingContext fmc  )  [inline, private]

Definition at line 75 of file import.h.

References _importedFunctionMarkingContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

void CAImport::run (  )  [private]

Executed when a new thread is dispatched. It looks which part of the document should be imported and starts the procedure. It emits the appropriate signal when the procedure is finished.

Definition at line 91 of file import.cpp.

References Document, documentImported(), FunctionMarkingContext, functionMarkingContextImported(), importDocumentImpl(), importDone(), importFunctionMarkingContextImpl(), importLyricsContextImpl(), importPart(), importSheetImpl(), importStaffImpl(), importVoiceImpl(), LyricsContext, lyricsContextImported(), setImportedDocument(), setImportedFunctionMarkingContext(), setImportedLyricsContext(), setImportedSheet(), setImportedStaff(), setImportedVoice(), CAFile::setStatus(), Sheet, sheetImported(), Staff, staffImported(), CAFile::status(), CAFile::stream(), Voice, and voiceImported().

Here is the call graph for this function:

void CAImport::setImportPart ( CAImportPart  part  )  [inline, private]

Definition at line 95 of file import.h.

References _importPart.

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

Here is the caller graph for this function:

CAImportPart CAImport::importPart (  )  [inline, private]

Definition at line 96 of file import.h.

References _importPart.

Referenced by run().

Here is the caller graph for this function:


Member Data Documentation

CADocument* CAImport::_importedDocument [private]

Definition at line 77 of file import.h.

Referenced by importedDocument(), and setImportedDocument().

CASheet* CAImport::_importedSheet [private]

Definition at line 78 of file import.h.

Referenced by importedSheet(), and setImportedSheet().

CAStaff* CAImport::_importedStaff [private]

Definition at line 79 of file import.h.

Referenced by importedStaff(), and setImportedStaff().

CAVoice* CAImport::_importedVoice [private]

Definition at line 80 of file import.h.

Referenced by importedVoice(), and setImportedVoice().

CALyricsContext* CAImport::_importedLyricsContext [private]

Definition at line 81 of file import.h.

Referenced by importedLyricsContext(), and setImportedLyricsContext().

CAFunctionMarkingContext* CAImport::_importedFunctionMarkingContext [private]

Definition at line 82 of file import.h.

Referenced by importedFunctionMarkingContext(), and setImportedFunctionMarkingContext().

CAImportPart CAImport::_importPart [private]

Definition at line 98 of file import.h.

Referenced by importPart(), and setImportPart().


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