Animación Vulkan 1.0
Animación de tiro libre baloncesto con motor gráfico desarrollado en clase
Cargando...
Buscando...
Nada coincide
pugixml.hpp
Ir a la documentación de este archivo.
1
11
12// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
13// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
14#ifndef PUGIXML_VERSION
15# define PUGIXML_VERSION 1150 // 1.15
16#endif
17
18// Include user configuration file (this can define various configuration macros)
19#include "pugiconfig.hpp"
20
21#ifndef HEADER_PUGIXML_HPP
22#define HEADER_PUGIXML_HPP
23
24// Include stddef.h for size_t and ptrdiff_t
25#include <stddef.h>
26
27// Include exception header for XPath
28#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
29# include <exception>
30#endif
31
32// Include STL headers
33#ifndef PUGIXML_NO_STL
34# include <iterator>
35# include <iosfwd>
36# include <string>
37#endif
38
39// Check if std::string_view is available
40#if !defined(PUGIXML_HAS_STRING_VIEW) && !defined(PUGIXML_NO_STL)
41# if __cplusplus >= 201703L
42# define PUGIXML_HAS_STRING_VIEW
43# elif defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
44# define PUGIXML_HAS_STRING_VIEW
45# endif
46#endif
47
48// Include string_view if appropriate
49#ifdef PUGIXML_HAS_STRING_VIEW
50# include <string_view>
51#endif
52
53// Macro for deprecated features
54#ifndef PUGIXML_DEPRECATED
55# if defined(__GNUC__)
56# define PUGIXML_DEPRECATED __attribute__((deprecated))
57# elif defined(_MSC_VER) && _MSC_VER >= 1300
58# define PUGIXML_DEPRECATED __declspec(deprecated)
59# else
60# define PUGIXML_DEPRECATED
61# endif
62#endif
63
64// If no API is defined, assume default
65#ifndef PUGIXML_API
66# define PUGIXML_API
67#endif
68
69// If no API for classes is defined, assume default
70#ifndef PUGIXML_CLASS
71# define PUGIXML_CLASS PUGIXML_API
72#endif
73
74// If no API for functions is defined, assume default
75#ifndef PUGIXML_FUNCTION
76# define PUGIXML_FUNCTION PUGIXML_API
77#endif
78
79// If the platform is known to have long long support, enable long long functions
80#ifndef PUGIXML_HAS_LONG_LONG
81# if __cplusplus >= 201103
82# define PUGIXML_HAS_LONG_LONG
83# elif defined(_MSC_VER) && _MSC_VER >= 1400
84# define PUGIXML_HAS_LONG_LONG
85# endif
86#endif
87
88// If the platform is known to have move semantics support, compile move ctor/operator implementation
89#ifndef PUGIXML_HAS_MOVE
90# if __cplusplus >= 201103
91# define PUGIXML_HAS_MOVE
92# elif defined(_MSC_VER) && _MSC_VER >= 1600
93# define PUGIXML_HAS_MOVE
94# endif
95#endif
96
97// If C++ is 2011 or higher, use 'noexcept' specifiers
98#ifndef PUGIXML_NOEXCEPT
99# if __cplusplus >= 201103
100# define PUGIXML_NOEXCEPT noexcept
101# elif defined(_MSC_VER) && _MSC_VER >= 1900
102# define PUGIXML_NOEXCEPT noexcept
103# else
104# define PUGIXML_NOEXCEPT throw()
105# endif
106#endif
107
108// Some functions can not be noexcept in compact mode
109#ifdef PUGIXML_COMPACT
110# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
111#else
112# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT PUGIXML_NOEXCEPT
113#endif
114
115// If C++ is 2011 or higher, add 'override' qualifiers
116#ifndef PUGIXML_OVERRIDE
117# if __cplusplus >= 201103
118# define PUGIXML_OVERRIDE override
119# elif defined(_MSC_VER) && _MSC_VER >= 1700
120# define PUGIXML_OVERRIDE override
121# else
122# define PUGIXML_OVERRIDE
123# endif
124#endif
125
126// If C++ is 2011 or higher, use 'nullptr'
127#ifndef PUGIXML_NULL
128# if __cplusplus >= 201103
129# define PUGIXML_NULL nullptr
130# elif defined(_MSC_VER) && _MSC_VER >= 1600
131# define PUGIXML_NULL nullptr
132# else
133# define PUGIXML_NULL 0
134# endif
135#endif
136
137// Character interface macros
138#ifdef PUGIXML_WCHAR_MODE
139# define PUGIXML_TEXT(t) L ## t
140# define PUGIXML_CHAR wchar_t
141#else
142# define PUGIXML_TEXT(t) t
143# define PUGIXML_CHAR char
144#endif
145
146namespace pugi
147{
148 // Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
150
151#ifndef PUGIXML_NO_STL
152 // String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
153 typedef std::basic_string<PUGIXML_CHAR> string_t;
154#endif
155
156#ifdef PUGIXML_HAS_STRING_VIEW
157 // String view type used for operations that can work with a length delimited string; depends on PUGIXML_WCHAR_MODE
158 typedef std::basic_string_view<PUGIXML_CHAR> string_view_t;
159#endif
160}
161
162// The PugiXML namespace
163namespace pugi
164{
165 // Tree node types
167 {
168 node_null, // Empty (null) node handle
169 node_document, // A document tree's absolute root
170 node_element, // Element tag, i.e. '<node/>'
171 node_pcdata, // Plain character data, i.e. 'text'
172 node_cdata, // Character data, i.e. '<![CDATA[text]]>'
173 node_comment, // Comment tag, i.e. '<!-- text -->'
174 node_pi, // Processing instruction, i.e. '<?name?>'
175 node_declaration, // Document declaration, i.e. '<?xml version="1.0"?>'
176 node_doctype // Document type declaration, i.e. '<!DOCTYPE doc>'
177 };
178
179 // Parsing options
180
181 // Minimal parsing mode (equivalent to turning all other flags off).
182 // Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
183 const unsigned int parse_minimal = 0x0000;
184
185 // This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
186 const unsigned int parse_pi = 0x0001;
187
188 // This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
189 const unsigned int parse_comments = 0x0002;
190
191 // This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
192 const unsigned int parse_cdata = 0x0004;
193
194 // This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
195 // This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
196 const unsigned int parse_ws_pcdata = 0x0008;
197
198 // This flag determines if character and entity references are expanded during parsing. This flag is on by default.
199 const unsigned int parse_escapes = 0x0010;
200
201 // This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
202 const unsigned int parse_eol = 0x0020;
203
204 // This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
205 const unsigned int parse_wconv_attribute = 0x0040;
206
207 // This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
208 const unsigned int parse_wnorm_attribute = 0x0080;
209
210 // This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
211 const unsigned int parse_declaration = 0x0100;
212
213 // This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
214 const unsigned int parse_doctype = 0x0200;
215
216 // This flag determines if plain character data (node_pcdata) that is the only child of the parent node and that consists only
217 // of whitespace is added to the DOM tree.
218 // This flag is off by default; turning it on may result in slower parsing and more memory consumption.
219 const unsigned int parse_ws_pcdata_single = 0x0400;
220
221 // This flag determines if leading and trailing whitespace is to be removed from plain character data. This flag is off by default.
222 const unsigned int parse_trim_pcdata = 0x0800;
223
224 // This flag determines if plain character data that does not have a parent node is added to the DOM tree, and if an empty document
225 // is a valid document. This flag is off by default.
226 const unsigned int parse_fragment = 0x1000;
227
228 // This flag determines if plain character data is be stored in the parent element's value. This significantly changes the structure of
229 // the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments.
230 // This flag is off by default.
231 const unsigned int parse_embed_pcdata = 0x2000;
232
233 // This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
234 // This flag is off by default.
235 const unsigned int parse_merge_pcdata = 0x4000;
236
237 // The default parsing mode.
238 // Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
239 // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
241
242 // The full parsing mode.
243 // Nodes of all types are added to the DOM tree, character/reference entities are expanded,
244 // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
246
247 // These flags determine the encoding of input data for XML document
249 {
250 encoding_auto, // Auto-detect input encoding using BOM or < / <? detection; use UTF8 if BOM is not found
251 encoding_utf8, // UTF8 encoding
252 encoding_utf16_le, // Little-endian UTF16
253 encoding_utf16_be, // Big-endian UTF16
254 encoding_utf16, // UTF16 with native endianness
255 encoding_utf32_le, // Little-endian UTF32
256 encoding_utf32_be, // Big-endian UTF32
257 encoding_utf32, // UTF32 with native endianness
258 encoding_wchar, // The same encoding wchar_t has (either UTF16 or UTF32)
260 };
261
262 // Formatting flags
263
264 // Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
265 const unsigned int format_indent = 0x01;
266
267 // Write encoding-specific BOM to the output stream. This flag is off by default.
268 const unsigned int format_write_bom = 0x02;
269
270 // Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
271 const unsigned int format_raw = 0x04;
272
273 // Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
274 const unsigned int format_no_declaration = 0x08;
275
276 // Don't escape attribute values and PCDATA contents. This flag is off by default.
277 const unsigned int format_no_escapes = 0x10;
278
279 // Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
280 const unsigned int format_save_file_text = 0x20;
281
282 // Write every attribute on a new line with appropriate indentation. This flag is off by default.
283 const unsigned int format_indent_attributes = 0x40;
284
285 // Don't output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
286 const unsigned int format_no_empty_element_tags = 0x80;
287
288 // Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
289 const unsigned int format_skip_control_chars = 0x100;
290
291 // Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
292 const unsigned int format_attribute_single_quote = 0x200;
293
294 // The default set of formatting flags.
295 // Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
296 const unsigned int format_default = format_indent;
297
300
301 // Forward declarations
303 struct xml_node_struct;
304
305 class xml_node_iterator;
308
309 class xml_tree_walker;
310
311 struct xml_parse_result;
312
313 class xml_node;
314
315 class xml_text;
316
317 #ifndef PUGIXML_NO_XPATH
318 class xpath_node;
319 class xpath_node_set;
320 class xpath_query;
321 class xpath_variable_set;
322 #endif
323
324 // Range-based for loop support
325 template <typename It> class xml_object_range
326 {
327 public:
328 typedef It const_iterator;
329 typedef It iterator;
330
331 xml_object_range(It b, It e): _begin(b), _end(e)
332 {
333 }
334
335 It begin() const { return _begin; }
336 It end() const { return _end; }
337
338 bool empty() const { return _begin == _end; }
339
340 private:
342 };
343
344 // Writer interface for node printing (see xml_node::print)
346 {
347 public:
348 virtual ~xml_writer();
349
350 // Write memory chunk into stream/file/whatever
351 virtual void write(const void* data, size_t size) = 0;
352 };
353
354 // xml_writer implementation for FILE*
356 {
357 public:
358 // Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
359 xml_writer_file(void* file);
360
361 virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
362
363 private:
364 void* file;
365 };
366
367 #ifndef PUGIXML_NO_STL
368 // xml_writer implementation for streams
370 {
371 public:
372 // Construct writer from an output stream object
373 xml_writer_stream(std::basic_ostream<char>& stream);
374 xml_writer_stream(std::basic_ostream<wchar_t>& stream);
375
376 virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
377
378 private:
379 std::basic_ostream<char>* narrow_stream;
380 std::basic_ostream<wchar_t>* wide_stream;
381 };
382 #endif
383
384 // A light-weight handle for manipulating attributes in DOM tree
386 {
388 friend class xml_node;
389
390 private:
392
394
395 public:
396 // Default constructor. Constructs an empty attribute.
398
399 // Constructs attribute from internal pointer
400 explicit xml_attribute(xml_attribute_struct* attr);
401
402 // Safe bool conversion operator
403 operator unspecified_bool_type() const;
404
405 // Borland C++ workaround
406 bool operator!() const;
407
408 // Comparison operators (compares wrapped attribute pointers)
409 bool operator==(const xml_attribute& r) const;
410 bool operator!=(const xml_attribute& r) const;
411 bool operator<(const xml_attribute& r) const;
412 bool operator>(const xml_attribute& r) const;
413 bool operator<=(const xml_attribute& r) const;
414 bool operator>=(const xml_attribute& r) const;
415
416 // Check if attribute is empty (null)
417 bool empty() const;
418
419 // Get attribute name/value, or "" if attribute is empty
420 const char_t* name() const;
421 const char_t* value() const;
422
423 // Get attribute value, or the default value if attribute is empty
424 const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
425
426 // Get attribute value as a number, or the default value if conversion did not succeed or attribute is empty
427 int as_int(int def = 0) const;
428 unsigned int as_uint(unsigned int def = 0) const;
429 double as_double(double def = 0) const;
430 float as_float(float def = 0) const;
431
432 #ifdef PUGIXML_HAS_LONG_LONG
433 long long as_llong(long long def = 0) const;
434 unsigned long long as_ullong(unsigned long long def = 0) const;
435 #endif
436
437 // Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
438 bool as_bool(bool def = false) const;
439
440 // Set attribute name/value (returns false if attribute is empty or there is not enough memory)
441 bool set_name(const char_t* rhs);
442 bool set_name(const char_t* rhs, size_t size);
443 #ifdef PUGIXML_HAS_STRING_VIEW
444 bool set_name(string_view_t rhs);
445 #endif
446 bool set_value(const char_t* rhs);
447 bool set_value(const char_t* rhs, size_t size);
448 #ifdef PUGIXML_HAS_STRING_VIEW
449 bool set_value(string_view_t rhs);
450 #endif
451
452 // Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
453 bool set_value(int rhs);
454 bool set_value(unsigned int rhs);
455 bool set_value(long rhs);
456 bool set_value(unsigned long rhs);
457 bool set_value(double rhs);
458 bool set_value(double rhs, int precision);
459 bool set_value(float rhs);
460 bool set_value(float rhs, int precision);
461 bool set_value(bool rhs);
462
463 #ifdef PUGIXML_HAS_LONG_LONG
464 bool set_value(long long rhs);
465 bool set_value(unsigned long long rhs);
466 #endif
467
468 // Set attribute value (equivalent to set_value without error checking)
469 xml_attribute& operator=(const char_t* rhs);
470 xml_attribute& operator=(int rhs);
471 xml_attribute& operator=(unsigned int rhs);
472 xml_attribute& operator=(long rhs);
473 xml_attribute& operator=(unsigned long rhs);
474 xml_attribute& operator=(double rhs);
475 xml_attribute& operator=(float rhs);
476 xml_attribute& operator=(bool rhs);
477
478 #ifdef PUGIXML_HAS_STRING_VIEW
479 xml_attribute& operator=(string_view_t rhs);
480 #endif
481
482 #ifdef PUGIXML_HAS_LONG_LONG
483 xml_attribute& operator=(long long rhs);
484 xml_attribute& operator=(unsigned long long rhs);
485 #endif
486
487 // Get next/previous attribute in the attribute list of the parent node
490
491 // Get hash value (unique for handles to the same object)
492 size_t hash_value() const;
493
494 // Get internal pointer
496 };
497
498#ifdef __BORLANDC__
499 // Borland C++ workaround
500 bool PUGIXML_FUNCTION operator&&(const xml_attribute& lhs, bool rhs);
501 bool PUGIXML_FUNCTION operator||(const xml_attribute& lhs, bool rhs);
502#endif
503
504 // A light-weight handle for manipulating nodes in DOM tree
506 {
508 friend class xml_node_iterator;
510
511 protected:
513
514 typedef void (*unspecified_bool_type)(xml_node***);
515
516 public:
517 // Default constructor. Constructs an empty node.
518 xml_node();
519
520 // Constructs node from internal pointer
521 explicit xml_node(xml_node_struct* p);
522
523 // Safe bool conversion operator
524 operator unspecified_bool_type() const;
525
526 // Borland C++ workaround
527 bool operator!() const;
528
529 // Comparison operators (compares wrapped node pointers)
530 bool operator==(const xml_node& r) const;
531 bool operator!=(const xml_node& r) const;
532 bool operator<(const xml_node& r) const;
533 bool operator>(const xml_node& r) const;
534 bool operator<=(const xml_node& r) const;
535 bool operator>=(const xml_node& r) const;
536
537 // Check if node is empty (null)
538 bool empty() const;
539
540 // Get node type
541 xml_node_type type() const;
542
543 // Get node name, or "" if node is empty or it has no name
544 const char_t* name() const;
545
546 // Get node value, or "" if node is empty or it has no value
547 // Note: For <node>text</node> node.value() does not return "text"! Use child_value() or text() methods to access text inside nodes.
548 const char_t* value() const;
549
550 // Get attribute list
553
554 // Get children list
555 xml_node first_child() const;
556 xml_node last_child() const;
557
558 // Get next/previous sibling in the children list of the parent node
559 xml_node next_sibling() const;
561
562 // Get parent node
563 xml_node parent() const;
564
565 // Get root of DOM tree this node belongs to
566 xml_node root() const;
567
568 // Get text object for the current node
569 xml_text text() const;
570
571 // Get child, attribute or next/previous sibling with the specified name
572 xml_node child(const char_t* name) const;
573 xml_attribute attribute(const char_t* name) const;
574 xml_node next_sibling(const char_t* name) const;
575 xml_node previous_sibling(const char_t* name) const;
576 #ifdef PUGIXML_HAS_STRING_VIEW
577 xml_node child(string_view_t name) const;
578 xml_attribute attribute(string_view_t name) const;
579 xml_node next_sibling(string_view_t name) const;
580 xml_node previous_sibling(string_view_t name) const;
581 #endif
582
583 // Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
584 xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
585 #ifdef PUGIXML_HAS_STRING_VIEW
586 xml_attribute attribute(string_view_t name, xml_attribute& hint) const;
587 #endif
588
589 // Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
590 const char_t* child_value() const;
591
592 // Get child value of child with specified name. Equivalent to child(name).child_value().
593 const char_t* child_value(const char_t* name) const;
594
595 // Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
596 bool set_name(const char_t* rhs);
597 bool set_name(const char_t* rhs, size_t size);
598 #ifdef PUGIXML_HAS_STRING_VIEW
599 bool set_name(string_view_t rhs);
600 #endif
601 bool set_value(const char_t* rhs);
602 bool set_value(const char_t* rhs, size_t size);
603 #ifdef PUGIXML_HAS_STRING_VIEW
604 bool set_value(string_view_t rhs);
605 #endif
606
607 // Add attribute with specified name. Returns added attribute, or empty attribute on errors.
612 #ifdef PUGIXML_HAS_STRING_VIEW
613 xml_attribute append_attribute(string_view_t name);
614 xml_attribute prepend_attribute(string_view_t name);
615 xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr);
616 xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr);
617 #endif
618
619 // Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
624
625 // Add child node with specified type. Returns added node, or empty node on errors.
630
631 // Add child element with specified name. Returns added node, or empty node on errors.
634 xml_node insert_child_after(const char_t* name, const xml_node& node);
635 xml_node insert_child_before(const char_t* name, const xml_node& node);
636 #ifdef PUGIXML_HAS_STRING_VIEW
637 xml_node append_child(string_view_t name);
638 xml_node prepend_child(string_view_t name);
639 xml_node insert_child_after(string_view_t, const xml_node& node);
640 xml_node insert_child_before(string_view_t name, const xml_node& node);
641 #endif
642
643 // Add a copy of the specified node as a child. Returns added node, or empty node on errors.
644 xml_node append_copy(const xml_node& proto);
645 xml_node prepend_copy(const xml_node& proto);
646 xml_node insert_copy_after(const xml_node& proto, const xml_node& node);
647 xml_node insert_copy_before(const xml_node& proto, const xml_node& node);
648
649 // Move the specified node to become a child of this node. Returns moved node, or empty node on errors.
650 xml_node append_move(const xml_node& moved);
651 xml_node prepend_move(const xml_node& moved);
652 xml_node insert_move_after(const xml_node& moved, const xml_node& node);
653 xml_node insert_move_before(const xml_node& moved, const xml_node& node);
654
655 // Remove specified attribute
656 bool remove_attribute(const xml_attribute& a);
657 bool remove_attribute(const char_t* name);
658 #ifdef PUGIXML_HAS_STRING_VIEW
659 bool remove_attribute(string_view_t name);
660 #endif
661
662 // Remove all attributes
663 bool remove_attributes();
664
665 // Remove specified child
666 bool remove_child(const xml_node& n);
667 bool remove_child(const char_t* name);
668 #ifdef PUGIXML_HAS_STRING_VIEW
669 bool remove_child(string_view_t name);
670 #endif
671
672 // Remove all children
673 bool remove_children();
674
675 // Parses buffer as an XML document fragment and appends all nodes as children of the current node.
676 // Copies/converts the buffer, so it may be deleted or changed after the function returns.
677 // Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
678 xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
679
680 // Find attribute using predicate. Returns first attribute for which predicate returned true.
681 template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
682 {
683 if (!_root) return xml_attribute();
684
685 for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
686 if (pred(attrib))
687 return attrib;
688
689 return xml_attribute();
690 }
691
692 // Find child node using predicate. Returns first child for which predicate returned true.
693 template <typename Predicate> xml_node find_child(Predicate pred) const
694 {
695 if (!_root) return xml_node();
696
697 for (xml_node node = first_child(); node; node = node.next_sibling())
698 if (pred(node))
699 return node;
700
701 return xml_node();
702 }
703
704 // Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
705 template <typename Predicate> xml_node find_node(Predicate pred) const
706 {
707 if (!_root) return xml_node();
708
709 xml_node cur = first_child();
710
711 while (cur._root && cur._root != _root)
712 {
713 if (pred(cur)) return cur;
714
715 if (cur.first_child()) cur = cur.first_child();
716 else if (cur.next_sibling()) cur = cur.next_sibling();
717 else
718 {
719 while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
720
721 if (cur._root != _root) cur = cur.next_sibling();
722 }
723 }
724
725 return xml_node();
726 }
727
728 // Find child node by attribute name/value
729 xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
730 xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
731
732 #ifndef PUGIXML_NO_STL
733 // Get the absolute node path from root as a text string.
734 string_t path(char_t delimiter = '/') const;
735 #endif
736
737 // Search for a node by path consisting of node names and . or .. elements.
738 xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
739
740 // Recursively traverse subtree with xml_tree_walker
741 bool traverse(xml_tree_walker& walker);
742
743 #ifndef PUGIXML_NO_XPATH
744 // Select single node by evaluating XPath query. Returns first node from the resulting node set.
745 xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
746 xpath_node select_node(const xpath_query& query) const;
747
748 // Select node set by evaluating XPath query
749 xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
750 xpath_node_set select_nodes(const xpath_query& query) const;
751
752 // (deprecated: use select_node instead) Select single node by evaluating XPath query.
753 PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
754 PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
755
756 #endif
757
758 // Print subtree using a writer object
759 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;
760
761 #ifndef PUGIXML_NO_STL
762 // Print subtree to stream
763 void print(std::basic_ostream<char>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
764 void print(std::basic_ostream<wchar_t>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
765 #endif
766
767 // Child nodes iterators
769
770 iterator begin() const;
771 iterator end() const;
772
773 // Attribute iterators
775
778
779 // Range-based for support
782
783 // Range-based for support for all children with the specified name
784 // Note: name pointer must have a longer lifetime than the returned object; be careful with passing temporaries!
786
787 // Get node offset in parsed file/string (in char_t units) for debugging purposes
788 ptrdiff_t offset_debug() const;
789
790 // Get hash value (unique for handles to the same object)
791 size_t hash_value() const;
792
793 // Get internal pointer
795 };
796
797#ifdef __BORLANDC__
798 // Borland C++ workaround
799 bool PUGIXML_FUNCTION operator&&(const xml_node& lhs, bool rhs);
800 bool PUGIXML_FUNCTION operator||(const xml_node& lhs, bool rhs);
801#endif
802
803 // A helper for working with text inside PCDATA nodes
805 {
806 friend class xml_node;
807
809
810 typedef void (*unspecified_bool_type)(xml_text***);
811
812 explicit xml_text(xml_node_struct* root);
813
815 xml_node_struct* _data() const;
816
817 public:
818 // Default constructor. Constructs an empty object.
819 xml_text();
820
821 // Safe bool conversion operator
822 operator unspecified_bool_type() const;
823
824 // Borland C++ workaround
825 bool operator!() const;
826
827 // Check if text object is empty (null)
828 bool empty() const;
829
830 // Get text, or "" if object is empty
831 const char_t* get() const;
832
833 // Get text, or the default value if object is empty
834 const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
835
836 // Get text as a number, or the default value if conversion did not succeed or object is empty
837 int as_int(int def = 0) const;
838 unsigned int as_uint(unsigned int def = 0) const;
839 double as_double(double def = 0) const;
840 float as_float(float def = 0) const;
841
842 #ifdef PUGIXML_HAS_LONG_LONG
843 long long as_llong(long long def = 0) const;
844 unsigned long long as_ullong(unsigned long long def = 0) const;
845 #endif
846
847 // Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
848 bool as_bool(bool def = false) const;
849
850 // Set text (returns false if object is empty or there is not enough memory)
851 bool set(const char_t* rhs);
852 bool set(const char_t* rhs, size_t size);
853 #ifdef PUGIXML_HAS_STRING_VIEW
854 bool set(string_view_t rhs);
855 #endif
856
857 // Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
858 bool set(int rhs);
859 bool set(unsigned int rhs);
860 bool set(long rhs);
861 bool set(unsigned long rhs);
862 bool set(double rhs);
863 bool set(double rhs, int precision);
864 bool set(float rhs);
865 bool set(float rhs, int precision);
866 bool set(bool rhs);
867
868 #ifdef PUGIXML_HAS_LONG_LONG
869 bool set(long long rhs);
870 bool set(unsigned long long rhs);
871 #endif
872
873 // Set text (equivalent to set without error checking)
874 xml_text& operator=(const char_t* rhs);
875 xml_text& operator=(int rhs);
876 xml_text& operator=(unsigned int rhs);
877 xml_text& operator=(long rhs);
878 xml_text& operator=(unsigned long rhs);
879 xml_text& operator=(double rhs);
880 xml_text& operator=(float rhs);
881 xml_text& operator=(bool rhs);
882
883 #ifdef PUGIXML_HAS_STRING_VIEW
884 xml_text& operator=(string_view_t rhs);
885 #endif
886
887 #ifdef PUGIXML_HAS_LONG_LONG
888 xml_text& operator=(long long rhs);
889 xml_text& operator=(unsigned long long rhs);
890 #endif
891
892 // Get the data node (node_pcdata or node_cdata) for this object
893 xml_node data() const;
894 };
895
896#ifdef __BORLANDC__
897 // Borland C++ workaround
898 bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs);
899 bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs);
900#endif
901
902 // Child node iterator (a bidirectional iterator over a collection of xml_node)
904 {
905 friend class xml_node;
906
907 private:
910
912
913 public:
914 // Iterator traits
915 typedef ptrdiff_t difference_type;
919
920 #ifndef PUGIXML_NO_STL
921 typedef std::bidirectional_iterator_tag iterator_category;
922 #endif
923
924 // Default constructor
926
927 // Construct an iterator which points to the specified node
928 xml_node_iterator(const xml_node& node);
929
930 // Iterator operators
931 bool operator==(const xml_node_iterator& rhs) const;
932 bool operator!=(const xml_node_iterator& rhs) const;
933
934 xml_node& operator*() const;
935 xml_node* operator->() const;
936
939
942 };
943
944 // Attribute iterator (a bidirectional iterator over a collection of xml_attribute)
946 {
947 friend class xml_node;
948
949 private:
952
954
955 public:
956 // Iterator traits
957 typedef ptrdiff_t difference_type;
961
962 #ifndef PUGIXML_NO_STL
963 typedef std::bidirectional_iterator_tag iterator_category;
964 #endif
965
966 // Default constructor
968
969 // Construct an iterator which points to the specified attribute
970 xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
971
972 // Iterator operators
973 bool operator==(const xml_attribute_iterator& rhs) const;
974 bool operator!=(const xml_attribute_iterator& rhs) const;
975
976 xml_attribute& operator*() const;
977 xml_attribute* operator->() const;
978
981
984 };
985
986 // Named node range helper
988 {
989 friend class xml_node;
990
991 public:
992 // Iterator traits
993 typedef ptrdiff_t difference_type;
997
998 #ifndef PUGIXML_NO_STL
999 typedef std::bidirectional_iterator_tag iterator_category;
1000 #endif
1001
1002 // Default constructor
1004
1005 // Construct an iterator which points to the specified node
1006 // Note: name pointer is stored in the iterator and must have a longer lifetime than iterator itself
1007 xml_named_node_iterator(const xml_node& node, const char_t* name);
1008
1009 // Iterator operators
1010 bool operator==(const xml_named_node_iterator& rhs) const;
1011 bool operator!=(const xml_named_node_iterator& rhs) const;
1012
1013 xml_node& operator*() const;
1014 xml_node* operator->() const;
1015
1018
1021
1022 private:
1026
1028 };
1029
1030 // Abstract tree walker class (see xml_node::traverse)
1032 {
1033 friend class xml_node;
1034
1035 private:
1037
1038 protected:
1039 // Get current traversal depth
1040 int depth() const;
1041
1042 public:
1044 virtual ~xml_tree_walker();
1045
1046 // Callback that is called when traversal begins
1047 virtual bool begin(xml_node& node);
1048
1049 // Callback that is called for each node traversed
1050 virtual bool for_each(xml_node& node) = 0;
1051
1052 // Callback that is called when traversal ends
1053 virtual bool end(xml_node& node);
1054 };
1055
1056 // Parsing status, returned as part of xml_parse_result object
1058 {
1059 status_ok = 0, // No error
1060
1061 status_file_not_found, // File was not found during load_file()
1062 status_io_error, // Error reading from file/stream
1063 status_out_of_memory, // Could not allocate memory
1064 status_internal_error, // Internal error occurred
1065
1066 status_unrecognized_tag, // Parser could not determine tag type
1067
1068 status_bad_pi, // Parsing error occurred while parsing document declaration/processing instruction
1069 status_bad_comment, // Parsing error occurred while parsing comment
1070 status_bad_cdata, // Parsing error occurred while parsing CDATA section
1071 status_bad_doctype, // Parsing error occurred while parsing document type declaration
1072 status_bad_pcdata, // Parsing error occurred while parsing PCDATA section
1073 status_bad_start_element, // Parsing error occurred while parsing start element tag
1074 status_bad_attribute, // Parsing error occurred while parsing element attribute
1075 status_bad_end_element, // Parsing error occurred while parsing end element tag
1076 status_end_element_mismatch,// There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
1077
1078 status_append_invalid_root, // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer)
1079
1080 status_no_document_element // Parsing resulted in a document without element nodes
1081 };
1082
1083 // Parsing result
1085 {
1086 // Parsing status (see xml_parse_status)
1088
1089 // Last parsed offset (in char_t units from start of input data)
1090 ptrdiff_t offset;
1091
1092 // Source document encoding
1094
1095 // Default constructor, initializes object to failed state
1097
1098 // Cast to bool operator
1099 operator bool() const;
1100
1101 // Get error description
1102 const char* description() const;
1103 };
1104
1105 // Document class (DOM tree root)
1107 {
1108 private:
1110
1111 char _memory[192];
1112
1113 // Non-copyable semantics
1116
1117 void _create();
1118 void _destroy();
1120
1121 public:
1122 // Default constructor, makes empty document
1123 xml_document();
1124
1125 // Destructor, invalidates all node/attribute handles to this document
1126 ~xml_document();
1127
1128 #ifdef PUGIXML_HAS_MOVE
1129 // Move semantics support
1132 #endif
1133
1134 // Removes all nodes, leaving the empty document
1135 void reset();
1136
1137 // Removes all nodes, then copies the entire contents of the specified document
1138 void reset(const xml_document& proto);
1139
1140 #ifndef PUGIXML_NO_STL
1141 // Load document from stream.
1142 xml_parse_result load(std::basic_istream<char>& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1143 xml_parse_result load(std::basic_istream<wchar_t>& stream, unsigned int options = parse_default);
1144 #endif
1145
1146 // (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
1147 PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
1148
1149 // Load document from zero-terminated string. No encoding conversions are applied.
1150 xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
1151
1152 // Load document from file
1153 xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1154 xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1155
1156 // Load document from buffer. Copies/converts the buffer, so it may be deleted or changed after the function returns.
1157 xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1158
1159 // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
1160 // You should ensure that buffer data will persist throughout the document's lifetime, and free the buffer memory manually once document is destroyed.
1161 xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1162
1163 // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
1164 // You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed (you can't use it anymore).
1165 xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1166
1167 // Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
1168 void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1169
1170 #ifndef PUGIXML_NO_STL
1171 // Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
1172 void save(std::basic_ostream<char>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1173 void save(std::basic_ostream<wchar_t>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
1174 #endif
1175
1176 // Save XML to file
1177 bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1178 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;
1179
1180 // Get document element
1181 xml_node document_element() const;
1182 };
1183
1184#ifndef PUGIXML_NO_XPATH
1185 // XPath query return type
1187 {
1188 xpath_type_none, // Unknown type (query failed to compile)
1189 xpath_type_node_set, // Node set (xpath_node_set)
1193 };
1194
1195 // XPath parsing result
1197 {
1198 // Error message (0 if no error)
1199 const char* error;
1200
1201 // Last parsed offset (in char_t units from string start)
1202 ptrdiff_t offset;
1203
1204 // Default constructor, initializes object to failed state
1206
1207 // Cast to bool operator
1208 operator bool() const;
1209
1210 // Get error description
1211 const char* description() const;
1212 };
1213
1214 // A single XPath variable
1216 {
1218
1219 protected:
1222
1224
1225 // Non-copyable semantics
1228
1229 public:
1230 // Get variable name
1231 const char_t* name() const;
1232
1233 // Get variable type
1234 xpath_value_type type() const;
1235
1236 // Get variable value; no type conversion is performed, default value (false, NaN, empty string, empty node set) is returned on type mismatch error
1237 bool get_boolean() const;
1238 double get_number() const;
1239 const char_t* get_string() const;
1240 const xpath_node_set& get_node_set() const;
1241
1242 // Set variable value; no type conversion is performed, false is returned on type mismatch error
1243 bool set(bool value);
1244 bool set(double value);
1245 bool set(const char_t* value);
1246 bool set(const xpath_node_set& value);
1247 };
1248
1249 // A set of XPath variables
1251 {
1252 private:
1254
1255 void _assign(const xpath_variable_set& rhs);
1256 void _swap(xpath_variable_set& rhs);
1257
1258 xpath_variable* _find(const char_t* name) const;
1259
1260 static bool _clone(xpath_variable* var, xpath_variable** out_result);
1261 static void _destroy(xpath_variable* var);
1262
1263 public:
1264 // Default constructor/destructor
1267
1268 // Copy constructor/assignment operator
1271
1272 #ifdef PUGIXML_HAS_MOVE
1273 // Move semantics support
1276 #endif
1277
1278 // Add a new variable or get the existing one, if the types match
1279 xpath_variable* add(const char_t* name, xpath_value_type type);
1280
1281 // Set value of an existing variable; no type conversion is performed, false is returned if there is no such variable or if types mismatch
1282 bool set(const char_t* name, bool value);
1283 bool set(const char_t* name, double value);
1284 bool set(const char_t* name, const char_t* value);
1285 bool set(const char_t* name, const xpath_node_set& value);
1286
1287 // Get existing variable by name
1288 xpath_variable* get(const char_t* name);
1289 const xpath_variable* get(const char_t* name) const;
1290 };
1291
1292 // A compiled XPath query object
1294 {
1295 private:
1296 void* _impl;
1298
1300
1301 // Non-copyable semantics
1304
1305 public:
1306 // Construct a compiled object from XPath expression.
1307 // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
1308 explicit xpath_query(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL);
1309
1310 // Constructor
1311 xpath_query();
1312
1313 // Destructor
1314 ~xpath_query();
1315
1316 #ifdef PUGIXML_HAS_MOVE
1317 // Move semantics support
1320 #endif
1321
1322 // Get query expression return type
1324
1325 // Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
1326 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1327 bool evaluate_boolean(const xpath_node& n) const;
1328
1329 // Evaluate expression as double value in the specified context; performs type conversion if necessary.
1330 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1331 double evaluate_number(const xpath_node& n) const;
1332
1333 #ifndef PUGIXML_NO_STL
1334 // Evaluate expression as string value in the specified context; performs type conversion if necessary.
1335 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1336 string_t evaluate_string(const xpath_node& n) const;
1337 #endif
1338
1339 // Evaluate expression as string value in the specified context; performs type conversion if necessary.
1340 // At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
1341 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1342 // If PUGIXML_NO_EXCEPTIONS is defined, returns empty set instead.
1343 size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
1344
1345 // Evaluate expression as node set in the specified context.
1346 // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
1347 // If PUGIXML_NO_EXCEPTIONS is defined, returns empty node set instead.
1349
1350 // Evaluate expression as node set in the specified context.
1351 // Return first node in document order, or empty node if node set is empty.
1352 // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
1353 // If PUGIXML_NO_EXCEPTIONS is defined, returns empty node instead.
1354 xpath_node evaluate_node(const xpath_node& n) const;
1355
1356 // Get parsing result (used to get compilation errors in PUGIXML_NO_EXCEPTIONS mode)
1357 const xpath_parse_result& result() const;
1358
1359 // Safe bool conversion operator
1360 operator unspecified_bool_type() const;
1361
1362 // Borland C++ workaround
1363 bool operator!() const;
1364 };
1365
1366 #ifndef PUGIXML_NO_EXCEPTIONS
1367 #if defined(_MSC_VER)
1368 // C4275 can be ignored in Visual C++ if you are deriving
1369 // from a type in the Standard C++ Library
1370 #pragma warning(push)
1371 #pragma warning(disable: 4275)
1372 #endif
1373 // XPath exception class
1374 class PUGIXML_CLASS xpath_exception: public std::exception
1375 {
1376 private:
1378
1379 public:
1380 // Construct exception from parse result
1381 explicit xpath_exception(const xpath_parse_result& result);
1382
1383 // Get error message
1384 virtual const char* what() const PUGIXML_NOEXCEPT PUGIXML_OVERRIDE;
1385
1386 // Get parse result
1387 const xpath_parse_result& result() const;
1388 };
1389 #if defined(_MSC_VER)
1390 #pragma warning(pop)
1391 #endif
1392 #endif
1393
1394 // XPath node class (either xml_node or xml_attribute)
1396 {
1397 private:
1400
1402
1403 public:
1404 // Default constructor; constructs empty XPath node
1405 xpath_node();
1406
1407 // Construct XPath node from XML node/attribute
1408 xpath_node(const xml_node& node);
1410
1411 // Get node/attribute, if any
1412 xml_node node() const;
1413 xml_attribute attribute() const;
1414
1415 // Get parent of contained node/attribute
1416 xml_node parent() const;
1417
1418 // Safe bool conversion operator
1419 operator unspecified_bool_type() const;
1420
1421 // Borland C++ workaround
1422 bool operator!() const;
1423
1424 // Comparison operators
1425 bool operator==(const xpath_node& n) const;
1426 bool operator!=(const xpath_node& n) const;
1427 };
1428
1429#ifdef __BORLANDC__
1430 // Borland C++ workaround
1431 bool PUGIXML_FUNCTION operator&&(const xpath_node& lhs, bool rhs);
1432 bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
1433#endif
1434
1435 // A fixed-size collection of XPath nodes
1437 {
1438 public:
1439 // Collection type
1441 {
1442 type_unsorted, // Not ordered
1443 type_sorted, // Sorted by document order (ascending)
1444 type_sorted_reverse // Sorted by document order (descending)
1445 };
1446
1447 // Constant iterator type
1449
1450 // We define non-constant iterator to be the same as constant iterator so that various generic algorithms (i.e. boost foreach) work
1451 typedef const xpath_node* iterator;
1452
1453 // Default constructor. Constructs empty set.
1455
1456 // Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
1458
1459 // Destructor
1461
1462 // Copy constructor/assignment operator
1463 xpath_node_set(const xpath_node_set& ns);
1465
1466 #ifdef PUGIXML_HAS_MOVE
1467 // Move semantics support
1470 #endif
1471
1472 // Get collection type
1473 type_t type() const;
1474
1475 // Get collection size
1476 size_t size() const;
1477
1478 // Indexing operator
1479 const xpath_node& operator[](size_t index) const;
1480
1481 // Collection iterators
1482 const_iterator begin() const;
1483 const_iterator end() const;
1484
1485 // Sort the collection in ascending/descending order by document order
1486 void sort(bool reverse = false);
1487
1488 // Get first node in the collection by document order
1489 xpath_node first() const;
1490
1491 // Check if collection is empty
1492 bool empty() const;
1493
1494 private:
1496
1498
1501
1504 };
1505#endif
1506
1507#ifndef PUGIXML_NO_STL
1508 // Convert wide string to UTF8
1509 std::basic_string<char> PUGIXML_FUNCTION as_utf8(const wchar_t* str);
1510 std::basic_string<char> PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t>& str);
1511
1512 // Convert UTF8 to wide string
1513 std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const char* str);
1514 std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const std::basic_string<char>& str);
1515#endif
1516
1517 // Memory allocation function interface; returns pointer to allocated memory or NULL on failure
1518 typedef void* (*allocation_function)(size_t size);
1519
1520 // Memory deallocation function interface
1521 typedef void (*deallocation_function)(void* ptr);
1522
1523 // Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
1525
1526 // Get current memory management functions
1529}
1530
1531#if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
1532namespace std
1533{
1534 // Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier)
1535 std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&);
1536 std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&);
1537 std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&);
1538}
1539#endif
1540
1541#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
1542namespace std
1543{
1544 // Workarounds for (non-standard) iterator category detection
1545 std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&);
1546 std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&);
1547 std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&);
1548}
1549#endif
1550
1551#endif
1552
1553// Make sure implementation is included in header-only mode
1554// Use macro expansion in #include to work around QMake (QTBUG-11923)
1555#if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
1556# define PUGIXML_SOURCE "pugixml.cpp"
1557# include PUGIXML_SOURCE
1558#endif
1559
Definition pugixml.hpp:946
ptrdiff_t difference_type
Definition pugixml.hpp:957
friend class xml_node
Definition pugixml.hpp:947
xml_attribute value_type
Definition pugixml.hpp:958
xml_node _parent
Definition pugixml.hpp:951
xml_attribute _wrap
Definition pugixml.hpp:950
bool operator!=(const xml_attribute_iterator &rhs) const
Definition pugixml.cpp:7307
bool operator==(const xml_attribute_iterator &rhs) const
Definition pugixml.cpp:7302
xml_attribute * operator->() const
Definition pugixml.cpp:7318
xml_attribute & operator*() const
Definition pugixml.cpp:7312
xml_attribute * pointer
Definition pugixml.hpp:959
xml_attribute_iterator(xml_attribute_struct *ref, xml_node_struct *parent)
Definition pugixml.cpp:7298
std::bidirectional_iterator_tag iterator_category
Definition pugixml.hpp:963
xml_attribute_iterator & operator--()
Definition pugixml.cpp:7338
xml_attribute_iterator & operator++()
Definition pugixml.cpp:7324
xml_attribute & reference
Definition pugixml.hpp:960
Definition pugixml.hpp:386
bool operator<=(const xml_attribute &r) const
Definition pugixml.cpp:5279
bool operator!=(const xml_attribute &r) const
Definition pugixml.cpp:5264
friend class xml_node
Definition pugixml.hpp:388
bool operator>(const xml_attribute &r) const
Definition pugixml.cpp:5274
bool operator!() const
Definition pugixml.cpp:5254
double as_double(double def=0) const
Definition pugixml.cpp:5323
bool set_name(const char_t *rhs)
Definition pugixml.cpp:5459
xml_attribute & operator=(const char_t *rhs)
Definition pugixml.cpp:5389
const char_t * name() const
Definition pugixml.cpp:5365
bool set_value(const char_t *rhs)
Definition pugixml.cpp:5482
bool empty() const
Definition pugixml.cpp:5360
bool operator<(const xml_attribute &r) const
Definition pugixml.cpp:5269
bool operator==(const xml_attribute &r) const
Definition pugixml.cpp:5259
xml_attribute previous_attribute() const
Definition pugixml.cpp:5295
xml_attribute_struct * _attr
Definition pugixml.hpp:391
bool operator>=(const xml_attribute &r) const
Definition pugixml.cpp:5284
xml_attribute next_attribute() const
Definition pugixml.cpp:5289
const char_t * value() const
Definition pugixml.cpp:5372
xml_attribute_struct * internal_object() const
Definition pugixml.cpp:5384
unsigned int as_uint(unsigned int def=0) const
Definition pugixml.cpp:5316
void(* unspecified_bool_type)(xml_attribute ***)
Definition pugixml.hpp:393
size_t hash_value() const
Definition pugixml.cpp:5379
xml_attribute()
Definition pugixml.cpp:5237
const char_t * as_string(const char_t *def=PUGIXML_TEXT("")) const
Definition pugixml.cpp:5302
friend class xml_attribute_iterator
Definition pugixml.hpp:387
float as_float(float def=0) const
Definition pugixml.cpp:5330
int as_int(int def=0) const
Definition pugixml.cpp:5309
bool as_bool(bool def=false) const
Definition pugixml.cpp:5337
xml_parse_result load_buffer_inplace_own(void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
Definition pugixml.cpp:7763
bool save_file(const char *path, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
Definition pugixml.cpp:7814
xml_parse_result load_buffer_inplace(void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
Definition pugixml.cpp:7756
xml_document(const xml_document &)
void reset()
Definition pugixml.cpp:7490
char _memory[192]
Definition pugixml.hpp:1111
xml_parse_result load_buffer(const void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
Definition pugixml.cpp:7749
xml_node document_element() const
Definition pugixml.cpp:7830
void save(xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
Definition pugixml.cpp:7770
xml_parse_result load_string(const char_t *contents, unsigned int options=parse_default)
Definition pugixml.cpp:7712
xml_document & operator=(const xml_document &)
void _create()
Definition pugixml.cpp:7503
char_t * _buffer
Definition pugixml.hpp:1109
void _destroy()
Definition pugixml.cpp:7546
xml_parse_result load(std::basic_istream< char > &stream, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
Definition pugixml.cpp:7697
xml_parse_result load_file(const char *path, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
Definition pugixml.cpp:7729
void _move(xml_document &rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT
Definition pugixml.hpp:988
friend class xml_node
Definition pugixml.hpp:989
ptrdiff_t difference_type
Definition pugixml.hpp:993
xml_node & reference
Definition pugixml.hpp:996
xml_named_node_iterator & operator++()
Definition pugixml.cpp:7385
xml_named_node_iterator()
Definition pugixml.cpp:7351
const char_t * _name
Definition pugixml.hpp:1025
xml_node _wrap
Definition pugixml.hpp:1023
xml_node & operator*() const
Definition pugixml.cpp:7373
xml_node value_type
Definition pugixml.hpp:994
xml_named_node_iterator & operator--()
Definition pugixml.cpp:7399
bool operator==(const xml_named_node_iterator &rhs) const
Definition pugixml.cpp:7363
xml_node * operator->() const
Definition pugixml.cpp:7379
std::bidirectional_iterator_tag iterator_category
Definition pugixml.hpp:999
xml_node _parent
Definition pugixml.hpp:1024
bool operator!=(const xml_named_node_iterator &rhs) const
Definition pugixml.cpp:7368
xml_node * pointer
Definition pugixml.hpp:995
Definition pugixml.hpp:904
xml_node_iterator & operator--()
Definition pugixml.cpp:7277
friend class xml_node
Definition pugixml.hpp:905
bool operator==(const xml_node_iterator &rhs) const
Definition pugixml.cpp:7241
xml_node value_type
Definition pugixml.hpp:916
bool operator!=(const xml_node_iterator &rhs) const
Definition pugixml.cpp:7246
xml_node _parent
Definition pugixml.hpp:909
xml_node * pointer
Definition pugixml.hpp:917
xml_node _wrap
Definition pugixml.hpp:908
xml_node_iterator & operator++()
Definition pugixml.cpp:7263
std::bidirectional_iterator_tag iterator_category
Definition pugixml.hpp:921
xml_node * operator->() const
Definition pugixml.cpp:7257
xml_node & reference
Definition pugixml.hpp:918
xml_node_iterator(xml_node_struct *ref, xml_node_struct *parent)
Definition pugixml.cpp:7237
ptrdiff_t difference_type
Definition pugixml.hpp:915
xml_node & operator*() const
Definition pugixml.cpp:7251
Definition pugixml.hpp:506
size_t hash_value() const
Definition pugixml.cpp:6836
xml_node insert_child_before(xml_node_type type, const xml_node &node)
Definition pugixml.cpp:6287
xml_node parent() const
Definition pugixml.cpp:5913
xml_node root() const
Definition pugixml.cpp:5918
bool operator!() const
Definition pugixml.cpp:5613
xml_node previous_sibling() const
Definition pugixml.cpp:5906
xml_attribute prepend_copy(const xml_attribute &proto)
Definition pugixml.cpp:6200
xml_node prepend_move(const xml_node &moved)
Definition pugixml.cpp:6483
friend class xml_named_node_iterator
Definition pugixml.hpp:509
bool empty() const
Definition pugixml.cpp:5683
bool operator>=(const xml_node &r) const
Definition pugixml.cpp:5678
bool operator!=(const xml_node &r) const
Definition pugixml.cpp:5658
xml_attribute attribute(const char_t *name) const
Definition pugixml.cpp:5721
xml_attribute first_attribute() const
Definition pugixml.cpp:5951
xml_node last_child() const
Definition pugixml.cpp:5970
ptrdiff_t offset_debug() const
Definition pugixml.cpp:6873
xml_attribute insert_copy_after(const xml_attribute &proto, const xml_attribute &attr)
Definition pugixml.cpp:6217
xml_node child(const char_t *name) const
Definition pugixml.cpp:5707
xml_attribute find_attribute(Predicate pred) const
Definition pugixml.hpp:681
xml_node_struct * _root
Definition pugixml.hpp:512
bool set_name(const char_t *rhs)
Definition pugixml.cpp:5977
xml_node()
Definition pugixml.cpp:5596
attribute_iterator attributes_begin() const
Definition pugixml.cpp:5628
xml_object_range< xml_node_iterator > children() const
Definition pugixml.cpp:5638
const char_t * child_value() const
Definition pugixml.cpp:5928
bool remove_children()
Definition pugixml.cpp:6607
bool set_value(const char_t *rhs)
Definition pugixml.cpp:6009
xml_text text() const
Definition pugixml.cpp:5923
bool remove_attributes()
Definition pugixml.cpp:6561
xml_attribute insert_copy_before(const xml_attribute &proto, const xml_attribute &attr)
Definition pugixml.cpp:6235
void(* unspecified_bool_type)(xml_node ***)
Definition pugixml.hpp:514
xml_node find_node(Predicate pred) const
Definition pugixml.hpp:705
xml_attribute_iterator attribute_iterator
Definition pugixml.hpp:774
const char_t * value() const
Definition pugixml.cpp:5700
string_t path(char_t delimiter='/') const
Definition pugixml.cpp:6711
xml_node_type type() const
Definition pugixml.cpp:5695
friend class xml_node_iterator
Definition pugixml.hpp:508
xml_parse_result append_buffer(const void *contents, size_t size, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
Definition pugixml.cpp:6628
xml_node append_move(const xml_node &moved)
Definition pugixml.cpp:6467
xml_object_range< xml_attribute_iterator > attributes() const
Definition pugixml.cpp:5648
iterator end() const
Definition pugixml.cpp:5623
const char_t * name() const
Definition pugixml.cpp:5688
xml_node insert_move_after(const xml_node &moved, const xml_node &node)
Definition pugixml.cpp:6499
xml_attribute append_copy(const xml_attribute &proto)
Definition pugixml.cpp:6183
bool remove_child(const xml_node &n)
Definition pugixml.cpp:6594
xml_node first_child() const
Definition pugixml.cpp:5964
bool operator>(const xml_node &r) const
Definition pugixml.cpp:5668
xml_node find_child(Predicate pred) const
Definition pugixml.hpp:693
xml_attribute last_attribute() const
Definition pugixml.cpp:5957
bool operator==(const xml_node &r) const
Definition pugixml.cpp:5653
bool operator<=(const xml_node &r) const
Definition pugixml.cpp:5673
xml_node insert_child_after(xml_node_type type, const xml_node &node)
Definition pugixml.cpp:6305
attribute_iterator attributes_end() const
Definition pugixml.cpp:5633
xml_node_iterator iterator
Definition pugixml.hpp:768
xml_node next_sibling() const
Definition pugixml.cpp:5749
xml_node insert_move_before(const xml_node &moved, const xml_node &node)
Definition pugixml.cpp:6517
xml_node prepend_child(xml_node_type type=node_element)
Definition pugixml.cpp:6270
iterator begin() const
Definition pugixml.cpp:5618
friend class xml_attribute_iterator
Definition pugixml.hpp:507
bool operator<(const xml_node &r) const
Definition pugixml.cpp:5663
xml_node_struct * internal_object() const
Definition pugixml.cpp:6841
xml_node append_child(xml_node_type type=node_element)
Definition pugixml.cpp:6253
Definition pugixml.hpp:326
It iterator
Definition pugixml.hpp:329
It begin() const
Definition pugixml.hpp:335
bool empty() const
Definition pugixml.hpp:338
It _begin
Definition pugixml.hpp:341
xml_object_range(It b, It e)
Definition pugixml.hpp:331
It end() const
Definition pugixml.hpp:336
It const_iterator
Definition pugixml.hpp:328
It _end
Definition pugixml.hpp:341
Definition pugixml.hpp:805
const char_t * as_string(const char_t *def=PUGIXML_TEXT("")) const
Definition pugixml.cpp:6974
friend class xml_node
Definition pugixml.hpp:806
double as_double(double def=0) const
Definition pugixml.cpp:6998
const char_t * get() const
Definition pugixml.cpp:6966
xml_text & operator=(const char_t *rhs)
Definition pugixml.cpp:7142
bool operator!() const
Definition pugixml.cpp:6956
xml_node_struct * _data_new()
Definition pugixml.cpp:6935
unsigned int as_uint(unsigned int def=0) const
Definition pugixml.cpp:6990
float as_float(float def=0) const
Definition pugixml.cpp:7006
xml_node_struct * _data() const
Definition pugixml.cpp:6920
xml_node_struct * _root
Definition pugixml.hpp:808
int as_int(int def=0) const
Definition pugixml.cpp:6982
bool empty() const
Definition pugixml.cpp:6961
bool set(const char_t *rhs)
Definition pugixml.cpp:7040
xml_node data() const
Definition pugixml.cpp:7212
xml_text(xml_node_struct *root)
Definition pugixml.cpp:6916
bool as_bool(bool def=false) const
Definition pugixml.cpp:7014
void(* unspecified_bool_type)(xml_text ***)
Definition pugixml.hpp:810
Definition pugixml.hpp:1032
friend class xml_node
Definition pugixml.hpp:1033
xml_tree_walker()
Definition pugixml.cpp:5214
virtual bool for_each(xml_node &node)=0
int depth() const
Definition pugixml.cpp:5222
virtual bool begin(xml_node &node)
Definition pugixml.cpp:5227
int _depth
Definition pugixml.hpp:1036
virtual bool end(xml_node &node)
Definition pugixml.cpp:5232
virtual void write(const void *data, size_t size) PUGIXML_OVERRIDE
Definition pugixml.cpp:5182
xml_writer_file(void *file)
Definition pugixml.cpp:5178
void * file
Definition pugixml.hpp:364
xml_writer_stream(std::basic_ostream< char > &stream)
Definition pugixml.cpp:5189
std::basic_ostream< wchar_t > * wide_stream
Definition pugixml.hpp:380
virtual void write(const void *data, size_t size) PUGIXML_OVERRIDE
Definition pugixml.cpp:5197
std::basic_ostream< char > * narrow_stream
Definition pugixml.hpp:379
Definition pugixml.hpp:346
virtual void write(const void *data, size_t size)=0
virtual const char * what() const PUGIXML_NOEXCEPT PUGIXML_OVERRIDE
Definition pugixml.cpp:12697
const xpath_parse_result & result() const
Definition pugixml.cpp:12702
xpath_parse_result _result
Definition pugixml.hpp:1377
xpath_exception(const xpath_parse_result &result)
Definition pugixml.cpp:12692
Definition pugixml.hpp:1437
xpath_node_set & operator=(const xpath_node_set &ns)
Definition pugixml.cpp:12836
size_t size() const
Definition pugixml.cpp:12869
type_t _type
Definition pugixml.hpp:1495
xpath_node first() const
Definition pugixml.cpp:12900
const xpath_node & operator[](size_t index) const
Definition pugixml.cpp:12879
const_iterator end() const
Definition pugixml.cpp:12890
const xpath_node * const_iterator
Definition pugixml.hpp:1448
type_t
Definition pugixml.hpp:1441
@ type_sorted_reverse
Definition pugixml.hpp:1444
@ type_unsorted
Definition pugixml.hpp:1442
@ type_sorted
Definition pugixml.hpp:1443
xpath_node_set()
Definition pugixml.cpp:12816
const xpath_node * iterator
Definition pugixml.hpp:1451
void _assign(const_iterator begin, const_iterator end, type_t type)
Definition pugixml.cpp:12771
xpath_node * _begin
Definition pugixml.hpp:1499
const_iterator begin() const
Definition pugixml.cpp:12885
xpath_node _storage[1]
Definition pugixml.hpp:1497
bool empty() const
Definition pugixml.cpp:12874
xpath_node * _end
Definition pugixml.hpp:1500
type_t type() const
Definition pugixml.cpp:12864
void _move(xpath_node_set &rhs) PUGIXML_NOEXCEPT
Definition pugixml.hpp:1396
xml_attribute attribute() const
Definition pugixml.cpp:12725
void(* unspecified_bool_type)(xpath_node ***)
Definition pugixml.hpp:1401
bool operator!=(const xpath_node &n) const
Definition pugixml.cpp:12754
xml_node parent() const
Definition pugixml.cpp:12730
bool operator==(const xpath_node &n) const
Definition pugixml.cpp:12749
xml_node _node
Definition pugixml.hpp:1398
bool operator!() const
Definition pugixml.cpp:12744
xml_node node() const
Definition pugixml.cpp:12720
xml_attribute _attribute
Definition pugixml.hpp:1399
xpath_node()
Definition pugixml.cpp:12708
Definition pugixml.hpp:1294
bool operator!() const
Definition pugixml.cpp:13442
xpath_node evaluate_node(const xpath_node &n) const
Definition pugixml.cpp:13406
void(* unspecified_bool_type)(xpath_query ***)
Definition pugixml.hpp:1299
bool evaluate_boolean(const xpath_node &n) const
Definition pugixml.cpp:13289
xpath_value_type return_type() const
Definition pugixml.cpp:13282
xpath_node_set evaluate_node_set(const xpath_node &n) const
Definition pugixml.cpp:13384
xpath_parse_result _result
Definition pugixml.hpp:1297
xpath_query & operator=(const xpath_query &)
double evaluate_number(const xpath_node &n) const
Definition pugixml.cpp:13310
const xpath_parse_result & result() const
Definition pugixml.cpp:13428
xpath_query(const xpath_query &)
void * _impl
Definition pugixml.hpp:1296
string_t evaluate_string(const xpath_node &n) const
Definition pugixml.cpp:13332
Definition pugixml.hpp:1251
static bool _clone(xpath_variable *var, xpath_variable **out_result)
Definition pugixml.cpp:13110
xpath_variable_set & operator=(const xpath_variable_set &rhs)
Definition pugixml.cpp:13039
static void _destroy(xpath_variable *var)
Definition pugixml.cpp:13137
xpath_variable_set()
Definition pugixml.cpp:13019
void _swap(xpath_variable_set &rhs)
Definition pugixml.cpp:13083
xpath_variable * add(const char_t *name, xpath_value_type type)
Definition pugixml.cpp:13149
bool set(const char_t *name, bool value)
Definition pugixml.cpp:13175
void _assign(const xpath_variable_set &rhs)
Definition pugixml.cpp:13072
xpath_variable * _find(const char_t *name) const
Definition pugixml.cpp:13094
xpath_variable * get(const char_t *name)
Definition pugixml.cpp:13199
xpath_variable * _data[64]
Definition pugixml.hpp:1253
Definition pugixml.hpp:1216
xpath_variable * _next
Definition pugixml.hpp:1221
xpath_value_type type() const
Definition pugixml.cpp:12945
double get_number() const
Definition pugixml.cpp:12955
xpath_variable(const xpath_variable &)
const char_t * get_string() const
Definition pugixml.cpp:12960
bool get_boolean() const
Definition pugixml.cpp:12950
xpath_variable(xpath_value_type type)
Definition pugixml.cpp:12919
xpath_variable & operator=(const xpath_variable &)
const char_t * name() const
Definition pugixml.cpp:12923
bool set(bool value)
Definition pugixml.cpp:12974
const xpath_node_set & get_node_set() const
Definition pugixml.cpp:12966
friend class xpath_variable_set
Definition pugixml.hpp:1217
xpath_value_type _type
Definition pugixml.hpp:1220
Definition pugixml.cpp:1130
const unsigned int format_no_empty_element_tags
Definition pugixml.hpp:286
xml_encoding
Definition pugixml.hpp:249
@ encoding_utf32
Definition pugixml.hpp:257
@ encoding_utf16_le
Definition pugixml.hpp:252
@ encoding_utf32_be
Definition pugixml.hpp:256
@ encoding_utf16_be
Definition pugixml.hpp:253
@ encoding_utf8
Definition pugixml.hpp:251
@ encoding_latin1
Definition pugixml.hpp:259
@ encoding_utf16
Definition pugixml.hpp:254
@ encoding_utf32_le
Definition pugixml.hpp:255
@ encoding_auto
Definition pugixml.hpp:250
@ encoding_wchar
Definition pugixml.hpp:258
PUGI_IMPL_FN deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function()
Definition pugixml.cpp:7878
PUGI_IMPL_FN std::basic_string< wchar_t > PUGIXML_FUNCTION as_wide(const char *str)
Definition pugixml.cpp:7854
PUGI_IMPL_FN allocation_function PUGIXML_FUNCTION get_memory_allocation_function()
Definition pugixml.cpp:7873
const unsigned int format_no_declaration
Definition pugixml.hpp:274
xml_node_type
Definition pugixml.hpp:167
@ node_comment
Definition pugixml.hpp:173
@ node_pcdata
Definition pugixml.hpp:171
@ node_element
Definition pugixml.hpp:170
@ node_doctype
Definition pugixml.hpp:176
@ node_document
Definition pugixml.hpp:169
@ node_declaration
Definition pugixml.hpp:175
@ node_pi
Definition pugixml.hpp:174
@ node_null
Definition pugixml.hpp:168
@ node_cdata
Definition pugixml.hpp:172
const unsigned int parse_trim_pcdata
Definition pugixml.hpp:222
const unsigned int parse_wconv_attribute
Definition pugixml.hpp:205
const unsigned int format_skip_control_chars
Definition pugixml.hpp:289
const unsigned int format_raw
Definition pugixml.hpp:271
const unsigned int format_default
Definition pugixml.hpp:296
void(* deallocation_function)(void *ptr)
Definition pugixml.hpp:1521
const int default_double_precision
Definition pugixml.hpp:298
const unsigned int parse_cdata
Definition pugixml.hpp:192
void *(* allocation_function)(size_t size)
Definition pugixml.hpp:1518
const unsigned int parse_merge_pcdata
Definition pugixml.hpp:235
const unsigned int parse_fragment
Definition pugixml.hpp:226
const unsigned int parse_full
Definition pugixml.hpp:245
const unsigned int parse_embed_pcdata
Definition pugixml.hpp:231
const unsigned int parse_wnorm_attribute
Definition pugixml.hpp:208
const unsigned int format_indent_attributes
Definition pugixml.hpp:283
const unsigned int parse_pi
Definition pugixml.hpp:186
xml_parse_status
Definition pugixml.hpp:1058
@ status_append_invalid_root
Definition pugixml.hpp:1078
@ status_end_element_mismatch
Definition pugixml.hpp:1076
@ status_bad_end_element
Definition pugixml.hpp:1075
@ status_io_error
Definition pugixml.hpp:1062
@ status_bad_attribute
Definition pugixml.hpp:1074
@ status_file_not_found
Definition pugixml.hpp:1061
@ status_internal_error
Definition pugixml.hpp:1064
@ status_bad_start_element
Definition pugixml.hpp:1073
@ status_ok
Definition pugixml.hpp:1059
@ status_bad_comment
Definition pugixml.hpp:1069
@ status_bad_doctype
Definition pugixml.hpp:1071
@ status_out_of_memory
Definition pugixml.hpp:1063
@ status_unrecognized_tag
Definition pugixml.hpp:1066
@ status_bad_cdata
Definition pugixml.hpp:1070
@ status_bad_pcdata
Definition pugixml.hpp:1072
@ status_bad_pi
Definition pugixml.hpp:1068
@ status_no_document_element
Definition pugixml.hpp:1080
PUGI_IMPL_FN std::string PUGIXML_FUNCTION as_utf8(const wchar_t *str)
Definition pugixml.cpp:7842
const unsigned int format_save_file_text
Definition pugixml.hpp:280
const unsigned int parse_escapes
Definition pugixml.hpp:199
const unsigned int format_write_bom
Definition pugixml.hpp:268
PUGI_IMPL_FN void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate)
Definition pugixml.cpp:7867
const unsigned int format_attribute_single_quote
Definition pugixml.hpp:292
const unsigned int format_indent
Definition pugixml.hpp:265
const unsigned int parse_eol
Definition pugixml.hpp:202
const unsigned int parse_default
Definition pugixml.hpp:240
const unsigned int parse_declaration
Definition pugixml.hpp:211
const unsigned int parse_comments
Definition pugixml.hpp:189
xpath_value_type
Definition pugixml.hpp:1187
@ xpath_type_number
Definition pugixml.hpp:1190
@ xpath_type_boolean
Definition pugixml.hpp:1192
@ xpath_type_none
Definition pugixml.hpp:1188
@ xpath_type_string
Definition pugixml.hpp:1191
@ xpath_type_node_set
Definition pugixml.hpp:1189
const unsigned int parse_ws_pcdata
Definition pugixml.hpp:196
const unsigned int parse_minimal
Definition pugixml.hpp:183
const unsigned int parse_ws_pcdata_single
Definition pugixml.hpp:219
const unsigned int format_no_escapes
Definition pugixml.hpp:277
PUGIXML_CHAR char_t
Definition pugixml.hpp:149
const int default_float_precision
Definition pugixml.hpp:299
std::basic_string< PUGIXML_CHAR > string_t
Definition pugixml.hpp:153
const unsigned int parse_doctype
Definition pugixml.hpp:214
PUGI_IMPL_FN void sort(I begin, I end, const Pred &pred)
Definition pugixml.cpp:8071
PUGI_IMPL_FN void reverse(I begin, I end)
Definition pugixml.cpp:7979
void remove_attribute(xml_attribute_struct *attr, xml_node_struct *node)
Definition pugixml.cpp:1430
void insert_attribute_before(xml_attribute_struct *attr, xml_attribute_struct *place, xml_node_struct *node)
Definition pugixml.cpp:1416
void append_attribute(xml_attribute_struct *attr, xml_node_struct *node)
Definition pugixml.cpp:1367
void prepend_attribute(xml_attribute_struct *attr, xml_node_struct *node)
Definition pugixml.cpp:1386
allocation_function xml_memory_management_function_storage< T >::allocate
Definition pugixml.cpp:221
deallocation_function xml_memory_management_function_storage< T >::deallocate
Definition pugixml.cpp:222
void insert_attribute_after(xml_attribute_struct *attr, xml_attribute_struct *place, xml_node_struct *node)
Definition pugixml.cpp:1402
#define PUGIXML_NULL
Definition pugixml.hpp:133
#define PUGIXML_DEPRECATED
Definition pugixml.hpp:60
#define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
Definition pugixml.hpp:112
#define PUGIXML_FUNCTION
Definition pugixml.hpp:76
#define PUGIXML_NOEXCEPT
Definition pugixml.hpp:104
#define PUGIXML_OVERRIDE
Definition pugixml.hpp:122
#define PUGIXML_CLASS
Definition pugixml.hpp:71
#define PUGIXML_TEXT(t)
Definition pugixml.hpp:142
#define PUGIXML_CHAR
Definition pugixml.hpp:143
Definition pugixml.cpp:1132
Definition pugixml.cpp:1148
Definition pugixml.hpp:1085
const char * description() const
Definition pugixml.cpp:7430
xml_encoding encoding
Definition pugixml.hpp:1093
ptrdiff_t offset
Definition pugixml.hpp:1090
xml_parse_status status
Definition pugixml.hpp:1087
xml_parse_result()
Definition pugixml.cpp:7421
Definition pugixml.hpp:1197
const char * description() const
Definition pugixml.cpp:12914
const char * error
Definition pugixml.hpp:1199
ptrdiff_t offset
Definition pugixml.hpp:1202
xpath_parse_result()
Definition pugixml.cpp:12905