14 #ifndef PUGIXML_VERSION
16 # define PUGIXML_VERSION 170
20 #include "mlclient/ext/pugixml/pugiconfig.hpp"
22 #ifndef HEADER_PUGIXML_HPP
23 #define HEADER_PUGIXML_HPP
29 #if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
34 #ifndef PUGIXML_NO_STL
41 #ifndef PUGIXML_DEPRECATED
42 # if defined(__GNUC__)
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 #ifdef PUGIXML_WCHAR_MODE
77 # define PUGIXML_TEXT(t) L ## t
78 # define PUGIXML_CHAR wchar_t
80 # define PUGIXML_TEXT(t) t
81 # define PUGIXML_CHAR char
87 typedef PUGIXML_CHAR char_t;
89 #ifndef PUGIXML_NO_STL
91 typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
116 const unsigned int parse_minimal = 0x0000;
119 const unsigned int parse_pi = 0x0001;
122 const unsigned int parse_comments = 0x0002;
125 const unsigned int parse_cdata = 0x0004;
129 const unsigned int parse_ws_pcdata = 0x0008;
132 const unsigned int parse_escapes = 0x0010;
135 const unsigned int parse_eol = 0x0020;
138 const unsigned int parse_wconv_attribute = 0x0040;
141 const unsigned int parse_wnorm_attribute = 0x0080;
144 const unsigned int parse_declaration = 0x0100;
147 const unsigned int parse_doctype = 0x0200;
152 const unsigned int parse_ws_pcdata_single = 0x0400;
155 const unsigned int parse_trim_pcdata = 0x0800;
159 const unsigned int parse_fragment = 0x1000;
164 const unsigned int parse_embed_pcdata = 0x2000;
169 const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
174 const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
194 const unsigned int format_indent = 0x01;
197 const unsigned int format_write_bom = 0x02;
200 const unsigned int format_raw = 0x04;
203 const unsigned int format_no_declaration = 0x08;
206 const unsigned int format_no_escapes = 0x10;
209 const unsigned int format_save_file_text = 0x20;
212 const unsigned int format_indent_attributes = 0x40;
216 const unsigned int format_default = format_indent;
219 struct xml_attribute_struct;
220 struct xml_node_struct;
222 class xml_node_iterator;
223 class xml_attribute_iterator;
224 class xml_named_node_iterator;
226 class xml_tree_walker;
228 struct xml_parse_result;
234 #ifndef PUGIXML_NO_XPATH
236 class xpath_node_set;
238 class xpath_variable_set;
245 typedef It const_iterator;
252 It begin()
const {
return _begin; }
253 It end()
const {
return _end; }
266 virtual void write(
const void* data,
size_t size) = 0;
276 virtual void write(
const void* data,
size_t size);
282 #ifndef PUGIXML_NO_STL
289 xml_writer_stream(std::basic_ostream<
wchar_t, std::char_traits<wchar_t> >& stream);
291 virtual void write(
const void* data,
size_t size);
294 std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
295 std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
306 xml_attribute_struct* _attr;
318 operator unspecified_bool_type()
const;
321 bool operator!()
const;
335 const char_t* name()
const;
336 const char_t* value()
const;
339 const char_t* as_string(
const char_t* def = PUGIXML_TEXT(
""))
const;
342 int as_int(
int def = 0)
const;
343 unsigned int as_uint(
unsigned int def = 0)
const;
344 double as_double(
double def = 0)
const;
345 float as_float(
float def = 0)
const;
347 #ifdef PUGIXML_HAS_LONG_LONG
348 long long as_llong(
long long def = 0)
const;
349 unsigned long long as_ullong(
unsigned long long def = 0)
const;
353 bool as_bool(
bool def =
false)
const;
356 bool set_name(
const char_t* rhs);
357 bool set_value(
const char_t* rhs);
360 bool set_value(
int rhs);
361 bool set_value(
unsigned int rhs);
362 bool set_value(
long rhs);
363 bool set_value(
unsigned long rhs);
364 bool set_value(
double rhs);
365 bool set_value(
float rhs);
366 bool set_value(
bool rhs);
368 #ifdef PUGIXML_HAS_LONG_LONG
369 bool set_value(
long long rhs);
370 bool set_value(
unsigned long long rhs);
383 #ifdef PUGIXML_HAS_LONG_LONG
393 size_t hash_value()
const;
396 xml_attribute_struct* internal_object()
const;
401 bool PUGIXML_FUNCTION operator&&(
const xml_attribute& lhs,
bool rhs);
402 bool PUGIXML_FUNCTION operator||(
const xml_attribute& lhs,
bool rhs);
413 xml_node_struct* _root;
415 typedef void (*unspecified_bool_type)(
xml_node***);
422 explicit xml_node(xml_node_struct* p);
425 operator unspecified_bool_type()
const;
428 bool operator!()
const;
431 bool operator==(
const xml_node& r)
const;
432 bool operator!=(
const xml_node& r)
const;
433 bool operator<(
const xml_node& r)
const;
434 bool operator>(
const xml_node& r)
const;
435 bool operator<=(
const xml_node& r)
const;
436 bool operator>=(
const xml_node& r)
const;
442 xml_node_type type()
const;
445 const char_t* name()
const;
449 const char_t* value()
const;
473 xml_node child(
const char_t* name)
const;
475 xml_node next_sibling(
const char_t* name)
const;
476 xml_node previous_sibling(
const char_t* name)
const;
482 const char_t* child_value()
const;
485 const char_t* child_value(
const char_t* name)
const;
488 bool set_name(
const char_t* rhs);
489 bool set_value(
const char_t* rhs);
504 xml_node append_child(xml_node_type type = node_element);
505 xml_node prepend_child(xml_node_type type = node_element);
510 xml_node append_child(
const char_t* name);
511 xml_node prepend_child(
const char_t* name);
529 bool remove_attribute(
const char_t* name);
532 bool remove_child(
const xml_node& n);
533 bool remove_child(
const char_t* name);
538 xml_parse_result append_buffer(
const void* contents,
size_t size,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
541 template <
typename Predicate>
xml_attribute find_attribute(Predicate pred)
const
545 for (
xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
553 template <
typename Predicate>
xml_node find_child(Predicate pred)
const
557 for (
xml_node node = first_child(); node; node = node.next_sibling())
565 template <
typename Predicate>
xml_node find_node(Predicate pred)
const
571 while (cur._root && cur._root != _root)
573 if (pred(cur))
return cur;
575 if (cur.first_child()) cur = cur.first_child();
576 else if (cur.next_sibling()) cur = cur.next_sibling();
579 while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
581 if (cur._root != _root) cur = cur.next_sibling();
589 xml_node find_child_by_attribute(
const char_t* name,
const char_t* attr_name,
const char_t* attr_value)
const;
590 xml_node find_child_by_attribute(
const char_t* attr_name,
const char_t* attr_value)
const;
592 #ifndef PUGIXML_NO_STL
594 string_t path(char_t delimiter =
'/')
const;
598 xml_node first_element_by_path(
const char_t* path, char_t delimiter =
'/')
const;
603 #ifndef PUGIXML_NO_XPATH
619 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;
621 #ifndef PUGIXML_NO_STL
623 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;
624 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;
630 iterator begin()
const;
631 iterator end()
const;
636 attribute_iterator attributes_begin()
const;
637 attribute_iterator attributes_end()
const;
645 ptrdiff_t offset_debug()
const;
648 size_t hash_value()
const;
651 xml_node_struct* internal_object()
const;
656 bool PUGIXML_FUNCTION operator&&(
const xml_node& lhs,
bool rhs);
657 bool PUGIXML_FUNCTION operator||(
const xml_node& lhs,
bool rhs);
665 xml_node_struct* _root;
667 typedef void (*unspecified_bool_type)(
xml_text***);
669 explicit xml_text(xml_node_struct* root);
671 xml_node_struct* _data_new();
672 xml_node_struct* _data()
const;
679 operator unspecified_bool_type()
const;
682 bool operator!()
const;
688 const char_t*
get()
const;
691 const char_t* as_string(
const char_t* def = PUGIXML_TEXT(
""))
const;
694 int as_int(
int def = 0)
const;
695 unsigned int as_uint(
unsigned int def = 0)
const;
696 double as_double(
double def = 0)
const;
697 float as_float(
float def = 0)
const;
699 #ifdef PUGIXML_HAS_LONG_LONG
700 long long as_llong(
long long def = 0)
const;
701 unsigned long long as_ullong(
unsigned long long def = 0)
const;
705 bool as_bool(
bool def =
false)
const;
708 bool set(
const char_t* rhs);
712 bool set(
unsigned int rhs);
714 bool set(
unsigned long rhs);
715 bool set(
double rhs);
719 #ifdef PUGIXML_HAS_LONG_LONG
720 bool set(
long long rhs);
721 bool set(
unsigned long long rhs);
725 xml_text& operator=(
const char_t* rhs);
726 xml_text& operator=(
int rhs);
727 xml_text& operator=(
unsigned int rhs);
728 xml_text& operator=(
long rhs);
729 xml_text& operator=(
unsigned long rhs);
730 xml_text& operator=(
double rhs);
731 xml_text& operator=(
float rhs);
732 xml_text& operator=(
bool rhs);
734 #ifdef PUGIXML_HAS_LONG_LONG
735 xml_text& operator=(
long long rhs);
736 xml_text& operator=(
unsigned long long rhs);
745 bool PUGIXML_FUNCTION operator&&(
const xml_text& lhs,
bool rhs);
746 bool PUGIXML_FUNCTION operator||(
const xml_text& lhs,
bool rhs);
762 typedef ptrdiff_t difference_type;
767 #ifndef PUGIXML_NO_STL
768 typedef std::bidirectional_iterator_tag iterator_category;
804 typedef ptrdiff_t difference_type;
809 #ifndef PUGIXML_NO_STL
810 typedef std::bidirectional_iterator_tag iterator_category;
840 typedef ptrdiff_t difference_type;
845 #ifndef PUGIXML_NO_STL
846 typedef std::bidirectional_iterator_tag iterator_category;
896 virtual bool for_each(
xml_node& node) = 0;
903 enum xml_parse_status
907 status_file_not_found,
909 status_out_of_memory,
910 status_internal_error,
912 status_unrecognized_tag,
919 status_bad_start_element,
920 status_bad_attribute,
921 status_bad_end_element,
922 status_end_element_mismatch,
924 status_append_invalid_root,
926 status_no_document_element
933 xml_parse_status status;
939 xml_encoding encoding;
945 operator bool()
const;
948 const char* description()
const;
979 #ifndef PUGIXML_NO_STL
981 xml_parse_result load(std::basic_istream<
char, std::char_traits<char> >& stream,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
982 xml_parse_result load(std::basic_istream<
wchar_t, std::char_traits<wchar_t> >& stream,
unsigned int options = parse_default);
986 xml_parse_result load(
const char_t* contents,
unsigned int options = parse_default);
989 xml_parse_result load_string(
const char_t* contents,
unsigned int options = parse_default);
992 xml_parse_result load_file(
const char* path,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
993 xml_parse_result load_file(
const wchar_t* path,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
996 xml_parse_result load_buffer(
const void* contents,
size_t size,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1000 xml_parse_result load_buffer_inplace(
void* contents,
size_t size,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1004 xml_parse_result load_buffer_inplace_own(
void* contents,
size_t size,
unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1007 void save(
xml_writer& writer,
const char_t* indent = PUGIXML_TEXT(
"\t"),
unsigned int flags = format_default, xml_encoding encoding = encoding_auto)
const;
1009 #ifndef PUGIXML_NO_STL
1011 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;
1012 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;
1016 bool save_file(
const char* path,
const char_t* indent = PUGIXML_TEXT(
"\t"),
unsigned int flags = format_default, xml_encoding encoding = encoding_auto)
const;
1017 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;
1023 #ifndef PUGIXML_NO_XPATH
1025 enum xpath_value_type
1028 xpath_type_node_set,
1047 operator bool()
const;
1050 const char* description()
const;
1059 xpath_value_type _type;
1070 const char_t* name()
const;
1073 xpath_value_type type()
const;
1076 bool get_boolean()
const;
1077 double get_number()
const;
1078 const char_t* get_string()
const;
1082 bool set(
bool value);
1083 bool set(
double value);
1084 bool set(
const char_t* value);
1111 #if __cplusplus >= 201103
1121 bool set(
const char_t* name,
bool value);
1122 bool set(
const char_t* name,
double value);
1123 bool set(
const char_t* name,
const char_t* value);
1138 typedef void (*unspecified_bool_type)(
xpath_query***);
1142 xpath_query& operator=(
const xpath_query&);
1155 #if __cplusplus >= 201103
1157 xpath_query(xpath_query&& rhs);
1158 xpath_query& operator=(xpath_query&& rhs);
1162 xpath_value_type return_type()
const;
1166 bool evaluate_boolean(
const xpath_node& n)
const;
1170 double evaluate_number(
const xpath_node& n)
const;
1172 #ifndef PUGIXML_NO_STL
1175 string_t evaluate_string(
const xpath_node& n)
const;
1182 size_t evaluate_string(char_t* buffer,
size_t capacity,
const xpath_node& n)
const;
1199 operator unspecified_bool_type()
const;
1202 bool operator!()
const;
1205 #ifndef PUGIXML_NO_EXCEPTIONS
1217 virtual const char* what()
const throw();
1231 typedef void (*unspecified_bool_type)(
xpath_node***);
1249 operator unspecified_bool_type()
const;
1252 bool operator!()
const;
1261 bool PUGIXML_FUNCTION operator&&(
const xpath_node& lhs,
bool rhs);
1262 bool PUGIXML_FUNCTION operator||(
const xpath_node& lhs,
bool rhs);
1287 xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
1296 #if __cplusplus >= 201103
1303 type_t type()
const;
1306 size_t size()
const;
1309 const xpath_node& operator[](
size_t index)
const;
1312 const_iterator begin()
const;
1313 const_iterator end()
const;
1316 void sort(
bool reverse =
false);
1332 void _assign(const_iterator begin, const_iterator end, type_t type);
1337 #ifndef PUGIXML_NO_STL
1339 std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(
const wchar_t* str);
1340 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);
1343 std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(
const char* str);
1344 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);
1348 typedef void* (*allocation_function)(
size_t size);
1351 typedef void (*deallocation_function)(
void* ptr);
1354 void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
1357 allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
1358 deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
1361 #if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
1371 #if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
1385 #if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
1386 # define PUGIXML_SOURCE "pugixml.cpp"
1387 # include PUGIXML_SOURCE
Definition: pugixml.hpp:284
Definition: pugixml.hpp:270
Definition: pugixml.hpp:750
Definition: pugixml.hpp:792
Definition: pugixml.hpp:661
Definition: pugixml.hpp:1132
Definition: pugixml.hpp:952
Definition: pugixml.hpp:1035
Definition: pugixml.hpp:1054
Definition: pugixml.hpp:930
Definition: pugixml.hpp:1266
Definition: pugixml.hpp:1207
Definition: pugixml.hpp:406
Definition: pugixml.hpp:877
Definition: pugixml.hpp:300
Definition: pugixml.hpp:260
Definition: pugixml.hpp:84
Definition: pugixml.hpp:242
Definition: pugixml.hpp:1225
Definition: pugixml.hpp:1089
Definition: pugixml.hpp:834