loader.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCU_LOADER_H
00026 #define GCU_LOADER_H
00027
00028 #include <list>
00029 #include <map>
00030 #include <string>
00031 #ifdef GOFFICE_HAS_GLOBAL_HEADER
00032 # include <goffice/goffice.h>
00033 #else
00034 # include <goffice/app/io-context.h>
00035 #endif
00036 #include <gcu/goffice-compat.h>
00037 #include <gsf/gsf-input.h>
00038 #include <gsf/gsf-output.h>
00039
00041 namespace gcu {
00042
00043 class Document;
00044 class Loader;
00045
00051 typedef struct {
00055 Loader *loader;
00059 bool read;
00063 bool write;
00067 bool supports2D;
00071 bool supports3D;
00075 bool supportsCrystals;
00079 bool supportsSpectra;
00080 } LoaderStruct;
00081
00147 class Loader
00148 {
00149 public:
00154 Loader ();
00159 virtual ~Loader ();
00160
00161
00166 static void Init ();
00175 static bool GetFirstLoader (std::map<std::string, LoaderStruct>::iterator &it);
00182 static bool GetNextLoader (std::map<std::string, LoaderStruct>::iterator &it);
00187 static Loader *GetLoader (char const *mime_type);
00192 static Loader *GetSaver (char const *mime_type);
00193
00194
00206 virtual bool Read (Document *doc, GsfInput *in, char const *mime_type, IOContext *io);
00218 virtual bool Write (Document *doc, GsfOutput *out, char const *mime_type, IOContext *io);
00219
00220 protected:
00226 void AddMimeType (const char *mime_type);
00232 void RemoveMimeType (const char *mime_type);
00233
00234 private:
00235 static bool Inited;
00236
00237 protected:
00241 std::list<std::string> MimeTypes;
00242 };
00243
00244 }
00245
00246 #endif // GCU_LOADER_H