Orcus
Loading...
Searching...
No Matches
orcus::xml_structure_tree Class Reference

#include <xml_structure_tree.hpp>

Classes

struct  entity_name
struct  element
class  walker

Public Types

enum class  callback_type : uint8_t { unknown = 0 , on_repeat_node }
using callback_handler_type = std::function<void(std::any)>
using range_handler_type = std::function<void(xml_table_range_t&&)>
typedef std::vector< entity_nameentity_names_type

Public Member Functions

 xml_structure_tree (const xml_structure_tree &)=delete
xml_structure_tree & operator= (const xml_structure_tree &)=delete
 xml_structure_tree (xmlns_context &xmlns_cxt)
 xml_structure_tree (xml_structure_tree &&other)
void set_callback (callback_type type, callback_handler_type callback)
void parse (std::string_view s)
void dump_compact (std::ostream &os) const
walker get_walker () const
void process_ranges (range_handler_type rh) const
void swap (xml_structure_tree &other)

Detailed Description

Tree representing the structure of elements in XML content. Recurring elements under the same parent are represented by a single element instance. This tree only includes elements; no attributes and content nodes appear in this tree.

Member Typedef Documentation

◆ callback_handler_type

using orcus::xml_structure_tree::callback_handler_type = std::function<void(std::any)>

Callback function type. It must take one argument. What value is assigned and what the type of a value is depends on the location of the callback. Refer to callback_type for details.

Member Enumeration Documentation

◆ callback_type

enum class orcus::xml_structure_tree::callback_type : uint8_t
strong

Location of a callback function.

Enumerator
unknown 

Location not specified or unknown.

on_repeat_node 

Callback function is called when a repeated element is encountered. The argument passed to the callback function contains the name of the repeated element and its type is entity_name.

Member Function Documentation

◆ set_callback()

void orcus::xml_structure_tree::set_callback ( callback_type type,
callback_handler_type callback )

Assign a user-defined callback function in a specified point of execution during parsing.

Parameters
typeLocation where the callback function will be called.
callbackCallback function.