loader.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * gcu/loader.h
00006  *
00007  * Copyright (C) 2007 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef GCU_LOADER_H
00026 #define GCU_LOADER_H
00027 
00028 #include <list>
00029 #include <map>
00030 #include <string>
00031 #include <goffice/app/io-context.h>
00032 #include <gsf/gsf-input.h>
00033 #include <gsf/gsf-output.h>
00034 
00035 namespace gcu {
00036 
00037 class Document;
00038 class Loader;
00039 
00040 typedef struct {
00041         Loader *loader;
00042         bool read;
00043         bool write;
00044         bool supports2D;
00045         bool supports3D;
00046         bool supportsCrystals;
00047 } LoaderStruct;
00048 
00049 class Loader
00050 {
00051 public:
00052         Loader ();
00053         virtual ~Loader ();
00054 
00055         // static methods
00056         static void Init ();
00057         static bool GetFirstLoader (std::map<std::string, LoaderStruct>::iterator &it);
00058         static bool GetNextLoader (std::map<std::string, LoaderStruct>::iterator &it);
00059         static Loader *GetLoader (char const *mime_type);
00060         static Loader *GetSaver (char const *mime_type);
00061 
00062         // virtual methods
00063         virtual bool Read (Document *doc, GsfInput *in, char const *mime_type, IOContext *io);
00064         virtual bool Write (Document *doc, GsfOutput *out, char const *mime_type, IOContext *io);
00065 
00066 protected:
00067         void AddMimeType (const char *mime_type);
00068         void RemoveMimeType (const char *mime_type);
00069 
00070 private:
00071         static bool Inited;
00072 
00073 protected:
00074         std::list<std::string> MimeTypes;
00075 };
00076 
00077 }
00078 
00079 #endif  //      GCU_LOADER_H

Generated on Sun Jun 22 13:26:05 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6