16#ifndef PUGIXML_VERSION
18# define PUGIXML_VERSION 170
28#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
40#ifndef PUGIXML_DEPRECATED
42# define PUGIXML_DEPRECATED __attribute__((deprecated))
43# elif defined(_MSC_VER) && _MSC_VER >= 1300
44# define PUGIXML_DEPRECATED __declspec(deprecated)
46# define PUGIXML_DEPRECATED
57# define PUGIXML_CLASS PUGIXML_API
61#ifndef PUGIXML_FUNCTION
62# define PUGIXML_FUNCTION PUGIXML_API
66#ifndef PUGIXML_HAS_LONG_LONG
67# if __cplusplus >= 201103
68# define PUGIXML_HAS_LONG_LONG
69# elif defined(_MSC_VER) && _MSC_VER >= 1400
70# define PUGIXML_HAS_LONG_LONG
75#ifdef PUGIXML_WCHAR_MODE
76# define PUGIXML_TEXT(t) L ## t
77# define PUGIXML_CHAR wchar_t
79# define PUGIXML_TEXT(t) t
80# define PUGIXML_CHAR char
90 using string_t = std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR>>;
233 #ifndef PUGIXML_NO_XPATH
265 virtual void write(
const void* data,
size_t size) = 0;
275 virtual void write(
const void* data,
size_t size);
281 #ifndef PUGIXML_NO_STL
290 virtual void write(
const void* data,
size_t size);
294 std::basic_ostream<wchar_t, std::char_traits<wchar_t> >*
wide_stream;
346 #ifdef PUGIXML_HAS_LONG_LONG
365 #ifdef PUGIXML_HAS_LONG_LONG
378 #ifdef PUGIXML_HAS_LONG_LONG
552 for (
xml_node node = first_child(); node; node = node.next_sibling())
566 while (
cur._root &&
cur._root != _root)
568 if (pred(
cur))
return cur;
570 if (
cur.first_child())
cur =
cur.first_child();
571 else if (
cur.next_sibling())
cur =
cur.next_sibling();
574 while (!
cur.next_sibling() &&
cur._root != _root)
cur =
cur.parent();
576 if (
cur._root != _root)
cur =
cur.next_sibling();
587 #ifndef PUGIXML_NO_STL
598 #ifndef PUGIXML_NO_XPATH
616 #ifndef PUGIXML_NO_STL
618 void print(std::basic_ostream<
char, std::char_traits<char> >&
os,
const char_t* indent =
PUGIXML_TEXT(
"\t"),
unsigned int flags = format_default,
xml_encoding encoding = encoding_auto,
unsigned int depth = 0)
const;
619 void print(std::basic_ostream<
wchar_t, std::char_traits<wchar_t> >&
os,
const char_t* indent =
PUGIXML_TEXT(
"\t"),
unsigned int flags = format_default,
unsigned int depth = 0)
const;
694 #ifdef PUGIXML_HAS_LONG_LONG
707 bool set(
unsigned int rhs);
712 #ifdef PUGIXML_HAS_LONG_LONG
714 bool set(
unsigned long long rhs);
725 #ifdef PUGIXML_HAS_LONG_LONG
758 #ifndef PUGIXML_NO_STL
800 #ifndef PUGIXML_NO_STL
836 #ifndef PUGIXML_NO_STL
970 #ifndef PUGIXML_NO_STL
1000 #ifndef PUGIXML_NO_STL
1003 void save(std::basic_ostream<
wchar_t, std::char_traits<wchar_t> >&
stream,
const char_t* indent =
PUGIXML_TEXT(
"\t"),
unsigned int flags = format_default)
const;
1014#ifndef PUGIXML_NO_XPATH
1102 #if __cplusplus >= 201103
1146 #if __cplusplus >= 201103
1163 #ifndef PUGIXML_NO_STL
1196 #ifndef PUGIXML_NO_EXCEPTIONS
1208 virtual const char*
what()
const throw();
1287 #if __cplusplus >= 201103
1328#ifndef PUGIXML_NO_STL
1331 std::basic_string<char, std::char_traits<char>, std::allocator<char> >
PUGIXML_FUNCTION as_utf8(
const std::basic_string<
wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&
str);
1335 std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
PUGIXML_FUNCTION as_wide(
const std::basic_string<
char, std::char_traits<char>, std::allocator<char> >&
str);
1352#if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
1362#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
1374#if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
1375# define PUGIXML_SOURCE "pugixml.cpp"
1376# include PUGIXML_SOURCE
std::bidirectional_iterator_tag iterator_category
xml_attribute * operator->() const
ptrdiff_t difference_type
const xml_attribute_iterator & operator--()
xml_attribute_iterator operator--(int)
xml_attribute_iterator operator++(int)
xml_attribute_iterator(xml_attribute_struct *ref, xml_node_struct *parent)
const xml_attribute_iterator & operator++()
xml_attribute_iterator(const xml_attribute &attr, const xml_node &parent)
bool operator==(const xml_attribute_iterator &rhs) const
bool operator!=(const xml_attribute_iterator &rhs) const
xml_attribute & operator*() const
void(*)(xml_attribute ***) unspecified_bool_type
bool operator>(const xml_attribute &r) const
bool set_value(unsigned long long rhs)
unsigned long long as_ullong(unsigned long long def=0) const
bool operator<=(const xml_attribute &r) const
xml_attribute & operator=(unsigned int rhs)
xml_attribute & operator=(const char_t *rhs)
xml_attribute next_attribute() const
xml_attribute & operator=(long long rhs)
size_t hash_value() const
xml_attribute_struct * internal_object() const
xml_attribute(xml_attribute_struct *attr)
bool as_bool(bool def=false) const
const char_t * value() const
float as_float(float def=0) const
xml_attribute & operator=(unsigned long long rhs)
const char_t * name() const
bool set_value(const char_t *rhs)
bool set_value(double rhs)
bool set_value(long long rhs)
bool operator>=(const xml_attribute &r) const
bool operator==(const xml_attribute &r) const
const char_t * as_string(const char_t *def=PUGIXML_TEXT("")) const
double as_double(double def=0) const
bool operator<(const xml_attribute &r) const
unsigned int as_uint(unsigned int def=0) const
xml_attribute_struct * _attr
xml_attribute previous_attribute() const
bool set_value(unsigned int rhs)
bool operator!=(const xml_attribute &r) const
long long as_llong(long long def=0) const
xml_attribute & operator=(float rhs)
xml_attribute & operator=(double rhs)
bool set_name(const char_t *rhs)
bool set_value(float rhs)
xml_attribute & operator=(bool rhs)
xml_attribute & operator=(int rhs)
int as_int(int def=0) const
xml_parse_result load_buffer_inplace_own(void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_parse_result load_file(const char *path, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_parse_result load(std::basic_istream< char, std::char_traits< char > > &stream, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
bool save_file(const wchar_t *path, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
xml_document(const xml_document &)
void save(xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
xml_parse_result load_string(const char_t *contents, unsigned int options=parse_default)
xml_parse_result load_file(const wchar_t *path, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_parse_result load(std::basic_istream< wchar_t, std::char_traits< wchar_t > > &stream, unsigned int options=parse_default)
void save(std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &stream, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default) const
xml_node document_element() const
xml_document & operator=(const xml_document &)
void reset(const xml_document &proto)
xml_parse_result load_buffer_inplace(void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
void save(std::basic_ostream< char, std::char_traits< char > > &stream, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
bool save_file(const char *path, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
xml_parse_result load(const char_t *contents, unsigned int options=parse_default)
xml_parse_result load_buffer(const void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_named_node_iterator(xml_node_struct *ref, xml_node_struct *parent, const char_t *name)
bool operator!=(const xml_named_node_iterator &rhs) const
const xml_named_node_iterator & operator++()
xml_named_node_iterator(const xml_node &node, const char_t *name)
xml_named_node_iterator()
xml_named_node_iterator operator--(int)
xml_node & operator*() const
xml_named_node_iterator operator++(int)
xml_node * operator->() const
std::bidirectional_iterator_tag iterator_category
ptrdiff_t difference_type
bool operator==(const xml_named_node_iterator &rhs) const
const xml_named_node_iterator & operator--()
std::bidirectional_iterator_tag iterator_category
bool operator==(const xml_node_iterator &rhs) const
const xml_node_iterator & operator--()
xml_node_iterator(xml_node_struct *ref, xml_node_struct *parent)
ptrdiff_t difference_type
xml_node_iterator(const xml_node &node)
xml_node_iterator operator--(int)
bool operator!=(const xml_node_iterator &rhs) const
const xml_node_iterator & operator++()
xml_node_iterator operator++(int)
xml_node * operator->() const
xml_node & operator*() const
xpath_node select_single_node(const char_t *query, xpath_variable_set *variables=0) const
void(*)(xml_node ***) unspecified_bool_type
xml_node insert_copy_after(const xml_node &proto, const xml_node &node)
bool remove_child(const xml_node &n)
xml_node insert_move_before(const xml_node &moved, const xml_node &node)
xml_node insert_child_before(const char_t *name, const xml_node &node)
xml_node prepend_copy(const xml_node &proto)
const char_t * value() const
bool operator>=(const xml_node &r) const
bool operator<=(const xml_node &r) const
xml_node insert_move_after(const xml_node &moved, const xml_node &node)
xml_node find_child_by_attribute(const char_t *attr_name, const char_t *attr_value) const
xml_node prepend_move(const xml_node &moved)
xml_node next_sibling(const char_t *name) const
xml_attribute first_attribute() const
xml_attribute insert_copy_after(const xml_attribute &proto, const xml_attribute &attr)
bool operator!=(const xml_node &r) const
xml_attribute insert_attribute_after(const char_t *name, const xml_attribute &attr)
bool traverse(xml_tree_walker &walker)
xml_attribute find_attribute(Predicate pred) const
xml_node prepend_child(xml_node_type type=node_element)
xml_attribute append_attribute(const char_t *name)
xpath_node select_node(const xpath_query &query) const
xml_node append_child(xml_node_type type=node_element)
xml_node first_element_by_path(const char_t *path, char_t delimiter='/') const
xml_node_struct * internal_object() const
xml_node append_copy(const xml_node &proto)
xml_object_range< xml_node_iterator > children() const
const char_t * name() const
xml_attribute insert_attribute_before(const char_t *name, const xml_attribute &attr)
xml_node(xml_node_struct *p)
void print(std::basic_ostream< char, std::char_traits< char > > &os, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto, unsigned int depth=0) const
xml_node find_child_by_attribute(const char_t *name, const char_t *attr_name, const char_t *attr_value) const
xml_object_range< xml_attribute_iterator > attributes() const
xml_node previous_sibling(const char_t *name) const
bool set_name(const char_t *rhs)
xml_attribute prepend_attribute(const char_t *name)
ptrdiff_t offset_debug() const
xml_node first_child() const
xml_node append_child(const char_t *name)
xml_node previous_sibling() const
xml_attribute prepend_copy(const xml_attribute &proto)
xml_node append_move(const xml_node &moved)
xml_object_range< xml_named_node_iterator > children(const char_t *name) const
xml_node insert_copy_before(const xml_node &proto, const xml_node &node)
bool remove_child(const char_t *name)
xml_attribute attribute(const char_t *name) const
xml_node find_node(Predicate pred) const
xpath_node select_node(const char_t *query, xpath_variable_set *variables=0) const
bool operator<(const xml_node &r) const
attribute_iterator attributes_begin() const
bool operator==(const xml_node &r) const
xml_attribute last_attribute() const
xml_attribute insert_copy_before(const xml_attribute &proto, const xml_attribute &attr)
bool remove_attribute(const char_t *name)
xml_parse_result append_buffer(const void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_node insert_child_before(xml_node_type type, const xml_node &node)
xml_node last_child() const
void print(xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto, unsigned int depth=0) const
const char_t * child_value() const
xml_attribute append_copy(const xml_attribute &proto)
size_t hash_value() const
xml_node prepend_child(const char_t *name)
xml_node_type type() const
xml_node find_child(Predicate pred) const
xml_attribute attribute(const char_t *name, xml_attribute &hint) const
xml_node insert_child_after(const char_t *name, const xml_node &node)
bool remove_attribute(const xml_attribute &a)
const char_t * child_value(const char_t *name) const
string_t path(char_t delimiter='/') const
xpath_node_set select_nodes(const xpath_query &query) const
bool operator>(const xml_node &r) const
xml_node next_sibling() const
xpath_node_set select_nodes(const char_t *query, xpath_variable_set *variables=0) const
xpath_node select_single_node(const xpath_query &query) const
attribute_iterator attributes_end() const
void print(std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &os, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, unsigned int depth=0) const
xml_node child(const char_t *name) const
xml_node insert_child_after(xml_node_type type, const xml_node &node)
bool set_value(const char_t *rhs)
xml_object_range(It b, It e)
const char_t * as_string(const char_t *def=PUGIXML_TEXT("")) const
xml_text(xml_node_struct *root)
double as_double(double def=0) const
float as_float(float def=0) const
int as_int(int def=0) const
xml_node_struct * _data() const
xml_text & operator=(double rhs)
xml_text & operator=(int rhs)
bool set(unsigned int rhs)
xml_text & operator=(long long rhs)
xml_text & operator=(unsigned long long rhs)
xml_text & operator=(bool rhs)
bool as_bool(bool def=false) const
bool set(const char_t *rhs)
long long as_llong(long long def=0) const
xml_node_struct * _data_new()
unsigned long long as_ullong(unsigned long long def=0) const
void(*)(xml_text ***) unspecified_bool_type
bool set(unsigned long long rhs)
xml_text & operator=(float rhs)
unsigned int as_uint(unsigned int def=0) const
const char_t * get() const
xml_text & operator=(const char_t *rhs)
xml_text & operator=(unsigned int rhs)
virtual bool for_each(xml_node &node)=0
virtual ~xml_tree_walker()
virtual bool end(xml_node &node)
virtual bool begin(xml_node &node)
virtual void write(const void *data, size_t size)
xml_writer_file(void *file)
xml_writer_stream(std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &stream)
std::basic_ostream< wchar_t, std::char_traits< wchar_t > > * wide_stream
xml_writer_stream(std::basic_ostream< char, std::char_traits< char > > &stream)
virtual void write(const void *data, size_t size)
std::basic_ostream< char, std::char_traits< char > > * narrow_stream
virtual void write(const void *data, size_t size)=0
const_iterator begin() const
xpath_node_set(const_iterator begin, const_iterator end, type_t type=type_unsorted)
void sort(bool reverse=false)
xpath_node_set(const xpath_node_set &ns)
const_iterator end() const
const xpath_node & operator[](size_t index) const
void _assign(const_iterator begin, const_iterator end, type_t type)
void _move(xpath_node_set &rhs)
xpath_node_set & operator=(const xpath_node_set &ns)
xml_attribute attribute() const
bool operator!=(const xpath_node &n) const
void(*)(xpath_node ***) unspecified_bool_type
xpath_node(const xml_attribute &attribute, const xml_node &parent)
bool operator==(const xpath_node &n) const
xpath_node(const xml_node &node)
xpath_node_set evaluate_node_set(const xpath_node &n) const
string_t evaluate_string(const xpath_node &n) const
xpath_query(const char_t *query, xpath_variable_set *variables=0)
size_t evaluate_string(char_t *buffer, size_t capacity, const xpath_node &n) const
xpath_parse_result _result
xpath_node evaluate_node(const xpath_node &n) const
xpath_query & operator=(const xpath_query &)
double evaluate_number(const xpath_node &n) const
void(*)(xpath_query ***) unspecified_bool_type
const xpath_parse_result & result() const
xpath_query(const xpath_query &)
xpath_value_type return_type() const
bool evaluate_boolean(const xpath_node &n) const
void _swap(xpath_variable_set &rhs)
const xpath_variable * get(const char_t *name) const
xpath_variable * _find(const char_t *name) const
xpath_variable_set & operator=(const xpath_variable_set &rhs)
bool set(const char_t *name, const xpath_node_set &value)
bool set(const char_t *name, bool value)
bool set(const char_t *name, const char_t *value)
bool set(const char_t *name, double value)
xpath_variable * get(const char_t *name)
static bool _clone(xpath_variable *var, xpath_variable **out_result)
void _assign(const xpath_variable_set &rhs)
static void _destroy(xpath_variable *var)
xpath_variable_set(const xpath_variable_set &rhs)
xpath_variable * add(const char_t *name, xpath_value_type type)
bool set(const char_t *value)
xpath_variable(const xpath_variable &)
xpath_value_type type() const
xpath_variable(xpath_value_type type)
double get_number() const
const xpath_node_set & get_node_set() const
const char_t * get_string() const
const char_t * name() const
xpath_variable & operator=(const xpath_variable &)
bool set(const xpath_node_set &value)
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
void(*)(void *ptr) deallocation_function
deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function()
allocation_function PUGIXML_FUNCTION get_memory_allocation_function()
const unsigned int format_no_declaration
const unsigned int parse_trim_pcdata
const unsigned int parse_wconv_attribute
const unsigned int format_raw
const unsigned int format_default
const unsigned int parse_cdata
std::basic_string< char, std::char_traits< char >, std::allocator< char > > PUGIXML_FUNCTION as_utf8(const wchar_t *str)
const unsigned int parse_fragment
const unsigned int parse_full
const unsigned int parse_embed_pcdata
const unsigned int parse_wnorm_attribute
const unsigned int format_indent_attributes
const unsigned int parse_pi
@ status_append_invalid_root
@ status_end_element_mismatch
@ status_bad_start_element
@ status_unrecognized_tag
@ status_no_document_element
const unsigned int format_save_file_text
const unsigned int parse_escapes
const unsigned int format_write_bom
void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate)
const unsigned int format_indent
const unsigned int parse_eol
const unsigned int parse_default
const unsigned int parse_declaration
const unsigned int parse_comments
std::basic_string< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > PUGIXML_FUNCTION as_wide(const char *str)
const unsigned int parse_ws_pcdata
const unsigned int parse_minimal
void *(*)(size_t size) allocation_function
const unsigned int parse_ws_pcdata_single
std::basic_string< PUGIXML_CHAR, std::char_traits< PUGIXML_CHAR >, std::allocator< PUGIXML_CHAR > > string_t
const unsigned int format_no_escapes
const unsigned int parse_doctype
const char * description() const
const char * description() const