head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.38; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.53; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.00; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.56; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# easyxml.hxx

Go to the documentation of this file.

    00001
    00008 #ifndef __EASYXML_HXX
    00009 #define __EASYXML_HXX
    00010
    00011 #include <simgear/compiler.h>
    00012
    00013 #include <simgear/misc/exception.hxx>
    00014
    00015 #include STL_IOSTREAM
    00016 #include STL_STRING
    00017 #include <vector>
    00018
    00019 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
    00020 SG_USING_STD(istream);
    00021 #endif
    00022 SG_USING_STD(string);
    00023 SG_USING_STD(vector);
    00024
    00025
    00036 class XMLAttributes
    00037 {
    00038 public:
    00039
    00043   XMLAttributes ();
    00044
    00045
    00049   virtual ~ XMLAttributes ();
    00050
    00051
    00057   virtual int size () const = 0;
    00058
    00059
    00069   virtual const char * getName (int i) const = 0;
    00070
    00071
    00081   virtual const char * getValue (int i) const = 0;
    00082
    00083
    00095   virtual int findAttribute (const char * name) const;
    00096
    00097
    00105   virtual bool hasAttribute (const char * name) const;
    00106
    00107
    00118   virtual const char * getValue (const char * name) const;
    00119 };
    00120
    00121
    00133 class XMLAttributesDefault : public XMLAttributes
    00134 {
    00135 public:
    00136
    00140   XMLAttributesDefault ();
    00141
    00142
    00151   XMLAttributesDefault (const XMLAttributes & atts);
    00152
    00153
    00157   virtual ~XMLAttributesDefault ();
    00158
    00159
    00163   virtual int size () const;
    00164
    00165
    00169   virtual const char * getName (int i) const;
    00170
    00171
    00175   virtual const char * getValue (int i) const;
    00176
    00177
    00186   virtual void addAttribute (const char * name, const char * value);
    00187
    00188
    00198   virtual void setName (int i, const char * name);
    00199
    00200
    00210   virtual void setValue (int i, const char * value);
    00211
    00212
    00223   virtual void setValue (const char * name, const char * value);
    00224
    00225 private:
    00226   vector<string> _atts;
    00227 };
    00228
    00229
    00241 class XMLVisitor
    00242 {
    00243 public:
    00244
    00248   virtual ~XMLVisitor () {}
    00249
    00250
    00261   virtual void startXML () {}
    00262
    00263
    00278   virtual void endXML () {}
    00279
    00280
    00299   virtual void startElement (const char * name, const XMLAttributes &atts) {}
    00300
    00301
    00310   virtual void endElement (const char * name) {}
    00311
    00312
    00327   virtual void data (const char * s, int length) {}
    00328
    00329
    00344   virtual void pi (const char * target, const char * data) {}
    00345
    00346
    00359   virtual void warning (const char * message, int line, int column) {}
    00360 };
    00361
    00362
    00382 extern void readXML (istream &input, XMLVisitor &visitor,
    00383                      const string &path="");
    00384
    00385
    00404 extern void readXML (const string &path, XMLVisitor &visitor);
    00405
    00406
    00407 #endif // __EASYXML_HXX
    00408

@ 1.3 log @Oops, try again. @ text @d133 1 a133 1