2007-03-27 09:04:31 +02:00
|
|
|
/*
|
|
|
|
|
2015-06-03 07:18:48 +02:00
|
|
|
Copyright (c) 2007-2015, Arvid Norberg
|
2007-03-27 09:04:31 +02:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in
|
|
|
|
the documentation and/or other materials provided with the distribution.
|
|
|
|
* Neither the name of the author nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived
|
|
|
|
from this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TORRENT_XML_PARSE_HPP
|
|
|
|
#define TORRENT_XML_PARSE_HPP
|
|
|
|
|
2015-04-21 03:16:28 +02:00
|
|
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
2015-04-18 04:33:39 +02:00
|
|
|
|
2007-08-07 08:48:47 +02:00
|
|
|
#include <cctype>
|
2009-02-10 08:21:28 +01:00
|
|
|
#include <cstring>
|
2007-08-07 08:48:47 +02:00
|
|
|
|
2015-04-18 04:33:39 +02:00
|
|
|
#include <boost/function.hpp>
|
|
|
|
|
2015-04-21 03:16:28 +02:00
|
|
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
2015-04-18 04:33:39 +02:00
|
|
|
|
2014-05-03 23:10:44 +02:00
|
|
|
#include "libtorrent/config.hpp"
|
2013-09-01 03:10:50 +02:00
|
|
|
#include "libtorrent/assert.hpp"
|
2011-07-20 07:14:25 +02:00
|
|
|
|
2007-03-27 09:04:31 +02:00
|
|
|
namespace libtorrent
|
|
|
|
{
|
2007-08-07 03:32:38 +02:00
|
|
|
enum
|
|
|
|
{
|
2007-08-07 05:27:08 +02:00
|
|
|
xml_start_tag,
|
|
|
|
xml_end_tag,
|
|
|
|
xml_empty_tag,
|
|
|
|
xml_declaration_tag,
|
|
|
|
xml_string,
|
|
|
|
xml_attribute,
|
|
|
|
xml_comment,
|
2012-02-20 08:51:36 +01:00
|
|
|
xml_parse_error,
|
|
|
|
// used for tags that don't follow the convention of
|
|
|
|
// key-value pairs inside the tag brackets. Like !DOCTYPE
|
|
|
|
xml_tag_content
|
2007-08-07 03:32:38 +02:00
|
|
|
};
|
|
|
|
|
2015-09-06 01:31:47 +02:00
|
|
|
// callback(int type, char const* name, int name_len
|
|
|
|
// , char const* val, int val_len)
|
|
|
|
// name is element or attribute name
|
|
|
|
// val is attribute value
|
|
|
|
// neither string is null terminated, but their lengths are specified via
|
|
|
|
// name_len and val_len respectively
|
|
|
|
TORRENT_EXTRA_EXPORT void xml_parse(char const* p, char const* end
|
|
|
|
, boost::function<void(int,char const*,int,char const*,int)> callback);
|
2007-03-27 09:04:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|