CFileWriter< objtype > Class Template Reference

#include <filewriter.h>

Inheritance diagram for CFileWriter< objtype >:

XmlWriterTempl< objtype >

List of all members.

Public Member Functions

 CFileWriter (const QString &ext, const QString &desc)
virtual const objtype read (const QString &) const
QString readDialog (objtype &dest, const QString &filename="") const
virtual void write (const objtype &, const QString &) const =0
QString writeDialog (const objtype &obj, const QString &filename=QString::null) const
QString getExtension () const
bool isDocument (QString filename) const

Static Public Member Functions

static void readErrorMessage ()
static void writeErrorMessage ()

Protected Attributes

QString _ext
QString _desc


Detailed Description

template<class objtype>
class CFileWriter< objtype >

This is a generic class used as the base for various file input and output modules.

Definition at line 59 of file filewriter.h.


Constructor & Destructor Documentation

template<class objtype>
CFileWriter< objtype >::CFileWriter ( const QString &  ext,
const QString &  desc 
) [inline]

The constructor.

Parameters:
ext the file extension
desc description of the file type

Definition at line 67 of file filewriter.h.


Member Function Documentation

template<class objtype>
virtual const objtype CFileWriter< objtype >::read ( const QString &   )  const [inline, virtual]

Perform the actual reading operation, may be overriden to provide this functionality.

Reimplemented in XmlWriterTempl< objtype >, XmlWriterTempl< CSailDef >, XmlWriterTempl< CPanelGroup >, XmlWriterTempl< CPrefs >, XmlWriterTempl< CHullDef >, XmlWriterTempl< CRigDef >, and XmlWriterTempl< CBoatDef >.

Definition at line 75 of file filewriter.h.

Referenced by CFileWriter< CBoatDef >::readDialog().

template<class objtype>
QString CFileWriter< objtype >::readDialog ( objtype &  dest,
const QString &  filename = "" 
) const [inline]

Display a dialog then read file.

Parameters:
dest the object we read to
filename initial file name

Definition at line 86 of file filewriter.h.

template<class objtype>
static void CFileWriter< objtype >::readErrorMessage (  )  [inline, static]

Show an error message indicating that reading failed.

Definition at line 108 of file filewriter.h.

Referenced by CFileWriter< CBoatDef >::readDialog().

template<class objtype>
virtual void CFileWriter< objtype >::write ( const objtype &  ,
const QString &   
) const [pure virtual]

template<class objtype>
QString CFileWriter< objtype >::writeDialog ( const objtype &  obj,
const QString &  filename = QString::null 
) const [inline]

Opens of a dialog to ask for a filename then writes to a file.

Parameters:
obj The object to write.
filename The filename to start off with (default = "")

Definition at line 125 of file filewriter.h.

template<class objtype>
static void CFileWriter< objtype >::writeErrorMessage (  )  [inline, static]

Show an error message indicating that writing failed.

Definition at line 149 of file filewriter.h.

Referenced by CFileWriter< CBoatDef >::writeDialog().

template<class objtype>
QString CFileWriter< objtype >::getExtension (  )  const [inline]

Return the file extension associated with this CFileWriter.

Definition at line 157 of file filewriter.h.

template<class objtype>
bool CFileWriter< objtype >::isDocument ( QString  filename  )  const [inline]

Returns whether the given file is associated with this CFileWriter.

Definition at line 165 of file filewriter.h.


Member Data Documentation

template<class objtype>
QString CFileWriter< objtype >::_ext [protected]

template<class objtype>
QString CFileWriter< objtype >::_desc [protected]

description of the file type

Definition at line 174 of file filewriter.h.

Referenced by CFileWriter< CBoatDef >::readDialog(), and CFileWriter< CBoatDef >::writeDialog().


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

Generated on Sun Mar 22 21:38:32 2009 for Sailcut CAD by  doxygen 1.5.6