Open Babel: format.h Source File

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# format.h

Go to the documentation of this file.

    00001 /**********************************************************************
    00002 obconversion.cpp -  Declarations for OBFormat
    00003
    00004 Copyright (C) 2004-2007 by Chris Morley
    00005 Some portions Copyright (C) 2005-2007 by Geoffrey Hutchison
    00006
    00007 This file is part of the Open Babel project.
    00008 For more information, see <http://openbabel.org/>
    00009
    00010 This program is free software; you can redistribute it and/or modify
    00011 it under the terms of the GNU General Public License as published by
    00012 the Free Software Foundation version 2 of the License.
    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 #ifndef OB_FORMAT_H
    00020 #define OB_FORMAT_H
    00021 #include <openbabel/babelconfig.h>
    00022 #include <openbabel/plugin.h>
    00023 #include <typeinfo>
    00024
    00025 namespace OpenBabel
    00026 {
    00027   class OBBase;
    00028   class OBConversion;
    00029
    00031 #define NOTREADABLE     0x01
    00032 #define READONEONLY     0x02
    00033 #define READBINARY      0x04
    00034 #define ZEROATOMSOK     0x08
    00035 #define NOTWRITABLE     0x10
    00036 #define WRITEONEONLY    0x20
    00037 #define WRITEBINARY     0x40
    00038 #define READXML         0x80
    00039 #define DEFAULTFORMAT   0x4000
    00040
    00042   // class introduction in obconversion.cpp
    00043 class OBCONV OBFormat : public OBPlugin
    00044   {
    00045     //Macro to include functions to handle plugin operations
    00046     MAKE_PLUGIN(OBFormat);
    00047
    00048   public:
    00049
    00051     OBFormat(){}
    00052
    00053     const char* TypeID(){ return "formats"; }
    00054
    00056
    00060     virtual bool ReadMolecule(OBBase* /*pOb*/, OBConversion* /*pConv*/)
    00061       { std::cerr << "HIER" << std::endl;
    00062 std::cerr << "Not a valid input format"; return false;}
    00063
    00065
    00069     virtual bool ReadChemObject(OBConversion* /*pConv*/)
    00070       { std::cerr << "Not a valid input format"; return false;}
    00071
    00073
    00078     virtual bool WriteMolecule(OBBase* /*pOb*/, OBConversion* /*pConv*/)
    00079       { std::cerr << "Not a valid output format"; return false;}
    00080
    00082
    00086     virtual bool WriteChemObject(OBConversion* /*pConv*/)
    00087       { std::cerr << "Not a valid output format"; return false;}
    00088
    00090
    00094     virtual const char* Description()=0;
    00095
    00097
    00099     virtual const char* TargetClassDescription();
    00100
    00102
    00105     virtual const std::type_info& GetType();
    00106
    00108     virtual const char* SpecificationURL() { return ""; }
    00109
    00111     virtual const char* GetMIMEType() { return pMime; }
    00112
    00114
    00118     virtual unsigned int Flags() { return 0;};
    00119
    00121
    00123     virtual int SkipObjects(int /*n*/, OBConversion* /*pConv*/)
    00124       {
    00125         return 0; //shows not implemented in the format class
    00126       };
    00127
    00129
    00133     virtual OBFormat* MakeNewInstance()
    00134       {
    00135         return NULL; //shows not implemented in the format class
    00136       }
    00137
    00138     //New functions since OBFormat is derived from OBPlugin
    00139     //\brief Called from, and an alternative to, OBConversion::RegisterFormat();
    00140     int RegisterFormat(const char* ID, const char* MIME = NULL);
    00141
    00146     virtual bool Display(std::string& txt, const char* param, const char* ID=NULL);
    00147
    00148     static OBFormat* FormatFromMIME(const char* MIME);
    00149
    00150 private:
    00151     static PluginMapType &FormatsMIMEMap()
    00152     {
    00153       static PluginMapType m;
    00154       return m;
    00155     }
    00156
    00157     const char* pMime;
    00158
    00159 /* Functions provided by the MAKE_PLUGIN macro
    00160
    00162   Not currently used for formats
    00163   OBFormat(const char* ID, bool IsDefault=false);
    00164
    00166   static OBFormat* FindType(const char* ID);
    00167
    00168 */};
    00169
    00170 }//namespace
    00171 #endif
    00172

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

This file is part of the documentation for Open Babel, version 2.3.

Documentation copyright © 1998-2007, the Open Babel Developers.
Open Babel is hosted by:
Generated on Mon Oct 25 2010 11:55:09 by 1.7.2.