Open Babel  3.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
XMLBaseFormat Class Referenceabstract

#include <openbabel/xml.h>

Inheritance diagram for XMLBaseFormat:
OBFormat OBPlugin XMLMoleculeFormat

Public Types

typedef std::map< const char *, OBPlugin *, CharPtrLessPluginMapType
 
typedef PluginMapType::const_iterator PluginIterator
 

Public Member Functions

 ~XMLBaseFormat ()
 
virtual const char * NamespaceURI () const =0
 
virtual bool DoElement (const std::string &ElName)
 
virtual bool EndElement (const std::string &ElName)
 
virtual const char * EndTag ()
 
const char * TypeID ()
 
virtual bool ReadMolecule (OBBase *, OBConversion *)
 
virtual bool ReadChemObject (OBConversion *)
 
virtual bool WriteMolecule (OBBase *, OBConversion *)
 
virtual bool WriteChemObject (OBConversion *)
 
virtual const char * Description ()=0
 
virtual const char * TargetClassDescription ()
 
virtual const std::type_info & GetType ()
 
virtual const char * SpecificationURL ()
 
virtual const char * GetMIMEType ()
 
virtual unsigned int Flags ()
 
virtual OBFormatMakeNewInstance ()
 
int RegisterFormat (const char *ID, const char *MIME=NULL)
 
virtual bool Display (std::string &txt, const char *param, const char *ID=NULL)
 
virtual OBPluginMakeInstance (const std::vector< std::string > &)
 
virtual void Init ()
 
const char * GetID () const
 
virtual PluginMapTypeGetMap () const =0
 

Static Public Member Functions

static OBFormatFormatFromMIME (const char *MIME)
 
static OBPluginGetPlugin (const char *Type, const char *ID)
 
static bool ListAsVector (const char *PluginID, const char *param, std::vector< std::string > &vlist)
 
static void List (const char *PluginID, const char *param=NULL, std::ostream *os=&std::cout)
 
static std::string ListAsString (const char *PluginID, const char *param=NULL)
 
static std::string FirstLine (const char *txt)
 
static PluginIterator Begin (const char *PluginID)
 
static PluginIterator End (const char *PluginID)
 
static void LoadAllPlugins ()
 

Protected Member Functions

xmlTextReaderPtr reader () const
 
xmlTextWriterPtr writer () const
 
void OutputToStream ()
 
virtual int SkipObjects (int n, OBConversion *pConv)
 

Static Protected Member Functions

static PluginMapTypePluginMap ()
 
static PluginMapTypeGetTypeMap (const char *PluginID)
 
static OBPluginBaseFindType (PluginMapType &Map, const char *ID)
 

Protected Attributes

XMLConversion_pxmlConv
 
std::string _prefix
 
int baseindent
 
int ind
 
std::string nsdecl
 
int _embedlevel
 
const char * _id
 

Static Protected Attributes

static int AllPluginsLoaded = 0
 

Detailed Description

Abstract class containing common functionality for XML formats.

Constructor & Destructor Documentation

◆ ~XMLBaseFormat()

~XMLBaseFormat ( )
inline

Member Function Documentation

◆ NamespaceURI()

virtual const char* NamespaceURI ( ) const
pure virtual

◆ DoElement()

virtual bool DoElement ( const std::string &  ElName)
inlinevirtual

◆ EndElement()

virtual bool EndElement ( const std::string &  ElName)
inlinevirtual

◆ EndTag()

virtual const char* EndTag ( )
inlinevirtual

The tag at the end of the chemical object e.g. "/molecule>".

◆ reader()

xmlTextReaderPtr reader ( ) const
inlineprotected

◆ writer()

xmlTextWriterPtr writer ( ) const
inlineprotected

◆ OutputToStream()

void OutputToStream ( )
inlineprotected

◆ SkipObjects()

virtual int SkipObjects ( int  n,
OBConversion pConv 
)
inlineprotectedvirtual

Skip past first n objects in input stream (or current one with n=0) Returns 1 on success, -1 on error and 0 if not implemented

Reimplemented from OBFormat.

◆ TypeID()

const char* TypeID ( )
inlinevirtualinherited

Redefined by each plugin type: "formats", "fingerprints", etc.

Reimplemented from OBPlugin.

◆ ReadMolecule()

virtual bool ReadMolecule ( OBBase ,
OBConversion  
)
inlinevirtualinherited

The "API" interface Read function.

Reads a single object. Does not make a new object on the heap; can be used with a pointer to an chem object on the heap or the stack.

Reimplemented in XMLMoleculeFormat.

