1 #ifndef LIBFILEZILLA_XML_HEADER 2 #define LIBFILEZILLA_XML_HEADER 17 enum class callback_event
56 typedef std::function<bool(callback_event type, std::string_view path, std::string_view name, std::string && value)>
callback_t;
68 bool parse(std::string_view data);
75 std::string get_error()
const;
79 bool is_valid_tag_or_attr(std::string_view s)
const;
80 bool normalize_value();
82 bool parse_valid_utf8(std::string_view data);
83 bool parse(
char const*
const begin,
char const*
const end);
84 void set_error(std::string_view msg,
size_t offset);
86 bool deduce_encoding(std::string_view & data);
124 std::vector<size_t> nodes_;
127 std::string converted_{};
130 size_t utf8_state_{};
131 uint32_t utf16_state_;
134 state s_{ state::content };
136 enum class encoding {
142 encoding encoding_{};
145 size_t tag_match_pos_{};
147 unsigned char dashes_;
177 bool parse(std::string_view data);
180 std::string get_error()
const;
183 typedef std::function<bool(callback_event type, std::string_view path, std::string_view name, std::string_view value)>
raw_callback_t;
187 std::string_view apply_namespaces(std::string_view in);
188 bool apply_namespace_to_path();
190 bool on_callback(callback_event type, std::string_view path, std::string_view name, std::string && value);
199 std::vector<size_t> nodes_;
200 std::vector<std::pair<std::string, std::string>> attributes_;
201 std::vector<std::tuple<size_t, std::string, std::string>> namespaces_;
202 bool needs_namespace_expansion_{};
213 void log(callback_event type, std::string_view, std::string_view name, std::string_view value);
216 virtual void on_line(std::string_view line) = 0;
234 virtual void on_line(std::string_view line)
override;
A slow pretty printer for XML as it is being parsed.
Definition: xml.hpp:228
A streaming XML parser.
Definition: xml.hpp:47
A stremable XML parser that resolves namespace declarations and namespace prefixes.
Definition: xml.hpp:167
type
Definition: logger.hpp:15
The namespace used by libfilezilla.
Definition: apply.hpp:17
A slow pretty printer for XML as it is being parsed.
Definition: xml.hpp:207
std::function< bool(callback_event type, std::string_view path, std::string_view name, std::string &&value)> callback_t
Definition: xml.hpp:56
std::function< bool(callback_event type, std::string_view path, std::string_view name, std::string_view value)> raw_callback_t
Additional raw callback to look at events before namespace processing takes place.
Definition: xml.hpp:183
The buffer class is a simple buffer where data can be appended at the end and consumed at the front...
Definition: buffer.hpp:26
Abstract interface for logging strings.
Definition: logger.hpp:50