Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

XMLObject.h

Go to the documentation of this file.
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __XML_OBJECT_H
00005 #define __XML_OBJECT_H
00006 
00007 #include <libxml/parser.h>
00008 #include <string>
00009 
00010 #include <dolfin/constants.h>
00011 
00012 namespace dolfin {
00013 
00014   class XMLObject {
00015   public:
00016     
00017     XMLObject();
00018     
00019     virtual void startElement (const xmlChar* name, const xmlChar** attrs) = 0;
00020     virtual void endElement   (const xmlChar* name) = 0;
00021     
00022     // Write message before and after reading file
00023     virtual void reading(std::string filename) {};
00024     virtual void done() {};
00025     
00026     bool dataOK();
00027     
00028   protected:
00029     
00030     void parseIntegerRequired (const xmlChar* name, const xmlChar** attrs, 
00031                                const char *attribute, int& value);
00032 
00033     void parseIntegerOptional (const xmlChar* name, const xmlChar** attrs,
00034                                const char* attribute, int& value);
00035 
00036     void parseRealRequired    (const xmlChar* name, const xmlChar** attrs,
00037                                const char* attribute, real& value);
00038 
00039     void parseRealOptional    (const xmlChar* name, const xmlChar** attrs,
00040                                const char* attribute, real& value);
00041 
00042     void parseStringRequired  (const xmlChar* name, const xmlChar** attrs,
00043                                const char* attribute, std::string& value);
00044 
00045     void parseStringOptional  (const xmlChar* name, const xmlChar** attrs,
00046                                const char* attribute, std::string& value);
00047     
00048     bool ok;
00049     
00050   };
00051   
00052 }
00053 
00054 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.