14#ifndef PUGIXML_VERSION
16# define PUGIXML_VERSION 190
22#ifndef HEADER_PUGIXML_HPP
23#define HEADER_PUGIXML_HPP
29#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
41#ifndef PUGIXML_DEPRECATED
43# define PUGIXML_DEPRECATED __attribute__((deprecated))
44# elif defined(_MSC_VER) && _MSC_VER >= 1300
45# define PUGIXML_DEPRECATED __declspec(deprecated)
47# define PUGIXML_DEPRECATED
58# define PUGIXML_CLASS PUGIXML_API
62#ifndef PUGIXML_FUNCTION
63# define PUGIXML_FUNCTION PUGIXML_API
67#ifndef PUGIXML_HAS_LONG_LONG
68# if __cplusplus >= 201103
69# define PUGIXML_HAS_LONG_LONG
70# elif defined(_MSC_VER) && _MSC_VER >= 1400
71# define PUGIXML_HAS_LONG_LONG
76#ifndef PUGIXML_HAS_MOVE
77# if __cplusplus >= 201103
78# define PUGIXML_HAS_MOVE
79# elif defined(_MSC_VER) && _MSC_VER >= 1600
80# define PUGIXML_HAS_MOVE
85#define PUGIXML_NOEXCEPT
88#ifndef PUGIXML_NOEXCEPT
89# if __cplusplus >= 201103
90# define PUGIXML_NOEXCEPT noexcept
91# elif defined(_MSC_VER) && _MSC_VER >= 1900
92# define PUGIXML_NOEXCEPT noexcept
94# define PUGIXML_NOEXCEPT
100# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
102# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT PUGIXML_NOEXCEPT
106#ifndef PUGIXML_OVERRIDE
107# if __cplusplus >= 201103
108# define PUGIXML_OVERRIDE override
109# elif defined(_MSC_VER) && _MSC_VER >= 1700
110# define PUGIXML_OVERRIDE override
112# define PUGIXML_OVERRIDE
117#ifdef PUGIXML_WCHAR_MODE
118# define PUGIXML_TEXT(t) L ## t
119# define PUGIXML_CHAR wchar_t
121# define PUGIXML_TEXT(t) t
122# define PUGIXML_CHAR char
130#ifndef PUGIXML_NO_STL
132 typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> >
string_t;
278 #ifndef PUGIXML_NO_XPATH
310 virtual void write(
const void* data,
size_t size) = 0;
326 #ifndef PUGIXML_NO_STL
333 xml_writer_stream(std::basic_ostream<
wchar_t, std::char_traits<wchar_t> >& stream);
339 std::basic_ostream<wchar_t, std::char_traits<wchar_t> >*
wide_stream;
386 int as_int(
int def = 0)
const;
387 unsigned int as_uint(
unsigned int def = 0)
const;
389 float as_float(
float def = 0)
const;
391 #ifdef PUGIXML_HAS_LONG_LONG
392 long long as_llong(
long long def = 0)
const;
393 unsigned long long as_ullong(
unsigned long long def = 0)
const;
397 bool as_bool(
bool def =
false)
const;
412 #ifdef PUGIXML_HAS_LONG_LONG
427 #ifdef PUGIXML_HAS_LONG_LONG
617 if (pred(cur))
return cur;
636 #ifndef PUGIXML_NO_STL
647 #ifndef PUGIXML_NO_XPATH
665 #ifndef PUGIXML_NO_STL
668 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;
738 int as_int(
int def = 0)
const;
739 unsigned int as_uint(
unsigned int def = 0)
const;
741 float as_float(
float def = 0)
const;
743 #ifdef PUGIXML_HAS_LONG_LONG
744 long long as_llong(
long long def = 0)
const;
745 unsigned long long as_ullong(
unsigned long long def = 0)
const;
749 bool as_bool(
bool def =
false)
const;
756 bool set(
unsigned int rhs);
758 bool set(
unsigned long rhs);
759 bool set(
double rhs);
763 #ifdef PUGIXML_HAS_LONG_LONG
764 bool set(
long long rhs);
765 bool set(
unsigned long long rhs);
778 #ifdef PUGIXML_HAS_LONG_LONG
811 #ifndef PUGIXML_NO_STL
853 #ifndef PUGIXML_NO_STL
889 #ifndef PUGIXML_NO_STL
989 operator bool()
const;
1018 #ifdef PUGIXML_HAS_MOVE
1030 #ifndef PUGIXML_NO_STL
1060 #ifndef PUGIXML_NO_STL
1074#ifndef PUGIXML_NO_XPATH
1098 operator bool()
const;
1133 bool set(
bool value);
1134 bool set(
double value);
1162 #ifdef PUGIXML_HAS_MOVE
1172 bool set(
const char_t* name,
bool value);
1173 bool set(
const char_t* name,
double value);
1206 #ifdef PUGIXML_HAS_MOVE
1223 #ifndef PUGIXML_NO_STL
1256 #ifndef PUGIXML_NO_EXCEPTIONS
1347 #ifdef PUGIXML_HAS_MOVE
1357 size_t size()
const;
1388#ifndef PUGIXML_NO_STL
1390 std::basic_string<char, std::char_traits<char>, std::allocator<char> >
PUGIXML_FUNCTION as_utf8(
const wchar_t* str);
1391 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);
1394 std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
PUGIXML_FUNCTION as_wide(
const char* str);
1395 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);
1399 typedef void* (*allocation_function)(
size_t size);
1412#if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
1422#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
1426 std::bidirectional_iterator_tag
PUGIXML_FUNCTION __iterator_category(
const pugi::xml_node_iterator&);
1427 std::bidirectional_iterator_tag
PUGIXML_FUNCTION __iterator_category(
const pugi::xml_attribute_iterator&);
1428 std::bidirectional_iterator_tag
PUGIXML_FUNCTION __iterator_category(
const pugi::xml_named_node_iterator&);
1436#if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
1437# define PUGIXML_SOURCE "pugixml.cpp"
1438# include PUGIXML_SOURCE
ptrdiff_t difference_type
bool operator!=(const xml_attribute_iterator &rhs) const
xml_attribute_iterator(xml_attribute_struct *ref, xml_node_struct *parent)
const xml_attribute_iterator & operator--()
xml_attribute * operator->() const
std::bidirectional_iterator_tag iterator_category
xml_attribute & operator*() const
bool operator==(const xml_attribute_iterator &rhs) const
xml_attribute & reference
const xml_attribute_iterator & operator++()
const char_t * as_string(const char_t *def=PUGIXML_TEXT("")) const
bool operator>=(const xml_attribute &r) const
bool as_bool(bool def=false) const
bool operator!=(const xml_attribute &r) const
bool operator<(const xml_attribute &r) const
int as_int(int def=0) const
float as_float(float def=0) const
bool operator==(const xml_attribute &r) const
size_t hash_value() const
void(*) unspecified_bool_type(xml_attribute ***)
const char_t * name() const
xml_attribute & operator=(const char_t *rhs)
xml_attribute previous_attribute() const
xml_attribute_struct * _attr
xml_attribute next_attribute() const
bool operator<=(const xml_attribute &r) const
double as_double(double def=0) const
bool set_name(const char_t *rhs)
friend class xml_attribute_iterator
bool set_value(const char_t *rhs)
unsigned int as_uint(unsigned int def=0) const
xml_attribute_struct * internal_object() const
bool operator>(const xml_attribute &r) const
const char_t * value() const
xml_parse_result load_buffer_inplace(void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_document(const xml_document &)
xml_node document_element() const
xml_parse_result load_string(const char_t *contents, unsigned int options=parse_default)
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_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_buffer(const void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
xml_document & operator=(const xml_document &)
xml_parse_result load(std::basic_istream< char, std::char_traits< char > > &stream, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
void save(xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
void _move(xml_document &rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT
xml_named_node_iterator()
ptrdiff_t difference_type
bool operator!=(const xml_named_node_iterator &rhs) const
xml_node * operator->() const
const xml_named_node_iterator & operator--()
std::bidirectional_iterator_tag iterator_category
bool operator==(const xml_named_node_iterator &rhs) const
xml_node & operator*() const
const xml_named_node_iterator & operator++()
xml_node_iterator(xml_node_struct *ref, xml_node_struct *parent)
bool operator==(const xml_node_iterator &rhs) const
const xml_node_iterator & operator--()
xml_node * operator->() const
bool operator!=(const xml_node_iterator &rhs) const
std::bidirectional_iterator_tag iterator_category
const xml_node_iterator & operator++()
ptrdiff_t difference_type
xml_node & operator*() const
string_t path(char_t delimiter='/') const
size_t hash_value() const
bool set_value(const char_t *rhs)
xml_node_type type() const
xml_node append_child(xml_node_type type=node_element)
xml_node child(const char_t *name) const
friend class xml_named_node_iterator
xml_node insert_move_after(const xml_node &moved, const xml_node &node)
xml_node last_child() const
xml_node append_move(const xml_node &moved)
xml_node first_child() const
bool operator>(const xml_node &r) const
xml_object_range< xml_node_iterator > children() const
xml_node prepend_move(const xml_node &moved)
xml_attribute append_attribute(const char_t *name)
xml_node next_sibling() const
xml_node_struct * internal_object() const
xml_attribute find_attribute(Predicate pred) const
xml_object_range< xml_attribute_iterator > attributes() const
bool remove_child(const xml_node &n)
xml_attribute append_copy(const xml_attribute &proto)
xml_node insert_child_after(xml_node_type type, const xml_node &node)
xml_attribute last_attribute() const
attribute_iterator attributes_end() const
xml_node previous_sibling() const
ptrdiff_t offset_debug() const
xml_attribute insert_attribute_before(const char_t *name, const xml_attribute &attr)
xml_attribute insert_attribute_after(const char_t *name, const xml_attribute &attr)
bool operator!=(const xml_node &r) const
bool operator<(const xml_node &r) const
xml_attribute prepend_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)
const char_t * value() const
xml_node find_node(Predicate pred) const
xml_attribute_iterator attribute_iterator
const char_t * child_value() const
bool set_name(const char_t *rhs)
xml_node prepend_child(xml_node_type type=node_element)
friend class xml_node_iterator
xml_attribute first_attribute() const
bool operator>=(const xml_node &r) const
void(*) unspecified_bool_type(xml_node ***)
xml_attribute insert_copy_after(const xml_attribute &proto, const xml_attribute &attr)
xml_attribute prepend_copy(const xml_attribute &proto)
xml_node insert_move_before(const xml_node &moved, const xml_node &node)
xml_attribute attribute(const char_t *name) const
const char_t * name() const
xml_attribute insert_copy_before(const xml_attribute &proto, const xml_attribute &attr)
attribute_iterator attributes_begin() const
xml_node find_child(Predicate pred) const
xml_node_iterator iterator
bool operator<=(const xml_node &r) const
bool remove_attribute(const xml_attribute &a)
friend class xml_attribute_iterator
xml_node insert_child_before(xml_node_type type, const xml_node &node)
bool operator==(const xml_node &r) const
xml_object_range(It b, It e)
const char_t * as_string(const char_t *def=PUGIXML_TEXT("")) const
double as_double(double def=0) const
xml_text & operator=(const char_t *rhs)
float as_float(float def=0) const
xml_node_struct * _data_new()
bool as_bool(bool def=false) const
bool set(const char_t *rhs)
xml_text(xml_node_struct *root)
int as_int(int def=0) const
unsigned int as_uint(unsigned int def=0) const
void(*) unspecified_bool_type(xml_text ***)
const char_t * get() const
xml_node_struct * _data() const
virtual bool end(xml_node &node)
virtual bool for_each(xml_node &node)=0
virtual bool begin(xml_node &node)
xml_writer_file(void *file)
virtual void write(const void *data, size_t size) PUGIXML_OVERRIDE
xml_writer_stream(std::basic_ostream< char, std::char_traits< char > > &stream)
std::basic_ostream< wchar_t, std::char_traits< wchar_t > > * wide_stream
virtual void write(const void *data, size_t size) PUGIXML_OVERRIDE
std::basic_ostream< char, std::char_traits< char > > * narrow_stream
virtual void write(const void *data, size_t size)=0
const xpath_parse_result & result() const
xpath_exception(const xpath_parse_result &result)
virtual const char * what() const noexcept PUGIXML_OVERRIDE
xpath_parse_result _result
xpath_node_set & operator=(const xpath_node_set &ns)
void _assign(const_iterator begin, const_iterator end, type_t type)
const_iterator end() const
const xpath_node * const_iterator
void sort(bool reverse=false)
const_iterator begin() const
const xpath_node * iterator
const xpath_node & operator[](size_t index) const
void _move(xpath_node_set &rhs) PUGIXML_NOEXCEPT
xml_attribute attribute() const
void(*) unspecified_bool_type(xpath_node ***)
bool operator!=(const xpath_node &n) const
bool operator==(const xpath_node &n) const
string_t evaluate_string(const xpath_node &n) const
void(*) unspecified_bool_type(xpath_query ***)
double evaluate_number(const xpath_node &n) const
xpath_node_set evaluate_node_set(const xpath_node &n) const
xpath_value_type return_type() const
xpath_parse_result _result
xpath_query & operator=(const xpath_query &)
xpath_query(const xpath_query &)
const xpath_parse_result & result() const
bool evaluate_boolean(const xpath_node &n) const
xpath_node evaluate_node(const xpath_node &n) const
xpath_variable * add(const char_t *name, xpath_value_type type)
void _swap(xpath_variable_set &rhs)
bool set(const char_t *name, bool value)
void _assign(const xpath_variable_set &rhs)
static void _destroy(xpath_variable *var)
static bool _clone(xpath_variable *var, xpath_variable **out_result)
xpath_variable * get(const char_t *name)
xpath_variable * _data[64]
xpath_variable * _find(const char_t *name) const
xpath_variable_set & operator=(const xpath_variable_set &rhs)
xpath_variable(xpath_value_type type)
xpath_variable(const xpath_variable &)
double get_number() const
const char_t * get_string() const
const xpath_node_set & get_node_set() const
xpath_variable & operator=(const xpath_variable &)
xpath_value_type type() const
const char_t * name() const
friend class xpath_variable_set
const unsigned int format_no_empty_element_tags
std::basic_string< PUGIXML_CHAR, std::char_traits< PUGIXML_CHAR >, std::allocator< PUGIXML_CHAR > > string_t
PUGI__FN deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function()
PUGI__FN 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
PUGI__FN std::string 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
PUGI__FN 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
PUGI__FN std::basic_string< wchar_t > PUGIXML_FUNCTION as_wide(const char *str)
const unsigned int parse_ws_pcdata
const unsigned int parse_minimal
const unsigned int parse_ws_pcdata_single
const unsigned int format_no_escapes
void *(*) allocation_function(size_t size)
void(*) deallocation_function(void *ptr)
const unsigned int parse_doctype
void reverse(I begin, I end)
allocation_function xml_memory_management_function_storage< T >::allocate
deallocation_function xml_memory_management_function_storage< T >::deallocate
#define PUGIXML_DEPRECATED
#define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
const char * description() const
const char * description() const