2 * pugixml parser - version 1.4
\r
3 * --------------------------------------------------------
\r
5 * Report bugs and download new versions at http://pugixml.org/
\r
7 * This library is distributed under the MIT License. See notice at the end
\r
10 * This work is based on the pugxml parser, which is:
\r
14 #ifndef PUGIXML_VERSION
\r
15 // Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons
\r
16 # define PUGIXML_VERSION 140
\r
19 // Include user configuration file (this can define various configuration macros)
\r
20 #include "pugiconfig.hpp"
\r
22 #ifndef HEADER_PUGIXML_HPP
\r
23 #define HEADER_PUGIXML_HPP
\r
25 // Include stddef.h for size_t and ptrdiff_t
\r
28 // Include exception header for XPath
\r
29 #if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
\r
30 # include <exception>
\r
33 // Include STL headers
\r
34 #ifndef PUGIXML_NO_STL
\r
35 # include <iterator>
\r
40 // Macro for deprecated features
\r
41 #ifndef PUGIXML_DEPRECATED
\r
42 # if defined(__GNUC__)
\r
43 # define PUGIXML_DEPRECATED __attribute__((deprecated))
\r
44 # elif defined(_MSC_VER) && _MSC_VER >= 1300
\r
45 # define PUGIXML_DEPRECATED __declspec(deprecated)
\r
47 # define PUGIXML_DEPRECATED
\r
51 // If no API is defined, assume default
\r
53 # define PUGIXML_API
\r
56 // If no API for classes is defined, assume default
\r
57 #ifndef PUGIXML_CLASS
\r
58 # define PUGIXML_CLASS PUGIXML_API
\r
61 // If no API for functions is defined, assume default
\r
62 #ifndef PUGIXML_FUNCTION
\r
63 # define PUGIXML_FUNCTION PUGIXML_API
\r
66 // If the platform is known to have long long support, enable long long functions
\r
67 #ifndef PUGIXML_HAS_LONG_LONG
\r
68 # if defined(__cplusplus) && __cplusplus >= 201103
\r
69 # define PUGIXML_HAS_LONG_LONG
\r
70 # elif defined(_MSC_VER) && _MSC_VER >= 1400
\r
71 # define PUGIXML_HAS_LONG_LONG
\r
75 // Character interface macros
\r
76 #ifdef PUGIXML_WCHAR_MODE
\r
77 # define PUGIXML_TEXT(t) L ## t
\r
78 # define PUGIXML_CHAR wchar_t
\r
80 # define PUGIXML_TEXT(t) t
\r
81 # define PUGIXML_CHAR char
\r
86 // Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
\r
87 typedef PUGIXML_CHAR char_t;
\r
89 #ifndef PUGIXML_NO_STL
\r
90 // String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
\r
91 typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
\r
95 // The PugiXML namespace
\r
101 node_null, // Empty (null) node handle
\r
102 node_document, // A document tree's absolute root
\r
103 node_element, // Element tag, i.e. '<node/>'
\r
104 node_pcdata, // Plain character data, i.e. 'text'
\r
105 node_cdata, // Character data, i.e. '<![CDATA[text]]>'
\r
106 node_comment, // Comment tag, i.e. '<!-- text -->'
\r
107 node_pi, // Processing instruction, i.e. '<?name?>'
\r
108 node_declaration, // Document declaration, i.e. '<?xml version="1.0"?>'
\r
109 node_doctype // Document type declaration, i.e. '<!DOCTYPE doc>'
\r
114 // Minimal parsing mode (equivalent to turning all other flags off).
\r
115 // Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
\r
116 const unsigned int parse_minimal = 0x0000;
\r
118 // This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
\r
119 const unsigned int parse_pi = 0x0001;
\r
121 // This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
\r
122 const unsigned int parse_comments = 0x0002;
\r
124 // This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
\r
125 const unsigned int parse_cdata = 0x0004;
\r
127 // This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
\r
128 // This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
\r
129 const unsigned int parse_ws_pcdata = 0x0008;
\r
131 // This flag determines if character and entity references are expanded during parsing. This flag is on by default.
\r
132 const unsigned int parse_escapes = 0x0010;
\r
134 // This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
\r
135 const unsigned int parse_eol = 0x0020;
\r
137 // This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
\r
138 const unsigned int parse_wconv_attribute = 0x0040;
\r
140 // This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
\r
141 const unsigned int parse_wnorm_attribute = 0x0080;
\r
143 // This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
\r
144 const unsigned int parse_declaration = 0x0100;
\r
146 // This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
\r
147 const unsigned int parse_doctype = 0x0200;
\r
149 // This flag determines if plain character data (node_pcdata) that is the only child of the parent node and that consists only
\r
150 // of whitespace is added to the DOM tree.
\r
151 // This flag is off by default; turning it on may result in slower parsing and more memory consumption.
\r
152 const unsigned int parse_ws_pcdata_single = 0x0400;
\r
154 // This flag determines if leading and trailing whitespace is to be removed from plain character data. This flag is off by default.
\r
155 const unsigned int parse_trim_pcdata = 0x0800;
\r
157 // 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
\r
158 // is a valid document. This flag is off by default.
\r
159 const unsigned int parse_fragment = 0x1000;
\r
161 // The default parsing mode.
\r
162 // Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
\r
163 // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
\r
164 const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
\r
166 // The full parsing mode.
\r
167 // Nodes of all types are added to the DOM tree, character/reference entities are expanded,
\r
168 // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
\r
169 const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
\r
171 // These flags determine the encoding of input data for XML document
\r
174 encoding_auto, // Auto-detect input encoding using BOM or < / <? detection; use UTF8 if BOM is not found
\r
175 encoding_utf8, // UTF8 encoding
\r
176 encoding_utf16_le, // Little-endian UTF16
\r
177 encoding_utf16_be, // Big-endian UTF16
\r
178 encoding_utf16, // UTF16 with native endianness
\r
179 encoding_utf32_le, // Little-endian UTF32
\r
180 encoding_utf32_be, // Big-endian UTF32
\r
181 encoding_utf32, // UTF32 with native endianness
\r
182 encoding_wchar, // The same encoding wchar_t has (either UTF16 or UTF32)
\r
186 // Formatting flags
\r
188 // 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.
\r
189 const unsigned int format_indent = 0x01;
\r
191 // Write encoding-specific BOM to the output stream. This flag is off by default.
\r
192 const unsigned int format_write_bom = 0x02;
\r
194 // Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
\r
195 const unsigned int format_raw = 0x04;
\r
197 // Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
\r
198 const unsigned int format_no_declaration = 0x08;
\r
200 // Don't escape attribute values and PCDATA contents. This flag is off by default.
\r
201 const unsigned int format_no_escapes = 0x10;
\r
203 // 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.
\r
204 const unsigned int format_save_file_text = 0x20;
\r
206 // The default set of formatting flags.
\r
207 // Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
\r
208 const unsigned int format_default = format_indent;
\r
210 // Forward declarations
\r
211 struct xml_attribute_struct;
\r
212 struct xml_node_struct;
\r
214 class xml_node_iterator;
\r
215 class xml_attribute_iterator;
\r
216 class xml_named_node_iterator;
\r
218 class xml_tree_walker;
\r
220 struct xml_parse_result;
\r
226 #ifndef PUGIXML_NO_XPATH
\r
228 class xpath_node_set;
\r
230 class xpath_variable_set;
\r
233 // Range-based for loop support
\r
234 template <typename It> class xml_object_range
\r
237 typedef It const_iterator;
\r
238 typedef It iterator;
\r
240 xml_object_range(It b, It e): _begin(b), _end(e)
\r
244 It begin() const { return _begin; }
\r
245 It end() const { return _end; }
\r
251 // Writer interface for node printing (see xml_node::print)
\r
252 class PUGIXML_CLASS xml_writer
\r
255 virtual ~xml_writer() {}
\r
257 // Write memory chunk into stream/file/whatever
\r
258 virtual void write(const void* data, size_t size) = 0;
\r
261 // xml_writer implementation for FILE*
\r
262 class PUGIXML_CLASS xml_writer_file: public xml_writer
\r
265 // Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
\r
266 xml_writer_file(void* file);
\r
268 virtual void write(const void* data, size_t size);
\r
274 #ifndef PUGIXML_NO_STL
\r
275 // xml_writer implementation for streams
\r
276 class PUGIXML_CLASS xml_writer_stream: public xml_writer
\r
279 // Construct writer from an output stream object
\r
280 xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
\r
281 xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
\r
283 virtual void write(const void* data, size_t size);
\r
286 std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
\r
287 std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
\r
291 // A light-weight handle for manipulating attributes in DOM tree
\r
292 class PUGIXML_CLASS xml_attribute
\r
294 friend class xml_attribute_iterator;
\r
295 friend class xml_node;
\r
298 xml_attribute_struct* _attr;
\r
300 typedef void (*unspecified_bool_type)(xml_attribute***);
\r
303 // Default constructor. Constructs an empty attribute.
\r
306 // Constructs attribute from internal pointer
\r
307 explicit xml_attribute(xml_attribute_struct* attr);
\r
309 // Safe bool conversion operator
\r
310 operator unspecified_bool_type() const;
\r
312 // Borland C++ workaround
\r
313 bool operator!() const;
\r
315 // Comparison operators (compares wrapped attribute pointers)
\r
316 bool operator==(const xml_attribute& r) const;
\r
317 bool operator!=(const xml_attribute& r) const;
\r
318 bool operator<(const xml_attribute& r) const;
\r
319 bool operator>(const xml_attribute& r) const;
\r
320 bool operator<=(const xml_attribute& r) const;
\r
321 bool operator>=(const xml_attribute& r) const;
\r
323 // Check if attribute is empty
\r
324 bool empty() const;
\r
326 // Get attribute name/value, or "" if attribute is empty
\r
327 const char_t* name() const;
\r
328 const char_t* value() const;
\r
330 // Get attribute value, or the default value if attribute is empty
\r
331 const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
\r
333 // Get attribute value as a number, or the default value if conversion did not succeed or attribute is empty
\r
334 int as_int(int def = 0) const;
\r
335 unsigned int as_uint(unsigned int def = 0) const;
\r
336 double as_double(double def = 0) const;
\r
337 float as_float(float def = 0) const;
\r
339 #ifdef PUGIXML_HAS_LONG_LONG
\r
340 long long as_llong(long long def = 0) const;
\r
341 unsigned long long as_ullong(unsigned long long def = 0) const;
\r
344 // Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
\r
345 bool as_bool(bool def = false) const;
\r
347 // Set attribute name/value (returns false if attribute is empty or there is not enough memory)
\r
348 bool set_name(const char_t* rhs);
\r
349 bool set_value(const char_t* rhs);
\r
351 // Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
\r
352 bool set_value(int rhs);
\r
353 bool set_value(unsigned int rhs);
\r
354 bool set_value(double rhs);
\r
355 bool set_value(bool rhs);
\r
357 #ifdef PUGIXML_HAS_LONG_LONG
\r
358 bool set_value(long long rhs);
\r
359 bool set_value(unsigned long long rhs);
\r
362 // Set attribute value (equivalent to set_value without error checking)
\r
363 xml_attribute& operator=(const char_t* rhs);
\r
364 xml_attribute& operator=(int rhs);
\r
365 xml_attribute& operator=(unsigned int rhs);
\r
366 xml_attribute& operator=(double rhs);
\r
367 xml_attribute& operator=(bool rhs);
\r
369 #ifdef PUGIXML_HAS_LONG_LONG
\r
370 xml_attribute& operator=(long long rhs);
\r
371 xml_attribute& operator=(unsigned long long rhs);
\r
374 // Get next/previous attribute in the attribute list of the parent node
\r
375 xml_attribute next_attribute() const;
\r
376 xml_attribute previous_attribute() const;
\r
378 // Get hash value (unique for handles to the same object)
\r
379 size_t hash_value() const;
\r
381 // Get internal pointer
\r
382 xml_attribute_struct* internal_object() const;
\r
385 #ifdef __BORLANDC__
\r
386 // Borland C++ workaround
\r
387 bool PUGIXML_FUNCTION operator&&(const xml_attribute& lhs, bool rhs);
\r
388 bool PUGIXML_FUNCTION operator||(const xml_attribute& lhs, bool rhs);
\r
391 // A light-weight handle for manipulating nodes in DOM tree
\r
392 class PUGIXML_CLASS xml_node
\r
394 friend class xml_attribute_iterator;
\r
395 friend class xml_node_iterator;
\r
396 friend class xml_named_node_iterator;
\r
399 xml_node_struct* _root;
\r
401 typedef void (*unspecified_bool_type)(xml_node***);
\r
404 // Default constructor. Constructs an empty node.
\r
407 // Constructs node from internal pointer
\r
408 explicit xml_node(xml_node_struct* p);
\r
410 // Safe bool conversion operator
\r
411 operator unspecified_bool_type() const;
\r
413 // Borland C++ workaround
\r
414 bool operator!() const;
\r
416 // Comparison operators (compares wrapped node pointers)
\r
417 bool operator==(const xml_node& r) const;
\r
418 bool operator!=(const xml_node& r) const;
\r
419 bool operator<(const xml_node& r) const;
\r
420 bool operator>(const xml_node& r) const;
\r
421 bool operator<=(const xml_node& r) const;
\r
422 bool operator>=(const xml_node& r) const;
\r
424 // Check if node is empty.
\r
425 bool empty() const;
\r
428 xml_node_type type() const;
\r
430 // Get node name, or "" if node is empty or it has no name
\r
431 const char_t* name() const;
\r
433 // Get node value, or "" if node is empty or it has no value
\r
434 // Note: For <node>text</node> node.value() does not return "text"! Use child_value() or text() methods to access text inside nodes.
\r
435 const char_t* value() const;
\r
437 // Get attribute list
\r
438 xml_attribute first_attribute() const;
\r
439 xml_attribute last_attribute() const;
\r
441 // Get children list
\r
442 xml_node first_child() const;
\r
443 xml_node last_child() const;
\r
445 // Get next/previous sibling in the children list of the parent node
\r
446 xml_node next_sibling() const;
\r
447 xml_node previous_sibling() const;
\r
450 xml_node parent() const;
\r
452 // Get root of DOM tree this node belongs to
\r
453 xml_node root() const;
\r
455 // Get text object for the current node
\r
456 xml_text text() const;
\r
458 // Get child, attribute or next/previous sibling with the specified name
\r
459 xml_node child(const char_t* name) const;
\r
460 xml_attribute attribute(const char_t* name) const;
\r
461 xml_node next_sibling(const char_t* name) const;
\r
462 xml_node previous_sibling(const char_t* name) const;
\r
464 // Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
\r
465 const char_t* child_value() const;
\r
467 // Get child value of child with specified name. Equivalent to child(name).child_value().
\r
468 const char_t* child_value(const char_t* name) const;
\r
470 // Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
\r
471 bool set_name(const char_t* rhs);
\r
472 bool set_value(const char_t* rhs);
\r
474 // Add attribute with specified name. Returns added attribute, or empty attribute on errors.
\r
475 xml_attribute append_attribute(const char_t* name);
\r
476 xml_attribute prepend_attribute(const char_t* name);
\r
477 xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
\r
478 xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
\r
480 // Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
\r
481 xml_attribute append_copy(const xml_attribute& proto);
\r
482 xml_attribute prepend_copy(const xml_attribute& proto);
\r
483 xml_attribute insert_copy_after(const xml_attribute& proto, const xml_attribute& attr);
\r
484 xml_attribute insert_copy_before(const xml_attribute& proto, const xml_attribute& attr);
\r
486 // Add child node with specified type. Returns added node, or empty node on errors.
\r
487 xml_node append_child(xml_node_type type = node_element);
\r
488 xml_node prepend_child(xml_node_type type = node_element);
\r
489 xml_node insert_child_after(xml_node_type type, const xml_node& node);
\r
490 xml_node insert_child_before(xml_node_type type, const xml_node& node);
\r
492 // Add child element with specified name. Returns added node, or empty node on errors.
\r
493 xml_node append_child(const char_t* name);
\r
494 xml_node prepend_child(const char_t* name);
\r
495 xml_node insert_child_after(const char_t* name, const xml_node& node);
\r
496 xml_node insert_child_before(const char_t* name, const xml_node& node);
\r
498 // Add a copy of the specified node as a child. Returns added node, or empty node on errors.
\r
499 xml_node append_copy(const xml_node& proto);
\r
500 xml_node prepend_copy(const xml_node& proto);
\r
501 xml_node insert_copy_after(const xml_node& proto, const xml_node& node);
\r
502 xml_node insert_copy_before(const xml_node& proto, const xml_node& node);
\r
504 // Remove specified attribute
\r
505 bool remove_attribute(const xml_attribute& a);
\r
506 bool remove_attribute(const char_t* name);
\r
508 // Remove specified child
\r
509 bool remove_child(const xml_node& n);
\r
510 bool remove_child(const char_t* name);
\r
512 // Parses buffer as an XML document fragment and appends all nodes as children of the current node.
\r
513 // Copies/converts the buffer, so it may be deleted or changed after the function returns.
\r
514 // Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
\r
515 xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
517 // Find attribute using predicate. Returns first attribute for which predicate returned true.
\r
518 template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
\r
520 if (!_root) return xml_attribute();
\r
522 for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
\r
526 return xml_attribute();
\r
529 // Find child node using predicate. Returns first child for which predicate returned true.
\r
530 template <typename Predicate> xml_node find_child(Predicate pred) const
\r
532 if (!_root) return xml_node();
\r
534 for (xml_node node = first_child(); node; node = node.next_sibling())
\r
541 // Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
\r
542 template <typename Predicate> xml_node find_node(Predicate pred) const
\r
544 if (!_root) return xml_node();
\r
546 xml_node cur = first_child();
\r
548 while (cur._root && cur._root != _root)
\r
550 if (pred(cur)) return cur;
\r
552 if (cur.first_child()) cur = cur.first_child();
\r
553 else if (cur.next_sibling()) cur = cur.next_sibling();
\r
556 while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
\r
558 if (cur._root != _root) cur = cur.next_sibling();
\r
565 // Find child node by attribute name/value
\r
566 xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
\r
567 xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
\r
569 #ifndef PUGIXML_NO_STL
\r
570 // Get the absolute node path from root as a text string.
\r
571 string_t path(char_t delimiter = '/') const;
\r
574 // Search for a node by path consisting of node names and . or .. elements.
\r
575 xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
\r
577 // Recursively traverse subtree with xml_tree_walker
\r
578 bool traverse(xml_tree_walker& walker);
\r
580 #ifndef PUGIXML_NO_XPATH
\r
581 // Select single node by evaluating XPath query. Returns first node from the resulting node set.
\r
582 xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = 0) const;
\r
583 xpath_node select_single_node(const xpath_query& query) const;
\r
585 // Select node set by evaluating XPath query
\r
586 xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
\r
587 xpath_node_set select_nodes(const xpath_query& query) const;
\r
590 // Print subtree using a writer object
\r
591 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;
\r
593 #ifndef PUGIXML_NO_STL
\r
594 // Print subtree to stream
\r
595 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;
\r
596 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;
\r
599 // Child nodes iterators
\r
600 typedef xml_node_iterator iterator;
\r
602 iterator begin() const;
\r
603 iterator end() const;
\r
605 // Attribute iterators
\r
606 typedef xml_attribute_iterator attribute_iterator;
\r
608 attribute_iterator attributes_begin() const;
\r
609 attribute_iterator attributes_end() const;
\r
611 // Range-based for support
\r
612 xml_object_range<xml_node_iterator> children() const;
\r
613 xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
\r
614 xml_object_range<xml_attribute_iterator> attributes() const;
\r
616 // Get node offset in parsed file/string (in char_t units) for debugging purposes
\r
617 ptrdiff_t offset_debug() const;
\r
619 // Get hash value (unique for handles to the same object)
\r
620 size_t hash_value() const;
\r
622 // Get internal pointer
\r
623 xml_node_struct* internal_object() const;
\r
626 #ifdef __BORLANDC__
\r
627 // Borland C++ workaround
\r
628 bool PUGIXML_FUNCTION operator&&(const xml_node& lhs, bool rhs);
\r
629 bool PUGIXML_FUNCTION operator||(const xml_node& lhs, bool rhs);
\r
632 // A helper for working with text inside PCDATA nodes
\r
633 class PUGIXML_CLASS xml_text
\r
635 friend class xml_node;
\r
637 xml_node_struct* _root;
\r
639 typedef void (*unspecified_bool_type)(xml_text***);
\r
641 explicit xml_text(xml_node_struct* root);
\r
643 xml_node_struct* _data_new();
\r
644 xml_node_struct* _data() const;
\r
647 // Default constructor. Constructs an empty object.
\r
650 // Safe bool conversion operator
\r
651 operator unspecified_bool_type() const;
\r
653 // Borland C++ workaround
\r
654 bool operator!() const;
\r
656 // Check if text object is empty
\r
657 bool empty() const;
\r
659 // Get text, or "" if object is empty
\r
660 const char_t* get() const;
\r
662 // Get text, or the default value if object is empty
\r
663 const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
\r
665 // Get text as a number, or the default value if conversion did not succeed or object is empty
\r
666 int as_int(int def = 0) const;
\r
667 unsigned int as_uint(unsigned int def = 0) const;
\r
668 double as_double(double def = 0) const;
\r
669 float as_float(float def = 0) const;
\r
671 #ifdef PUGIXML_HAS_LONG_LONG
\r
672 long long as_llong(long long def = 0) const;
\r
673 unsigned long long as_ullong(unsigned long long def = 0) const;
\r
676 // Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
\r
677 bool as_bool(bool def = false) const;
\r
679 // Set text (returns false if object is empty or there is not enough memory)
\r
680 bool set(const char_t* rhs);
\r
682 // Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
\r
684 bool set(unsigned int rhs);
\r
685 bool set(double rhs);
\r
686 bool set(bool rhs);
\r
688 #ifdef PUGIXML_HAS_LONG_LONG
\r
689 bool set(long long rhs);
\r
690 bool set(unsigned long long rhs);
\r
693 // Set text (equivalent to set without error checking)
\r
694 xml_text& operator=(const char_t* rhs);
\r
695 xml_text& operator=(int rhs);
\r
696 xml_text& operator=(unsigned int rhs);
\r
697 xml_text& operator=(double rhs);
\r
698 xml_text& operator=(bool rhs);
\r
700 #ifdef PUGIXML_HAS_LONG_LONG
\r
701 xml_text& operator=(long long rhs);
\r
702 xml_text& operator=(unsigned long long rhs);
\r
705 // Get the data node (node_pcdata or node_cdata) for this object
\r
706 xml_node data() const;
\r
709 #ifdef __BORLANDC__
\r
710 // Borland C++ workaround
\r
711 bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs);
\r
712 bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs);
\r
715 // Child node iterator (a bidirectional iterator over a collection of xml_node)
\r
716 class PUGIXML_CLASS xml_node_iterator
\r
718 friend class xml_node;
\r
721 mutable xml_node _wrap;
\r
724 xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
\r
728 typedef ptrdiff_t difference_type;
\r
729 typedef xml_node value_type;
\r
730 typedef xml_node* pointer;
\r
731 typedef xml_node& reference;
\r
733 #ifndef PUGIXML_NO_STL
\r
734 typedef std::bidirectional_iterator_tag iterator_category;
\r
737 // Default constructor
\r
738 xml_node_iterator();
\r
740 // Construct an iterator which points to the specified node
\r
741 xml_node_iterator(const xml_node& node);
\r
743 // Iterator operators
\r
744 bool operator==(const xml_node_iterator& rhs) const;
\r
745 bool operator!=(const xml_node_iterator& rhs) const;
\r
747 xml_node& operator*() const;
\r
748 xml_node* operator->() const;
\r
750 const xml_node_iterator& operator++();
\r
751 xml_node_iterator operator++(int);
\r
753 const xml_node_iterator& operator--();
\r
754 xml_node_iterator operator--(int);
\r
757 // Attribute iterator (a bidirectional iterator over a collection of xml_attribute)
\r
758 class PUGIXML_CLASS xml_attribute_iterator
\r
760 friend class xml_node;
\r
763 mutable xml_attribute _wrap;
\r
766 xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
\r
770 typedef ptrdiff_t difference_type;
\r
771 typedef xml_attribute value_type;
\r
772 typedef xml_attribute* pointer;
\r
773 typedef xml_attribute& reference;
\r
775 #ifndef PUGIXML_NO_STL
\r
776 typedef std::bidirectional_iterator_tag iterator_category;
\r
779 // Default constructor
\r
780 xml_attribute_iterator();
\r
782 // Construct an iterator which points to the specified attribute
\r
783 xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
\r
785 // Iterator operators
\r
786 bool operator==(const xml_attribute_iterator& rhs) const;
\r
787 bool operator!=(const xml_attribute_iterator& rhs) const;
\r
789 xml_attribute& operator*() const;
\r
790 xml_attribute* operator->() const;
\r
792 const xml_attribute_iterator& operator++();
\r
793 xml_attribute_iterator operator++(int);
\r
795 const xml_attribute_iterator& operator--();
\r
796 xml_attribute_iterator operator--(int);
\r
799 // Named node range helper
\r
800 class PUGIXML_CLASS xml_named_node_iterator
\r
802 friend class xml_node;
\r
806 typedef ptrdiff_t difference_type;
\r
807 typedef xml_node value_type;
\r
808 typedef xml_node* pointer;
\r
809 typedef xml_node& reference;
\r
811 #ifndef PUGIXML_NO_STL
\r
812 typedef std::bidirectional_iterator_tag iterator_category;
\r
815 // Default constructor
\r
816 xml_named_node_iterator();
\r
818 // Construct an iterator which points to the specified node
\r
819 xml_named_node_iterator(const xml_node& node, const char_t* name);
\r
821 // Iterator operators
\r
822 bool operator==(const xml_named_node_iterator& rhs) const;
\r
823 bool operator!=(const xml_named_node_iterator& rhs) const;
\r
825 xml_node& operator*() const;
\r
826 xml_node* operator->() const;
\r
828 const xml_named_node_iterator& operator++();
\r
829 xml_named_node_iterator operator++(int);
\r
831 const xml_named_node_iterator& operator--();
\r
832 xml_named_node_iterator operator--(int);
\r
835 mutable xml_node _wrap;
\r
837 const char_t* _name;
\r
839 xml_named_node_iterator(xml_node_struct* ref, xml_node_struct* parent, const char_t* name);
\r
842 // Abstract tree walker class (see xml_node::traverse)
\r
843 class PUGIXML_CLASS xml_tree_walker
\r
845 friend class xml_node;
\r
851 // Get current traversal depth
\r
856 virtual ~xml_tree_walker();
\r
858 // Callback that is called when traversal begins
\r
859 virtual bool begin(xml_node& node);
\r
861 // Callback that is called for each node traversed
\r
862 virtual bool for_each(xml_node& node) = 0;
\r
864 // Callback that is called when traversal ends
\r
865 virtual bool end(xml_node& node);
\r
868 // Parsing status, returned as part of xml_parse_result object
\r
869 enum xml_parse_status
\r
871 status_ok = 0, // No error
\r
873 status_file_not_found, // File was not found during load_file()
\r
874 status_io_error, // Error reading from file/stream
\r
875 status_out_of_memory, // Could not allocate memory
\r
876 status_internal_error, // Internal error occurred
\r
878 status_unrecognized_tag, // Parser could not determine tag type
\r
880 status_bad_pi, // Parsing error occurred while parsing document declaration/processing instruction
\r
881 status_bad_comment, // Parsing error occurred while parsing comment
\r
882 status_bad_cdata, // Parsing error occurred while parsing CDATA section
\r
883 status_bad_doctype, // Parsing error occurred while parsing document type declaration
\r
884 status_bad_pcdata, // Parsing error occurred while parsing PCDATA section
\r
885 status_bad_start_element, // Parsing error occurred while parsing start element tag
\r
886 status_bad_attribute, // Parsing error occurred while parsing element attribute
\r
887 status_bad_end_element, // Parsing error occurred while parsing end element tag
\r
888 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)
\r
890 status_append_invalid_root, // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer)
\r
892 status_no_document_element // Parsing resulted in a document without element nodes
\r
896 struct PUGIXML_CLASS xml_parse_result
\r
898 // Parsing status (see xml_parse_status)
\r
899 xml_parse_status status;
\r
901 // Last parsed offset (in char_t units from start of input data)
\r
904 // Source document encoding
\r
905 xml_encoding encoding;
\r
907 // Default constructor, initializes object to failed state
\r
908 xml_parse_result();
\r
910 // Cast to bool operator
\r
911 operator bool() const;
\r
913 // Get error description
\r
914 const char* description() const;
\r
917 // Document class (DOM tree root)
\r
918 class PUGIXML_CLASS xml_document: public xml_node
\r
925 // Non-copyable semantics
\r
926 xml_document(const xml_document&);
\r
927 const xml_document& operator=(const xml_document&);
\r
933 // Default constructor, makes empty document
\r
936 // Destructor, invalidates all node/attribute handles to this document
\r
939 // Removes all nodes, leaving the empty document
\r
942 // Removes all nodes, then copies the entire contents of the specified document
\r
943 void reset(const xml_document& proto);
\r
945 #ifndef PUGIXML_NO_STL
\r
946 // Load document from stream.
\r
947 xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
948 xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
\r
951 // Load document from zero-terminated string. No encoding conversions are applied.
\r
952 xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
\r
954 // Load document from file
\r
955 xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
956 xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
958 // Load document from buffer. Copies/converts the buffer, so it may be deleted or changed after the function returns.
\r
959 xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
961 // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
\r
962 // You should ensure that buffer data will persist throughout the document's lifetime, and free the buffer memory manually once document is destroyed.
\r
963 xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
965 // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
\r
966 // 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).
\r
967 xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
\r
969 // Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
\r
970 void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
\r
972 #ifndef PUGIXML_NO_STL
\r
973 // Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
\r
974 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;
\r
975 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;
\r
978 // Save XML to file
\r
979 bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
\r
980 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;
\r
982 // Get document element
\r
983 xml_node document_element() const;
\r
986 #ifndef PUGIXML_NO_XPATH
\r
987 // XPath query return type
\r
988 enum xpath_value_type
\r
990 xpath_type_none, // Unknown type (query failed to compile)
\r
991 xpath_type_node_set, // Node set (xpath_node_set)
\r
992 xpath_type_number, // Number
\r
993 xpath_type_string, // String
\r
994 xpath_type_boolean // Boolean
\r
997 // XPath parsing result
\r
998 struct PUGIXML_CLASS xpath_parse_result
\r
1000 // Error message (0 if no error)
\r
1001 const char* error;
\r
1003 // Last parsed offset (in char_t units from string start)
\r
1006 // Default constructor, initializes object to failed state
\r
1007 xpath_parse_result();
\r
1009 // Cast to bool operator
\r
1010 operator bool() const;
\r
1012 // Get error description
\r
1013 const char* description() const;
\r
1016 // A single XPath variable
\r
1017 class PUGIXML_CLASS xpath_variable
\r
1019 friend class xpath_variable_set;
\r
1022 xpath_value_type _type;
\r
1023 xpath_variable* _next;
\r
1027 // Non-copyable semantics
\r
1028 xpath_variable(const xpath_variable&);
\r
1029 xpath_variable& operator=(const xpath_variable&);
\r
1032 // Get variable name
\r
1033 const char_t* name() const;
\r
1035 // Get variable type
\r
1036 xpath_value_type type() const;
\r
1038 // Get variable value; no type conversion is performed, default value (false, NaN, empty string, empty node set) is returned on type mismatch error
\r
1039 bool get_boolean() const;
\r
1040 double get_number() const;
\r
1041 const char_t* get_string() const;
\r
1042 const xpath_node_set& get_node_set() const;
\r
1044 // Set variable value; no type conversion is performed, false is returned on type mismatch error
\r
1045 bool set(bool value);
\r
1046 bool set(double value);
\r
1047 bool set(const char_t* value);
\r
1048 bool set(const xpath_node_set& value);
\r
1051 // A set of XPath variables
\r
1052 class PUGIXML_CLASS xpath_variable_set
\r
1055 xpath_variable* _data[64];
\r
1057 // Non-copyable semantics
\r
1058 xpath_variable_set(const xpath_variable_set&);
\r
1059 xpath_variable_set& operator=(const xpath_variable_set&);
\r
1061 xpath_variable* find(const char_t* name) const;
\r
1064 // Default constructor/destructor
\r
1065 xpath_variable_set();
\r
1066 ~xpath_variable_set();
\r
1068 // Add a new variable or get the existing one, if the types match
\r
1069 xpath_variable* add(const char_t* name, xpath_value_type type);
\r
1071 // Set value of an existing variable; no type conversion is performed, false is returned if there is no such variable or if types mismatch
\r
1072 bool set(const char_t* name, bool value);
\r
1073 bool set(const char_t* name, double value);
\r
1074 bool set(const char_t* name, const char_t* value);
\r
1075 bool set(const char_t* name, const xpath_node_set& value);
\r
1077 // Get existing variable by name
\r
1078 xpath_variable* get(const char_t* name);
\r
1079 const xpath_variable* get(const char_t* name) const;
\r
1082 // A compiled XPath query object
\r
1083 class PUGIXML_CLASS xpath_query
\r
1087 xpath_parse_result _result;
\r
1089 typedef void (*unspecified_bool_type)(xpath_query***);
\r
1091 // Non-copyable semantics
\r
1092 xpath_query(const xpath_query&);
\r
1093 xpath_query& operator=(const xpath_query&);
\r
1096 // Construct a compiled object from XPath expression.
\r
1097 // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
\r
1098 explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
\r
1103 // Get query expression return type
\r
1104 xpath_value_type return_type() const;
\r
1106 // Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
\r
1107 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
\r
1108 bool evaluate_boolean(const xpath_node& n) const;
\r
1110 // Evaluate expression as double value in the specified context; performs type conversion if necessary.
\r
1111 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
\r
1112 double evaluate_number(const xpath_node& n) const;
\r
1114 #ifndef PUGIXML_NO_STL
\r
1115 // Evaluate expression as string value in the specified context; performs type conversion if necessary.
\r
1116 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
\r
1117 string_t evaluate_string(const xpath_node& n) const;
\r
1120 // Evaluate expression as string value in the specified context; performs type conversion if necessary.
\r
1121 // At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
\r
1122 // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
\r
1123 // If PUGIXML_NO_EXCEPTIONS is defined, returns empty set instead.
\r
1124 size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
\r
1126 // Evaluate expression as node set in the specified context.
\r
1127 // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
\r
1128 // If PUGIXML_NO_EXCEPTIONS is defined, returns empty node set instead.
\r
1129 xpath_node_set evaluate_node_set(const xpath_node& n) const;
\r
1131 // Get parsing result (used to get compilation errors in PUGIXML_NO_EXCEPTIONS mode)
\r
1132 const xpath_parse_result& result() const;
\r
1134 // Safe bool conversion operator
\r
1135 operator unspecified_bool_type() const;
\r
1137 // Borland C++ workaround
\r
1138 bool operator!() const;
\r
1141 #ifndef PUGIXML_NO_EXCEPTIONS
\r
1142 // XPath exception class
\r
1143 class PUGIXML_CLASS xpath_exception: public std::exception
\r
1146 xpath_parse_result _result;
\r
1149 // Construct exception from parse result
\r
1150 explicit xpath_exception(const xpath_parse_result& result);
\r
1152 // Get error message
\r
1153 virtual const char* what() const throw();
\r
1155 // Get parse result
\r
1156 const xpath_parse_result& result() const;
\r
1160 // XPath node class (either xml_node or xml_attribute)
\r
1161 class PUGIXML_CLASS xpath_node
\r
1165 xml_attribute _attribute;
\r
1167 typedef void (*unspecified_bool_type)(xpath_node***);
\r
1170 // Default constructor; constructs empty XPath node
\r
1173 // Construct XPath node from XML node/attribute
\r
1174 xpath_node(const xml_node& node);
\r
1175 xpath_node(const xml_attribute& attribute, const xml_node& parent);
\r
1177 // Get node/attribute, if any
\r
1178 xml_node node() const;
\r
1179 xml_attribute attribute() const;
\r
1181 // Get parent of contained node/attribute
\r
1182 xml_node parent() const;
\r
1184 // Safe bool conversion operator
\r
1185 operator unspecified_bool_type() const;
\r
1187 // Borland C++ workaround
\r
1188 bool operator!() const;
\r
1190 // Comparison operators
\r
1191 bool operator==(const xpath_node& n) const;
\r
1192 bool operator!=(const xpath_node& n) const;
\r
1195 #ifdef __BORLANDC__
\r
1196 // Borland C++ workaround
\r
1197 bool PUGIXML_FUNCTION operator&&(const xpath_node& lhs, bool rhs);
\r
1198 bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
\r
1201 // A fixed-size collection of XPath nodes
\r
1202 class PUGIXML_CLASS xpath_node_set
\r
1205 // Collection type
\r
1208 type_unsorted, // Not ordered
\r
1209 type_sorted, // Sorted by document order (ascending)
\r
1210 type_sorted_reverse // Sorted by document order (descending)
\r
1213 // Constant iterator type
\r
1214 typedef const xpath_node* const_iterator;
\r
1216 // Default constructor. Constructs empty set.
\r
1219 // Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
\r
1220 xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
\r
1223 ~xpath_node_set();
\r
1225 // Copy constructor/assignment operator
\r
1226 xpath_node_set(const xpath_node_set& ns);
\r
1227 xpath_node_set& operator=(const xpath_node_set& ns);
\r
1229 // Get collection type
\r
1230 type_t type() const;
\r
1232 // Get collection size
\r
1233 size_t size() const;
\r
1235 // Indexing operator
\r
1236 const xpath_node& operator[](size_t index) const;
\r
1238 // Collection iterators
\r
1239 const_iterator begin() const;
\r
1240 const_iterator end() const;
\r
1242 // Sort the collection in ascending/descending order by document order
\r
1243 void sort(bool reverse = false);
\r
1245 // Get first node in the collection by document order
\r
1246 xpath_node first() const;
\r
1248 // Check if collection is empty
\r
1249 bool empty() const;
\r
1254 xpath_node _storage;
\r
1256 xpath_node* _begin;
\r
1259 void _assign(const_iterator begin, const_iterator end);
\r
1263 #ifndef PUGIXML_NO_STL
\r
1264 // Convert wide string to UTF8
\r
1265 std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
\r
1266 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);
\r
1268 // Convert UTF8 to wide string
\r
1269 std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
\r
1270 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);
\r
1273 // Memory allocation function interface; returns pointer to allocated memory or NULL on failure
\r
1274 typedef void* (*allocation_function)(size_t size);
\r
1276 // Memory deallocation function interface
\r
1277 typedef void (*deallocation_function)(void* ptr);
\r
1279 // Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
\r
1280 void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
\r
1282 // Get current memory management functions
\r
1283 allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
\r
1284 deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
\r
1287 #if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
\r
1290 // Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier)
\r
1291 std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&);
\r
1292 std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&);
\r
1293 std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&);
\r
1297 #if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
\r
1300 // Workarounds for (non-standard) iterator category detection
\r
1301 std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&);
\r
1302 std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&);
\r
1303 std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&);
\r
1310 * Copyright (c) 2006-2014 Arseny Kapoulkine
\r
1312 * Permission is hereby granted, free of charge, to any person
\r
1313 * obtaining a copy of this software and associated documentation
\r
1314 * files (the "Software"), to deal in the Software without
\r
1315 * restriction, including without limitation the rights to use,
\r
1316 * copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
1317 * copies of the Software, and to permit persons to whom the
\r
1318 * Software is furnished to do so, subject to the following
\r
1321 * The above copyright notice and this permission notice shall be
\r
1322 * included in all copies or substantial portions of the Software.
\r
1324 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
1325 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
\r
1326 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
1327 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
\r
1328 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
\r
1329 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
\r
1330 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
\r
1331 * OTHER DEALINGS IN THE SOFTWARE.
\r