CAFile Class Reference

File import/export base class. More...

#include <file.h>

Inheritance diagram for CAFile:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 CAFile ()
virtual ~CAFile ()
const int status ()
const int progress ()
virtual const QString readableStatus ()=0
void setStreamFromFile (const QString filename)
void setStreamToFile (const QString filename)
void setStreamFromDevice (QIODevice *device)
void setStreamToDevice (QIODevice *device)

Protected Member Functions

void setStatus (const int status)
void setProgress (const int progress)
QTextStream * stream ()
virtual void setStream (QTextStream *stream)
QFile * file ()
void setFile (QFile *file)

Private Attributes

int _status
int _progress
QTextStream * _stream
QFile * _file
bool _deleteStream


Detailed Description

File import/export base class.

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 brings tools for manipulating with files and streams (most notably import and export). Classes CAImport and CAExport inherit this class and implement specific methods for import and export.

All file operations are done in a separate thread. While the file operations are in progress user can poll the status by calling status(), progress() and readableStatus() for human-readable status defined by the filter. Waiting for the thread to be finished can be implemented by calling QThread::wait() or by catching the signals emitted by children import and export classes.

See also:
CAImport, CAExport

Definition at line 16 of file file.h.


Constructor & Destructor Documentation

CAFile::CAFile (  ) 

Definition at line 27 of file file.cpp.

References _deleteStream, setFile(), setProgress(), setStatus(), and setStream().

Here is the call graph for this function:

CAFile::~CAFile (  )  [virtual]

Destructor. Also destroys the created stream and file, if set.

Definition at line 39 of file file.cpp.

References _deleteStream, file(), and stream().

Here is the call graph for this function:


Member Function Documentation

const int CAFile::status (  )  [inline]

Definition at line 21 of file file.h.

References _status.

Referenced by CAMainWin::openDocument(), CALilyPondImport::readableStatus(), CAImport::readableStatus(), CAExport::readableStatus(), CAImport::run(), and CAExport::run().

Here is the caller graph for this function:

const int CAFile::progress (  )  [inline]

Definition at line 22 of file file.h.

References _progress.

virtual const QString CAFile::readableStatus (  )  [pure virtual]

Implemented in CAExport, CAImport, and CALilyPondImport.

void CAFile::setStreamFromFile ( const QString  filename  ) 

Creates and sets the stream from the file named filename. Stream is Read-only. This method is usually called from the main window when opening a document. This method is also very important for python developers as they cannot directly access QTextStream class, so they call this wrapper instead with a simple string as parameter.

Definition at line 53 of file file.cpp.

References _deleteStream, file(), setFile(), setStream(), and stream().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CAFile::setStreamToFile ( const QString  filename  ) 

Creates and sets the stream from the file named filename. Stream is Read-Write. This method is usually called from the main window when saving the document. This method is also very important for python developers as they cannot directly access QTextStream class, so they call this wrapper instead with a simple string as parameter.

Definition at line 73 of file file.cpp.

References _deleteStream, file(), setFile(), setStream(), and stream().

Referenced by CAMainWin::on_uiExportDocument_triggered(), CAMainWin::saveDocument(), and CAAutoRecovery::saveRecovery().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAFile::setStreamFromDevice ( QIODevice *  device  ) 

Creates and sets the stream from the given device. Read-only if the device is not already open.

Definition at line 105 of file file.cpp.

References _deleteStream, setStream(), and stream().

Here is the call graph for this function:

void CAFile::setStreamToDevice ( QIODevice *  device  ) 

Creates and sets the stream from the given device. Read-write if the given device is not already open.

Definition at line 91 of file file.cpp.

References _deleteStream, setStream(), and stream().

Referenced by CACanExport::exportDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAFile::setStatus ( const int  status  )  [inline, protected]

Definition at line 30 of file file.h.

References _status.

Referenced by CAFile(), CAExport::exportDocument(), CAExport::exportDocumentImpl(), CACanExport::exportDocumentImpl(), CAExport::exportFunctionMarkingContext(), CAExport::exportFunctionMarkingContextImpl(), CAExport::exportLyricsContext(), CAExport::exportLyricsContextImpl(), CAExport::exportSheet(), CAExport::exportSheetImpl(), CAExport::exportStaff(), CAExport::exportStaffImpl(), CAExport::exportVoice(), CAExport::exportVoiceImpl(), CAImport::importDocument(), CAImport::importDocumentImpl(), CACanImport::importDocumentImpl(), CAImport::importFunctionMarkingContext(), CAImport::importFunctionMarkingContextImpl(), CAImport::importLyricsContext(), CAImport::importLyricsContextImpl(), CAImport::importSheet(), CAImport::importSheetImpl(), CAImport::importStaff(), CAImport::importStaffImpl(), CAImport::importVoice(), CAImport::importVoiceImpl(), CAImport::run(), and CAExport::run().

Here is the caller graph for this function:

void CAFile::setProgress ( const int  progress  )  [inline, protected]

Definition at line 31 of file file.h.

References _progress.

Referenced by CAFile(), and CACanorusMLExport::exportDocumentImpl().

Here is the caller graph for this function:

QTextStream* CAFile::stream (  )  [inline, protected]

Definition at line 33 of file file.h.

References _stream.

Referenced by CAMidiExport::exportDocumentImpl(), CACanExport::exportDocumentImpl(), CACanorusMLImport::importDocumentImpl(), CACanImport::importDocumentImpl(), CALilyPondImport::in(), CAImport::in(), CAExport::out(), CAImport::run(), CAExport::run(), setStreamFromDevice(), setStreamFromFile(), setStreamToDevice(), setStreamToFile(), ~CAFile(), and CAImport::~CAImport().

Here is the caller graph for this function:

virtual void CAFile::setStream ( QTextStream *  stream  )  [inline, protected, virtual]

Definition at line 34 of file file.h.

References _stream.

Referenced by CAExport::CAExport(), CAFile(), CAImport::CAImport(), setStreamFromDevice(), setStreamFromFile(), setStreamToDevice(), and setStreamToFile().

Here is the caller graph for this function:

QFile* CAFile::file (  )  [inline, protected]

Definition at line 36 of file file.h.

References _file.

Referenced by CACanImport::importDocumentImpl(), setStreamFromFile(), setStreamToFile(), and ~CAFile().

Here is the caller graph for this function:

void CAFile::setFile ( QFile *  file  )  [inline, protected]

Definition at line 37 of file file.h.

References _file.

Referenced by CAFile(), setStreamFromFile(), and setStreamToFile().

Here is the caller graph for this function:


Member Data Documentation

int CAFile::_status [private]

Definition at line 40 of file file.h.

Referenced by setStatus(), and status().

int CAFile::_progress [private]

Definition at line 41 of file file.h.

Referenced by progress(), and setProgress().

QTextStream* CAFile::_stream [private]

Definition at line 42 of file file.h.

Referenced by setStream(), and stream().

QFile* CAFile::_file [private]

Definition at line 43 of file file.h.

Referenced by file(), and setFile().

bool CAFile::_deleteStream [private]

Definition at line 44 of file file.h.

Referenced by CAFile(), setStreamFromDevice(), setStreamFromFile(), setStreamToDevice(), setStreamToFile(), and ~CAFile().


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