// -*- mode: C++; tab-width: 4; indent-tabs-mode: t; -*- vim:ts=4:sw=4 // // Copyright (C) 2004,2005 David Lau (skunix) // Chong Kai Xiong (descender) // // This file is part of The Plains of Usata. // // The Plains of Usata is licensed under the GNU General Public // License (GPL) version 2. For details, please see the COPYING file // included in the software distribution, or visit // http://www.fsf.org/licenses/gpl.html. // // $Id: parser.hpp,v 1.1 2005/02/16 06:30:02 skunix Exp $ #include namespace XML { struct ParserData; class Parser { private: std::auto_ptr mParserData; void reset(); static void c_start_element_cb(void *user_data, const char* element, const char**a); static void c_end_element_cb(void *user_data, const char* element); protected: /* virtual void start()=0; virtual void end()=0;*/ virtual void element_start(const char*, const char**)=0; virtual void element_end(const char*)=0; virtual void content(const char *, int len); void* get_buffer(unsigned len); public: Parser(); bool parse_chunk(const char* buffer, unsigned len, bool last); bool parse_chunkb(unsigned len, bool last); std::string get_error(); virtual ~Parser(); }; }