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 <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         // static methods
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         // virtual methods
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

Generated on Mon Aug 31 20:43:14 2009 for The Gnome Chemistry Utils by  doxygen 1.6.1