X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fxml%2Feasyxml.hxx;h=f5ff575d9dcb2d803f277c3e32bfe6af335e32a6;hb=b9a34b1b05ce9cab1b4b67816d7d24bd2bc364b7;hp=12cb7f502d829b4cf19e63bc2b112d825894ad04;hpb=fcb873b6ddde6678824b93e3920fd0dc8e47be97;p=simgear.git diff --git a/simgear/xml/easyxml.hxx b/simgear/xml/easyxml.hxx index 12cb7f50..f5ff575d 100644 --- a/simgear/xml/easyxml.hxx +++ b/simgear/xml/easyxml.hxx @@ -9,16 +9,15 @@ #define __EASYXML_HXX #include +#include -#include STL_IOSTREAM -#include STL_STRING +#include +#include #include -#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; /** @@ -355,25 +354,6 @@ public: * the warning. */ virtual void warning (const char * message, int line, int column) {} - - - /** - * Callback for a fatal XML parsing error. - * - * The XML parser will use this method to report any fatal errors - * during parsing. Once the first error callback is received, - * normal processing will stop, though additional errors may be - * reported. The application should take any appropriate - * error-handling procedures when it receives this callback, and - * should not attempt to use any of the data found in the XML - * document. - * - * @param message The error message from the parser. - * @param line The number of the line that generated the error. - * @param column The character position in the line that generated - * the error. - */ - virtual void error (const char * message, int line, int column) = 0; }; @@ -391,11 +371,56 @@ public: * @param input The byte input stream containing the XML document. * @param visitor An object that contains callbacks for XML parsing * events. - * @return true if the parse succeeded, false if there was a fatal - * error. + * @param path A string describing the original path of the resource. + * @exception Throws sg_io_exception or sg_xml_exception if there + * is a problem reading the file. + * @see XMLVisitor + */ +extern void readXML (istream &input, XMLVisitor &visitor, + const string &path=""); + + +/** + * @relates XMLVisitor + * Read an XML document. + * + * This function reads an XML document from the input stream 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 path The file name of the XML resource. + * @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 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 bool readXML (istream &input, XMLVisitor &visitor); +extern void readXML (const char *buf, const int size, XMLVisitor &visitor); #endif // __EASYXML_HXX