00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
#ifndef SSK_KIMGIOFACTORY_H
00011
#define SSK_KIMGIOFACTORY_H
00012
00013
#include "ksycocafactory.h"
00014
#include "kimageio.h"
00015
00016
class KImageIOFormat;
00017
class KImageIOFormatList;
00018
00020
class KImageIOFormat :
public KSycocaEntry
00021 {
00022 K_SYCOCATYPE( KST_KImageIOFormat,
KSycocaEntry )
00023
00024 public:
00025 typedef
KSharedPtr<KImageIOFormat> Ptr;
00026 typedef
QValueList<Ptr> List;
00027 public:
00031 KImageIOFormat( const
QString & path);
00032
00036 KImageIOFormat(
QDataStream& _str,
int offset);
00037
00038 virtual ~KImageIOFormat();
00039
00040 virtual
QString name()
const {
return mType; }
00041
00042
virtual bool isValid()
const {
return true; }
00043
00048
virtual void load(
QDataStream& );
00049
00054
virtual void save(
QDataStream& );
00055
00060
void callLibFunc(
bool read,
QImageIO *);
00061
00062
public:
00063
QString mType;
00064
QString mHeader;
00065
QString mFlags;
00066
bool bRead;
00067
bool bWrite;
00068
QStringList mSuffices;
00069
QString mPattern;
00070
QString mMimetype;
00071
QString mLib;
00072
QStringList rPaths;
00073
bool bLibLoaded;
00074 void (*mReadFunc)(
QImageIO *);
00075 void (*mWriteFunc)(
QImageIO *);
00076
protected:
00077
virtual void virtual_hook(
int id,
void* data );
00078 };
00079
00081
class KImageIOFormatList :
public KImageIOFormat::List
00082 {
00083
public:
00084 KImageIOFormatList() { }
00085 };
00086
00087
00089
class KImageIOFactory :
public KSycocaFactory
00090 {
00091
friend class KImageIO;
00092 K_SYCOCAFACTORY( KST_KImageIO )
00093 public:
00094 static KImageIOFactory *self()
00095 {
if (!_self)
new KImageIOFactory();
return _self; }
00096 KImageIOFactory();
00097
virtual ~KImageIOFactory();
00098
00099
protected:
00105
void load();
00106
00110
QString createPattern( KImageIO::Mode _mode);
00111
00115
virtual KSycocaEntry *createEntry(
const QString &,
const char *)
00116 {
return 0; }
00117
00121
virtual KSycocaEntry *createEntry(
int offset);
00122
00126
static void readImage(
QImageIO *iio);
00127
00131
static void writeImage(
QImageIO *iio);
00132
00133
protected:
00134
static KImageIOFactory *_self;
00135
static KImageIOFormatList *formatList;
00136
QString mReadPattern;
00137
QString mWritePattern;
00138
QStringList rPath;
00139
protected:
00140
virtual void virtual_hook(
int id,
void* data );
00141 };
00142
00143
#endif
00144