Referenced by OBMoleculeFormat::DeferMolOutput(), OBConversion::Read(), and OBMoleculeFormat::ReadChemObjectImpl().

◆ ReadChemObject()

virtual bool ReadChemObject ( OBConversion )
inlinevirtualinherited

The "Convert" interface Read function.

Possibly reads multiple new objects on the heap and subjects them to its DoTransformations() function, which may delete them again. Sends result to pConv->AddChemObject()

Reimplemented in XMLMoleculeFormat, and OBMoleculeFormat.

Referenced by OBConversion::Convert().

◆ WriteMolecule()

virtual bool WriteMolecule ( OBBase ,
OBConversion  
)
inlinevirtualinherited

The "API" interface Write function.

Writes a single object Does not delete the object; can be used with a pointer to an chem object on the heap or the stack.

Returns
false on error.

Referenced by OBMoleculeFormat::DeleteDeferredMols(), OBMoleculeFormat::DoOutputOptions(), OBMoleculeFormat::OutputDeferredMols(), OBConversion::Write(), and OBMoleculeFormat::WriteChemObjectImpl().

◆ WriteChemObject()

virtual bool WriteChemObject ( OBConversion )
inlinevirtualinherited

The "Convert" interface Write function.

Writes a single object Deletes the object after writing

Returns
false on error

Reimplemented in XMLMoleculeFormat, and OBMoleculeFormat.

Referenced by OBConversion::AddChemObject(), and OBConversion::Convert().

◆ Description()

virtual const char* Description ( )
pure virtualinherited

Information on this format. Printed out in response to -Hxxx option where xxx id the id of the format.

Must be provided by each format class. Can include a list of command line Options. These may be used to construction check boxes, radio buttons etc for GUI interface.

Reimplemented from OBPlugin.

Referenced by OBConversion::GetNextFormat(), and OBConversion::RegisterOptionParam().

◆ TargetClassDescription()

const char * TargetClassDescription ( )
virtualinherited

A decription of the chemical object converted by this format.

If not provided, the object type used by the default format is used (usually OBMol).

Referenced by OBConversion::ReportNumberConverted().

◆ GetType()

const type_info & GetType ( )
virtualinherited
Returns
the type of chemical object used by the format. Defaults to that used by the default format. Useful for checking that a format can handle a particular object.

Reimplemented in XMLMoleculeFormat, and OBMoleculeFormat.

◆ SpecificationURL()

virtual const char* SpecificationURL ( )
inlinevirtualinherited

Web address where the format is defined.

◆ GetMIMEType()

virtual const char* GetMIMEType ( )
inlinevirtualinherited

Chemical MIME type associated with this file type (if any)

◆ Flags()

virtual unsigned int Flags ( )
inlinevirtualinherited

Decribes the capabilities of the format (Read only etc.)

Currently, can be a bitwise OR of any of the following NOTREADABLE READONEONLY NOTWRITABLE WRITEONEONLY DEFAULTFORMAT READBINARY WRITEBINARY READXML

Referenced by OBConversion::AddChemObject(), OBConversion::Convert(), OBMoleculeFormat::DeleteDeferredMols(), OBConversion::GetNextFormat(), OBMoleculeFormat::ReadChemObjectImpl(), OBConversion::SetInFormat(), OBConversion::SetInStream(), and OBConversion::SetOutFormat().

◆ MakeNewInstance()

virtual OBFormat* MakeNewInstance ( )
inlinevirtualinherited
Returns
a pointer to a new instance of the format, or NULL if fails. Normally a single global instance is used but this may cause problems if there are member variables and the format is used in more than one place in the program.

◆ RegisterFormat()

int RegisterFormat ( const char *  ID,
const char *  MIME = NULL 
)
inherited

◆ Display()

bool Display ( std::string &  txt,
const char *  param,
const char *  ID = NULL 
)
virtualinherited

Provides a description in txt of the format specified by itr. If param starts with "in", "read", "out" or "write" only the appropriate formats are output. The others return false. If param contains "verbose", the whole description is output.

Reimplemented from OBPlugin.

◆ FormatFromMIME()

OBFormat * FormatFromMIME ( const char *  MIME)
staticinherited

Member Data Documentation

◆ _pxmlConv

XMLConversion* _pxmlConv
protected

◆ _prefix

std::string _prefix
protected

◆ baseindent

int baseindent
protected

◆ ind

int ind
protected

◆ nsdecl

std::string nsdecl
protected

◆ _embedlevel

int _embedlevel
protected

The documentation for this class was generated from the following file: