loader.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * gcu/loader.h
00006  *
00007  * Copyright (C) 2007-2009 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 "structs.h"
00029 #include <list>
00030 #include <map>
00031 #include <string>
00032 #include <goffice/goffice.h>
00033 #include <gsf/gsf-input.h>
00034 #include <gsf/gsf-output.h>
00035 
00037 namespace gcu {
00038 
00039 class Document;
00040 class Loader;
00041 class Object;
00042 
00048 typedef struct {
00052         Loader *loader;
00056         bool read;
00060         bool write;
00064         bool supports2D;
00068         bool supports3D;
00072         bool supportsCrystals;
00076         bool supportsSpectra;
00077 } LoaderStruct;
00078 
00144 class Loader
00145 {
00146 public:
00151         Loader ();
00156         virtual ~Loader ();
00157 
00158         // static methods
00163         static void Init ();
00172         static bool GetFirstLoader (std::map<std::string, LoaderStruct>::iterator &it);
00179         static bool GetNextLoader (std::map<std::string, LoaderStruct>::iterator &it);
00184         static Loader *GetLoader (char const *mime_type);
00189         static Loader *GetSaver (char const *mime_type);
00190 
00191         // virtual methods
00203         virtual ContentType Read (Document *doc, GsfInput *in, char const *mime_type, GOIOContext *io);
00216         virtual bool Write (Object *obj, GsfOutput *out, char const *mime_type, GOIOContext *io, ContentType type = ContentTypeMisc);
00217 
00218 protected:
00224         void AddMimeType (const char *mime_type);
00230         void RemoveMimeType (const char *mime_type);
00231 
00232 private:
00233         static bool Inited;
00234 
00235 protected:
00239         std::list<std::string> MimeTypes;
00240 };
00241 
00242 }
00243 
00244 #endif  //      GCU_LOADER_H

Generated on Fri Sep 24 15:58:41 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9