00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OB_FORMAT_H
00020 #define OB_FORMAT_H
00021 #include <openbabel/babelconfig.h>
00022 #include <openbabel/plugin.h>
00023
00024 namespace OpenBabel
00025 {
00026 class OBBase;
00027 class OBConversion;
00028
00030 #define NOTREADABLE 0x01
00031 #define READONEONLY 0x02
00032 #define READBINARY 0x04
00033 #define ZEROATOMSOK 0x08
00034 #define NOTWRITABLE 0x10
00035 #define WRITEONEONLY 0x20
00036 #define WRITEBINARY 0x40
00037 #define READXML 0x80
00038 #define DEFAULTFORMAT 0x4000
00039
00041
00042 class OBCONV OBFormat : public OBPlugin
00043 {
00044
00045 MAKE_PLUGIN(OBFormat);
00046
00047 public:
00048
00050 OBFormat(){}
00051
00052 const char* TypeID(){ return "formats"; }
00053
00055
00059 virtual bool ReadMolecule(OBBase* , OBConversion* )
00060 { std::cerr << "Not a valid input format"; return false;}
00061
00063
00067 virtual bool ReadChemObject(OBConversion* )
00068 { std::cerr << "Not a valid input format"; return false;}
00069
00071
00076 virtual bool WriteMolecule(OBBase* , OBConversion* )
00077 { std::cerr << "Not a valid output format"; return false;}
00078
00080
00084 virtual bool WriteChemObject(OBConversion* )
00085 { std::cerr << "Not a valid output format"; return false;}
00086
00088
00092 virtual const char* Description()=0;
00093
00095
00097 virtual const char* TargetClassDescription();
00098
00100
00103 virtual const std::type_info& GetType();
00104
00106 virtual const char* SpecificationURL() { return ""; }
00107
00109 const char* GetMIMEType() { return pMime; }
00110
00112
00116 virtual unsigned int Flags() { return 0;};
00117
00119
00121 virtual int SkipObjects(int , OBConversion* )
00122 {
00123 return 0;
00124 };
00125
00127
00131 virtual OBFormat* MakeNewInstance()
00132 {
00133 return NULL;
00134 }
00135
00136
00137
00138 int RegisterFormat(const char* ID, const char* MIME = NULL);
00139
00144 virtual bool Display(std::string& txt, const char* param, const char* ID=NULL);
00145
00146 static OBFormat* FormatFromMIME(const char* MIME);
00147
00148 private:
00149 static PluginMapType &FormatsMIMEMap()
00150 {
00151 static PluginMapType m;
00152 return m;
00153 }
00154
00155 const char* pMime;
00156
00157
00158
00160
00161
00162
00164
00165
00166 };
00167
00168 }
00169 #endif
00170