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 
00032 namespace gcu {
00033 
00034 class Document;
00035 class Loader;
00036 
00037 typedef struct {
00038         Loader *loader;
00039         bool read;
00040         bool write;
00041         bool supports2D;
00042         bool supports3D;
00043         bool supportsCrystals;
00044 } LoaderStruct;
00045 
00046 class Loader
00047 {
00048 public:
00049         Loader ();
00050         virtual ~Loader ();
00051 
00052         // static methods
00053         static void Init ();
00054         static bool GetFirstLoader (std::map<std::string, LoaderStruct>::iterator &it);
00055         static bool GetNextLoader (std::map<std::string, LoaderStruct>::iterator &it);
00056         static Loader *GetLoader (char const *mime_type);
00057 
00058         // virtual methods
00059         virtual bool Read (Document *doc, std::string &uri, char const *mime_type);
00060         virtual bool Write (Document *doc, std::string &uri, char const *mime_type);
00061 
00062 protected:
00063         void AddMimeType (const char *mime_type);
00064         void RemoveMimeType (const char *mime_type);
00065 
00066 private:
00067         static bool Inited;
00068 
00069 protected:
00070         std::list<std::string> MimeTypes;
00071 };
00072 
00073 }
00074 
00075 #endif  //      GCU_LOADER_H

Generated on Thu Dec 20 11:20:45 2007 for The Gnome Chemistry Utils by  doxygen 1.5.4