]> git.mxchange.org Git - simgear.git/blobdiff - simgear/xml/easyxml.hxx
HTTP: Rename urlretrieve/urlload to save/load.
[simgear.git] / simgear / xml / easyxml.hxx
index 1e5404d6d69743355dad6063aab80ae75ce0f4ac..6356901bd53b00abd1d58acab11f6fbde2692258 100644 (file)
@@ -9,18 +9,15 @@
 #define __EASYXML_HXX
 
 #include <simgear/compiler.h>
+#include <simgear/structure/exception.hxx>
 
-#include <simgear/misc/exception.hxx>
-
-#include STL_IOSTREAM
-#include STL_STRING
+#include <iostream>
+#include <string>
 #include <vector>
 
-#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
-SG_USING_STD(istream);
-#endif
-SG_USING_STD(string);
-SG_USING_STD(vector);
+using std::istream;
+using std::string;
+using std::vector;
 
 
 /**
@@ -226,6 +223,24 @@ private:
   vector<string> _atts;
 };
 
+////////////////////////////////////////////////////////////////////////
+// Attribute list wrapper for Expat.
+////////////////////////////////////////////////////////////////////////
+
+class ExpatAtts : public XMLAttributes
+{
+public:
+  ExpatAtts (const char ** atts) : _atts(atts) {}
+  
+  virtual int size () const;
+  virtual const char * getName (int i) const;
+  virtual const char * getValue (int i) const;
+  
+  virtual const char * getValue (const char * name) const;
+private:
+  const char ** _atts;
+};
+
 
 /**
  * Visitor class for an XML document.
@@ -404,5 +419,27 @@ extern void readXML (istream &input, XMLVisitor &visitor,
 extern void readXML (const string &path, XMLVisitor &visitor);
 
 
+/**
+ * @relates XMLVisitor
+ * Read an XML document.
+ *
+ * This function reads an XML document from the buffer provided,
+ * and invokes the callback methods in the visitor object to pass the 
+ * parsing events back to the application.  When this function
+ * returns, the parser will have reported all of the data in the XML
+ * document to the application through the visitor callback methods,
+ * and XML processing will be complete.
+ *
+ * @param buf The xml data buffer.
+ * @param size The size of the data buffer in bytes
+ * @param visitor An object that contains callbacks for XML parsing
+ * events.
+ * @exception Throws sg_io_exception or sg_xml_exception if there
+ * is a problem reading the file.
+ * @see XMLVisitor
+ */
+extern void readXML (const char *buf, const int size, XMLVisitor &visitor);
+
+
 #endif // __EASYXML_HXX