1 #ifndef RAPIDXML_HPP_INCLUDED 2 #define RAPIDXML_HPP_INCLUDED 41 const char *
what()
const noexcept
override;
59 #ifndef RAPIDXML_STATIC_POOL_SIZE 63 #define RAPIDXML_STATIC_POOL_SIZE (64 * 1024) 66 #ifndef RAPIDXML_DYNAMIC_POOL_SIZE 70 #define RAPIDXML_DYNAMIC_POOL_SIZE (64 * 1024) 73 #ifndef RAPIDXML_ALIGNMENT 78 #define RAPIDXML_ALIGNMENT sizeof(void *) 271 typedef void *(alloc_func)(std::size_t);
272 typedef void (free_func)(
void *);
293 xml_node* allocate_node(
node_type type,
const char *
name =
nullptr,
const char *
value =
nullptr, std::size_t name_size = 0, std::size_t value_size = 0);
304 xml_attribute *allocate_attribute(
const char *
name =
nullptr,
const char *
value =
nullptr, std::size_t name_size = 0, std::size_t value_size = 0);
313 char *allocate_string(
const char *source =
nullptr, std::size_t size = 0);
344 void set_allocator(alloc_func *af, free_func *ff);
350 char *previous_begin;
355 char *align(
char *ptr);
357 char *allocate_raw(std::size_t size);
359 void *allocate_aligned(std::size_t size);
365 alloc_func *m_alloc_func;
366 free_func *m_free_func;
400 std::size_t name_size()
const;
413 std::size_t value_size()
const;
431 void name(
const char *name, std::size_t size);
436 void name(
const char *name);
454 void value(
const char *value, std::size_t size);
459 void value(
const char *value);
471 static char *nullstr();
512 xml_attribute *previous_attribute(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
519 xml_attribute *next_attribute(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
571 xml_node *first_node(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
580 xml_node *last_node(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
589 xml_node *previous_sibling(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
598 xml_node *next_sibling(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
605 xml_attribute *first_attribute(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
612 xml_attribute *last_attribute(
const char *
name =
nullptr, std::size_t name_size = 0,
bool case_sensitive =
true)
const;
643 void remove_first_node();
648 void remove_last_node();
655 void remove_all_nodes();
674 void remove_first_attribute();
679 void remove_last_attribute();
686 void remove_all_attributes();
749 void parse(
char *text);
761 struct whitespace_pred
763 static unsigned char test(
char ch);
767 struct node_name_pred
769 static unsigned char test(
char ch);
773 struct attribute_name_pred
775 static unsigned char test(
char ch);
781 static unsigned char test(
char ch);
785 struct text_pure_no_ws_pred
787 static unsigned char test(
char ch);
791 struct text_pure_with_ws_pred
793 static unsigned char test(
char ch);
798 struct attribute_value_pred
800 static unsigned char test(
char ch);
805 struct attribute_value_pure_pred
807 static unsigned char test(
char ch);
812 static void insert_coded_character(
char *&text,
unsigned long code);
815 template<
class StopPred,
int Flags>
816 static void skip(
char *&text);
821 template<
class StopPred,
class StopPredPure,
int Flags>
822 static char *skip_and_expand_character_refs(
char *&text);
829 void parse_bom(
char *&text);
833 xml_node *parse_xml_declaration(
char *&text);
837 xml_node *parse_comment(
char *&text);
841 xml_node *parse_doctype(
char *&text);
851 char parse_and_append_data(
xml_node *node,
char *&text,
char *contents_start);
859 xml_node *parse_element(
char *&text);
867 void parse_node_contents(
char *&text,
xml_node *node);
871 void parse_node_attributes(
char *&text,
xml_node *node);
node_type
Enumeration listing all node types produced by the parser.
Definition: rapidxml.h:89
xml_node * m_parent
Definition: rapidxml.h:477
A comment node. Name is empty. Value contains comment text.
Definition: rapidxml.h:95
const int parse_full
A combination of parse flags resulting in largest amount of data being extracted. ...
Definition: rapidxml.h:226
Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().
Definition: rapidxml.h:375
const int parse_no_element_values
Parse flag instructing the parser to not use text of first data node as a value of parent element...
Definition: rapidxml.h:118
const int parse_no_entity_translation
Parse flag instructing the parser to not translate entities in the source text.
Definition: rapidxml.h:132
const int parse_no_data_nodes
Parse flag instructing the parser to not create data nodes.
Definition: rapidxml.h:109
const int parse_default
Parse flags which represent default behaviour of the parser.
Definition: rapidxml.h:205
A CDATA node. Name is empty. Value contains data text.
Definition: rapidxml.h:94
An element node. Name contains element name. Value contains text of first data node.
Definition: rapidxml.h:92
This class is used by the parser to create new nodes and attributes, without overheads of dynamic mem...
Definition: rapidxml.h:265
const int parse_validate_closing_tags
Parse flag instructing the parser to validate closing tag names.
Definition: rapidxml.h:176
const int parse_no_utf8
Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters...
Definition: rapidxml.h:139
A document node. Name and value are empty.
Definition: rapidxml.h:91
char * m_name
Definition: rapidxml.h:473
char * where() const
Gets pointer to character data where error happened.
Definition: rapidxml.cpp:347
std::size_t m_name_size
Definition: rapidxml.h:475
const int parse_comment_nodes
Parse flag instructing the parser to create comments nodes.
Definition: rapidxml.h:153
const int parse_pi_nodes
Parse flag instructing the parser to create PI nodes.
Definition: rapidxml.h:168
Parse error exception.
Definition: rapidxml.h:31
PVariable value
Definition: UiElements.h:217
const int parse_non_destructive
A combination of parse flags that forbids any modifications of the source text.
Definition: rapidxml.h:215
const int parse_declaration_node
Parse flag instructing the parser to create XML declaration node.
Definition: rapidxml.h:146
const int parse_trim_whitespace
Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes...
Definition: rapidxml.h:184
Class representing attribute node of XML document.
Definition: rapidxml.h:486
char * m_value
Definition: rapidxml.h:474
A data node. Name is empty. Value contains data text.
Definition: rapidxml.h:93
A DOCTYPE node. Name is empty. Value contains DOCTYPE text.
Definition: rapidxml.h:97
A PI node. Name contains target. Value contains instructions.
Definition: rapidxml.h:98
A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalon...
Definition: rapidxml.h:96
std::size_t m_value_size
Definition: rapidxml.h:476
const int parse_normalize_whitespace
Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space cha...
Definition: rapidxml.h:193
const int parse_no_string_terminators
Parse flag instructing the parser to not place zero terminators after strings in the source text...
Definition: rapidxml.h:125
std::string name
Definition: UiElements.h:216
This class represents root of the DOM hierarchy.
Definition: rapidxml.h:729
Class representing a node of XML document.
Definition: rapidxml.h:539
Definition: BinaryPayload.h:38
const char * what() const noexcept override
Gets human readable description of error.
Definition: rapidxml.cpp:342
const int parse_fastest
A combination of parse flags resulting in fastest possible parsing, without sacrificing important dat...
Definition: rapidxml.h:220
parse_error(const char *what, void *where)
Constructs parse error.
Definition: rapidxml.cpp:338
#define RAPIDXML_STATIC_POOL_SIZE
Definition: rapidxml.h:63
const int parse_doctype_node
Parse flag instructing the parser to create DOCTYPE node.
Definition: rapidxml.h:161