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

Protected Member Functions

virtual CADocumentimportDocumentImpl ()
virtual CASheetimportSheetImpl ()
virtual CAStaffimportStaffImpl ()
virtual CAVoiceimportVoiceImpl ()
virtual CALyricsContextimportLyricsContextImpl ()
virtual CAFunctionMarkContextimportFunctionMarkContextImpl ()
QTextStream & in ()

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

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:

Referenced by run().

Here is the caller graph for this function:

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

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:

References _importedLyricsContext.

Referenced by CAMainWin::sourceViewPortCommit().

Here is the caller graph for this function:

References _importedSheet.

References _importedStaff.

References _importedVoice.

Referenced by CAMainWin::sourceViewPortCommit().

Here is the caller graph for this function:

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

Here is the call graph for this function:

virtual CAFunctionMarkContext* CAImport::importFunctionMarkContextImpl ( ) [inline, protected, virtual]

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

References _importPart.

Referenced by run().

Here is the caller graph for this function:

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

Here is the call graph for this function:

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

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:

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

Here is the call graph for this function:

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

References CAFile::setStatus().

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Reimplemented in CAMidiImport, and CALilyPondImport.

References CAFile::stream().

Here is the call graph for this function:

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

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

References _importedDocument.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

References _importedFunctionMarkContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

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

References _importedLyricsContext.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

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

References _importedSheet.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

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

References _importedStaff.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

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

References _importedVoice.

Referenced by CAImport(), and run().

Here is the caller graph for this function:

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

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

Referenced by importedSheet(), and setImportedSheet().

Referenced by importedStaff(), and setImportedStaff().

Referenced by importedVoice(), and setImportedVoice().

Referenced by importPart(), and setImportPart().


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