kimageiofactory.h
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
00019 class KImageIOFormat : public KSycocaEntry
00020 {
00021 K_SYCOCATYPE( KST_KImageIOFormat, KSycocaEntry )
00022
00023 public:
00024 typedef KSharedPtr<KImageIOFormat> Ptr;
00025 typedef QValueList<Ptr> List;
00026 public:
00030 KImageIOFormat( const QString & path);
00031
00035 KImageIOFormat( QDataStream& _str, int offset);
00036
00037 virtual ~KImageIOFormat();
00038
00039 virtual QString name() const { return mType; }
00040
00041 virtual bool isValid() const { return true; }
00042
00047 virtual void load(QDataStream& );
00048
00053 virtual void save(QDataStream& );
00054
00059 void callLibFunc( bool read, QImageIO *);
00060
00061 public:
00062 QString mType;
00063 QString mHeader;
00064 QString mFlags;
00065 bool bRead;
00066 bool bWrite;
00067 QStringList mSuffices;
00068 QString mPattern;
00069 QString mMimetype;
00070 QString mLib;
00071 QStringList rPaths;
00072 bool bLibLoaded;
00073 void (*mReadFunc)(QImageIO *);
00074 void (*mWriteFunc)(QImageIO *);
00075 protected:
00076 virtual void virtual_hook( int id, void* data );
00077 };
00078
00079 class KImageIOFormatList : public KImageIOFormat::List
00080 {
00081 public:
00082 KImageIOFormatList() { }
00083 };
00084
00085
00086 class KImageIOFactory : public KSycocaFactory
00087 {
00088 friend class KImageIO;
00089 K_SYCOCAFACTORY( KST_KImageIO )
00090 public:
00091 static KImageIOFactory *self()
00092 { if (!_self) new KImageIOFactory(); return _self; }
00093 KImageIOFactory();
00094 virtual ~KImageIOFactory();
00095
00096 protected:
00102 void load();
00103
00107 QString createPattern( KImageIO::Mode _mode);
00108
00112 virtual KSycocaEntry *createEntry(const QString &, const char *)
00113 { return 0; }
00114
00118 virtual KSycocaEntry *createEntry(int offset);
00119
00123 static void readImage( QImageIO *iio);
00124
00128 static void writeImage( QImageIO *iio);
00129
00130 protected:
00131 static KImageIOFactory *_self;
00132 static KImageIOFormatList *formatList;
00133 QString mReadPattern;
00134 QString mWritePattern;
00135 QStringList rPath;
00136 protected:
00137 virtual void virtual_hook( int id, void* data );
00138 };
00139
00140 #endif
00141
This file is part of the documentation for kdelibs Version 3.1.0.