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 <gsf/gsf-input.h>
00037 #include <gsf/gsf-output.h>
00038
00040 namespace gcu {
00041
00042 class Document;
00043 class Loader;
00044
00050 typedef struct {
00054 Loader *loader;
00058 bool read;
00062 bool write;
00066 bool supports2D;
00070 bool supports3D;
00074 bool supportsCrystals;
00078 bool supportsSpectra;
00079 } LoaderStruct;
00080
00146 class Loader
00147 {
00148 public:
00153 Loader ();
00158 virtual ~Loader ();
00159
00160
00165 static void Init ();
00174 static bool GetFirstLoader (std::map<std::string, LoaderStruct>::iterator &it);
00181 static bool GetNextLoader (std::map<std::string, LoaderStruct>::iterator &it);
00186 static Loader *GetLoader (char const *mime_type);
00191 static Loader *GetSaver (char const *mime_type);
00192
00193
00205 virtual bool Read (Document *doc, GsfInput *in, char const *mime_type, IOContext *io);
00217 virtual bool Write (Document *doc, GsfOutput *out, char const *mime_type, IOContext *io);
00218
00219 protected:
00225 void AddMimeType (const char *mime_type);
00231 void RemoveMimeType (const char *mime_type);
00232
00233 private:
00234 static bool Inited;
00235
00236 protected:
00240 std::list<std::string> MimeTypes;
00241 };
00242
00243 }
00244
00245 #endif // GCU_LOADER_H