![]() |
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __XML_FILE_H 00005 #define __XML_FILE_H 00006 00007 #include <libxml/parser.h> 00008 #include <dolfin/constants.h> 00009 #include <dolfin/Function.h> 00010 #include <dolfin/GenericFile.h> 00011 00012 namespace dolfin { 00013 00014 class Vector; 00015 class Matrix; 00016 class Mesh; 00017 class Function; 00018 class Function::Vector; 00019 class ParameterList; 00020 class XMLObject; 00021 00022 class XMLFile : public GenericFile { 00023 public: 00024 00025 XMLFile(const std::string filename); 00026 ~XMLFile(); 00027 00028 // Input 00029 00030 void operator>> (Vector& x); 00031 void operator>> (Matrix& A); 00032 void operator>> (Mesh& mesh); 00033 void operator>> (ParameterList& parameters); 00034 00035 // Output 00036 00037 void operator<< (Vector& x); 00038 void operator<< (Matrix& A); 00039 void operator<< (Function::Vector& u); 00040 void operator<< (ParameterList& parameters); 00041 00042 // Friends 00043 00044 friend void sax_start_element (void *ctx, const xmlChar *name, const xmlChar **attrs); 00045 friend void sax_end_element (void *ctx, const xmlChar *name); 00046 00047 private: 00048 00049 void parseFile(); 00050 void parseSAX(); 00051 00052 // Data 00053 XMLObject* xmlObject; 00054 00055 }; 00056 00057 // Callback functions for the SAX interface 00058 00059 void sax_start_document (void *ctx); 00060 void sax_end_document (void *ctx); 00061 void sax_start_element (void *ctx, const xmlChar *name, const xmlChar **attrs); 00062 void sax_end_element (void *ctx, const xmlChar *name); 00063 00064 void sax_warning (void *ctx, const char *msg, ...); 00065 void sax_error (void *ctx, const char *msg, ...); 00066 void sax_fatal_error (void *ctx, const char *msg, ...); 00067 00068 } 00069 00070 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.