00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef CHANNELIOFORMAT_H
00024 #define CHANNELIOFORMAT_H
00025
00026 #include <qcstring.h>
00027 #include <qptrlist.h>
00028 #include <qstring.h>
00029
00030 #include <pluginfactory.h>
00031
00032 class QIODevice;
00033 class KSaveFile;
00034 class ChannelStore;
00035 class QtVision;
00036
00037 class ChannelIOFormatPrivate;
00038 class ChannelFileMetaInfoPrivate;
00039
00040 class ChannelFileMetaInfo {
00041 public:
00042 const QString& name() const { return _name; }
00043 const QString& norm() const { return _norm; }
00044 void setName(QString x) { _name = x; }
00045 void setNorm(QString x) { _norm = x; }
00046
00047 private:
00048 QString _name, _norm;
00049 ChannelFileMetaInfoPrivate *d;
00050 };
00051
00052
00058 class ChannelIOFormat
00059 {
00060 friend class PluginFactory;
00061 public:
00065 enum Flags {
00066 FormatRead = 0x1,
00067 FormatWrite = 0x2,
00068 FormatReadWrite = FormatRead | FormatWrite
00069 };
00070
00071 ChannelIOFormat( const char *name, int flags = FormatReadWrite );
00072 virtual ~ChannelIOFormat() {}
00073
00077 const char *name() const { return fmtName.data(); }
00078
00084 bool canRead( const char *fmt=0 ) const;
00085
00090 bool canWrite( const char *fmt=0 ) const;
00091
00101 virtual bool handlesFile( const QString& filename, int rflags) const;
00102
00107 bool load( ChannelStore *store, const QString &filename, const char *fmt);
00108
00113 bool save( ChannelStore *store, const QString &filename, const char *fmt);
00114
00119 virtual bool load( ChannelStore *store, QIODevice *file, const char *fmt );
00120
00125 virtual bool save( ChannelStore *store, QIODevice *file, const char *fmt );
00126
00130 ChannelFileMetaInfo getMetaInfo( const QString &filename, const char *fmt );
00131 virtual ChannelFileMetaInfo getMetaInfo( QIODevice *file, const char *fmt );
00132
00133 protected:
00134 PluginDesc _description;
00135 ChannelFileMetaInfo metaInfo;
00136 QtVision *_qtv;
00137
00138 private:
00139 QCString fmtName;
00140 int flags;
00141 ChannelIOFormatPrivate *d;
00142 };
00143
00144 typedef QPtrList<ChannelIOFormat> ChannelIOFormatList;
00145
00146
00147 #endif // CHANNELIOFORMAT_H