Update pugixml to v1.12.1

This commit is contained in:
Zopolis4 2022-05-02 13:43:58 +10:00
parent dcf8bd7733
commit 8447c90378
No known key found for this signature in database
GPG Key ID: C1117D56FBC82774
3 changed files with 782 additions and 327 deletions

View File

@ -1,8 +1,8 @@
/** /**
* pugixml parser - version 1.8 * pugixml parser - version 1.12
* -------------------------------------------------------- * --------------------------------------------------------
* Copyright (C) 2006-2017, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at http://pugixml.org/ * Report bugs and download new versions at https://pugixml.org/
* *
* This library is distributed under the MIT License. See notice at the end * This library is distributed under the MIT License. See notice at the end
* of this file. * of this file.
@ -27,7 +27,7 @@
// #define PUGIXML_NO_STL // #define PUGIXML_NO_STL
// Uncomment this to disable exceptions // Uncomment this to disable exceptions
#define PUGIXML_NO_EXCEPTIONS // #define PUGIXML_NO_EXCEPTIONS
// Set this to control attributes for public classes/functions, i.e.: // Set this to control attributes for public classes/functions, i.e.:
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
@ -40,16 +40,19 @@
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240 // #define PUGIXML_MEMORY_OUTPUT_STACK 10240
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096 // #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
// Tune this constant to adjust max nesting for XPath queries
// #define PUGIXML_XPATH_DEPTH_LIMIT 1024
// Uncomment this to switch to header-only version // Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY // #define PUGIXML_HEADER_ONLY
// Uncomment this to enable long long support // Uncomment this to enable long long support
#define PUGIXML_HAS_LONG_LONG // #define PUGIXML_HAS_LONG_LONG
#endif #endif
/** /**
* Copyright (c) 2006-2017 Arseny Kapoulkine * Copyright (c) 2006-2022 Arseny Kapoulkine
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/** /**
* pugixml parser - version 1.8 * pugixml parser - version 1.12
* -------------------------------------------------------- * --------------------------------------------------------
* Copyright (C) 2006-2017, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at http://pugixml.org/ * Report bugs and download new versions at https://pugixml.org/
* *
* This library is distributed under the MIT License. See notice at the end * This library is distributed under the MIT License. See notice at the end
* of this file. * of this file.
@ -11,9 +11,10 @@
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/ */
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
// 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
#ifndef PUGIXML_VERSION #ifndef PUGIXML_VERSION
// Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons # define PUGIXML_VERSION 1120 // 1.12
# define PUGIXML_VERSION 180
#endif #endif
// Include user configuration file (this can define various configuration macros) // Include user configuration file (this can define various configuration macros)
@ -81,15 +82,44 @@
# endif # endif
#endif #endif
// If C++ is 2011 or higher, add 'noexcept' specifiers
#ifndef PUGIXML_NOEXCEPT
# if __cplusplus >= 201103
# define PUGIXML_NOEXCEPT noexcept
# elif defined(_MSC_VER) && _MSC_VER >= 1900
# define PUGIXML_NOEXCEPT noexcept
# else
# define PUGIXML_NOEXCEPT
# endif
#endif
// Some functions can not be noexcept in compact mode
#ifdef PUGIXML_COMPACT
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
#else
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT PUGIXML_NOEXCEPT
#endif
// If C++ is 2011 or higher, add 'override' qualifiers // If C++ is 2011 or higher, add 'override' qualifiers
#ifndef PUGIXML_OVERRIDE #ifndef PUGIXML_OVERRIDE
# if __cplusplus >= 201103 # if __cplusplus >= 201103
# define PUGIXML_OVERRIDE override # define PUGIXML_OVERRIDE override
# elif defined(_MSC_VER) && _MSC_VER >= 1700
# define PUGIXML_OVERRIDE override
# else # else
# define PUGIXML_OVERRIDE # define PUGIXML_OVERRIDE
# endif # endif
#endif #endif
// If C++ is 2011 or higher, use 'nullptr'
#ifndef PUGIXML_NULL
# if __cplusplus >= 201103
# define PUGIXML_NULL nullptr
# else
# define PUGIXML_NULL 0
# endif
#endif
// Character interface macros // Character interface macros
#ifdef PUGIXML_WCHAR_MODE #ifdef PUGIXML_WCHAR_MODE
# define PUGIXML_TEXT(t) L ## t # define PUGIXML_TEXT(t) L ## t
@ -232,10 +262,19 @@ namespace pugi
// 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. // 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.
const unsigned int format_no_empty_element_tags = 0x80; const unsigned int format_no_empty_element_tags = 0x80;
// Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
const unsigned int format_skip_control_chars = 0x100;
// Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
const unsigned int format_attribute_single_quote = 0x200;
// The default set of formatting flags. // The default set of formatting flags.
// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none. // Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
const unsigned int format_default = format_indent; const unsigned int format_default = format_indent;
const int default_double_precision = 17;
const int default_float_precision = 9;
// Forward declarations // Forward declarations
struct xml_attribute_struct; struct xml_attribute_struct;
struct xml_node_struct; struct xml_node_struct;
@ -273,6 +312,8 @@ namespace pugi
It begin() const { return _begin; } It begin() const { return _begin; }
It end() const { return _end; } It end() const { return _end; }
bool empty() const { return _begin == _end; }
private: private:
It _begin, _end; It _begin, _end;
}; };
@ -383,7 +424,9 @@ namespace pugi
bool set_value(long rhs); bool set_value(long rhs);
bool set_value(unsigned long rhs); bool set_value(unsigned long rhs);
bool set_value(double rhs); bool set_value(double rhs);
bool set_value(double rhs, int precision);
bool set_value(float rhs); bool set_value(float rhs);
bool set_value(float rhs, int precision);
bool set_value(bool rhs); bool set_value(bool rhs);
#ifdef PUGIXML_HAS_LONG_LONG #ifdef PUGIXML_HAS_LONG_LONG
@ -549,10 +592,16 @@ namespace pugi
bool remove_attribute(const xml_attribute& a); bool remove_attribute(const xml_attribute& a);
bool remove_attribute(const char_t* name); bool remove_attribute(const char_t* name);
// Remove all attributes
bool remove_attributes();
// Remove specified child // Remove specified child
bool remove_child(const xml_node& n); bool remove_child(const xml_node& n);
bool remove_child(const char_t* name); bool remove_child(const char_t* name);
// Remove all children
bool remove_children();
// Parses buffer as an XML document fragment and appends all nodes as children of the current node. // Parses buffer as an XML document fragment and appends all nodes as children of the current node.
// Copies/converts the buffer, so it may be deleted or changed after the function returns. // Copies/converts the buffer, so it may be deleted or changed after the function returns.
// Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory. // Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
@ -623,16 +672,16 @@ namespace pugi
#ifndef PUGIXML_NO_XPATH #ifndef PUGIXML_NO_XPATH
// Select single node by evaluating XPath query. Returns first node from the resulting node set. // Select single node by evaluating XPath query. Returns first node from the resulting node set.
xpath_node select_node(const char_t* query, xpath_variable_set* variables = 0) const; xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
xpath_node select_node(const xpath_query& query) const; xpath_node select_node(const xpath_query& query) const;
// Select node set by evaluating XPath query // Select node set by evaluating XPath query
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const; xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
xpath_node_set select_nodes(const xpath_query& query) const; xpath_node_set select_nodes(const xpath_query& query) const;
// (deprecated: use select_node instead) Select single node by evaluating XPath query. // (deprecated: use select_node instead) Select single node by evaluating XPath query.
xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = 0) const; PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
xpath_node select_single_node(const xpath_query& query) const; PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
#endif #endif
@ -734,7 +783,9 @@ namespace pugi
bool set(long rhs); bool set(long rhs);
bool set(unsigned long rhs); bool set(unsigned long rhs);
bool set(double rhs); bool set(double rhs);
bool set(double rhs, int precision);
bool set(float rhs); bool set(float rhs);
bool set(float rhs, int precision);
bool set(bool rhs); bool set(bool rhs);
#ifdef PUGIXML_HAS_LONG_LONG #ifdef PUGIXML_HAS_LONG_LONG
@ -802,10 +853,10 @@ namespace pugi
xml_node& operator*() const; xml_node& operator*() const;
xml_node* operator->() const; xml_node* operator->() const;
const xml_node_iterator& operator++(); xml_node_iterator& operator++();
xml_node_iterator operator++(int); xml_node_iterator operator++(int);
const xml_node_iterator& operator--(); xml_node_iterator& operator--();
xml_node_iterator operator--(int); xml_node_iterator operator--(int);
}; };
@ -844,10 +895,10 @@ namespace pugi
xml_attribute& operator*() const; xml_attribute& operator*() const;
xml_attribute* operator->() const; xml_attribute* operator->() const;
const xml_attribute_iterator& operator++(); xml_attribute_iterator& operator++();
xml_attribute_iterator operator++(int); xml_attribute_iterator operator++(int);
const xml_attribute_iterator& operator--(); xml_attribute_iterator& operator--();
xml_attribute_iterator operator--(int); xml_attribute_iterator operator--(int);
}; };
@ -880,10 +931,10 @@ namespace pugi
xml_node& operator*() const; xml_node& operator*() const;
xml_node* operator->() const; xml_node* operator->() const;
const xml_named_node_iterator& operator++(); xml_named_node_iterator& operator++();
xml_named_node_iterator operator++(int); xml_named_node_iterator operator++(int);
const xml_named_node_iterator& operator--(); xml_named_node_iterator& operator--();
xml_named_node_iterator operator--(int); xml_named_node_iterator operator--(int);
private: private:
@ -983,6 +1034,7 @@ namespace pugi
void _create(); void _create();
void _destroy(); void _destroy();
void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
public: public:
// Default constructor, makes empty document // Default constructor, makes empty document
@ -991,6 +1043,12 @@ namespace pugi
// Destructor, invalidates all node/attribute handles to this document // Destructor, invalidates all node/attribute handles to this document
~xml_document(); ~xml_document();
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
#endif
// Removes all nodes, leaving the empty document // Removes all nodes, leaving the empty document
void reset(); void reset();
@ -1004,7 +1062,7 @@ namespace pugi
#endif #endif
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied. // (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
xml_parse_result load(const char_t* contents, unsigned int options = parse_default); PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
// Load document from zero-terminated string. No encoding conversions are applied. // Load document from zero-terminated string. No encoding conversions are applied.
xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default); xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
@ -1131,8 +1189,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE #ifdef PUGIXML_HAS_MOVE
// Move semantics support // Move semantics support
xpath_variable_set(xpath_variable_set&& rhs); xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
xpath_variable_set& operator=(xpath_variable_set&& rhs); xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
#endif #endif
// Add a new variable or get the existing one, if the types match // Add a new variable or get the existing one, if the types match
@ -1165,7 +1223,7 @@ namespace pugi
public: public:
// Construct a compiled object from XPath expression. // Construct a compiled object from XPath expression.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors. // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0); explicit xpath_query(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL);
// Constructor // Constructor
xpath_query(); xpath_query();
@ -1175,8 +1233,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE #ifdef PUGIXML_HAS_MOVE
// Move semantics support // Move semantics support
xpath_query(xpath_query&& rhs); xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
xpath_query& operator=(xpath_query&& rhs); xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
#endif #endif
// Get query expression return type // Get query expression return type
@ -1224,6 +1282,12 @@ namespace pugi
}; };
#ifndef PUGIXML_NO_EXCEPTIONS #ifndef PUGIXML_NO_EXCEPTIONS
#if defined(_MSC_VER)
// C4275 can be ignored in Visual C++ if you are deriving
// from a type in the Standard C++ Library
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
// XPath exception class // XPath exception class
class PUGIXML_CLASS xpath_exception: public std::exception class PUGIXML_CLASS xpath_exception: public std::exception
{ {
@ -1240,6 +1304,9 @@ namespace pugi
// Get parse result // Get parse result
const xpath_parse_result& result() const; const xpath_parse_result& result() const;
}; };
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif #endif
// XPath node class (either xml_node or xml_attribute) // XPath node class (either xml_node or xml_attribute)
@ -1316,8 +1383,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE #ifdef PUGIXML_HAS_MOVE
// Move semantics support // Move semantics support
xpath_node_set(xpath_node_set&& rhs); xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
xpath_node_set& operator=(xpath_node_set&& rhs); xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
#endif #endif
// Get collection type // Get collection type
@ -1345,13 +1412,13 @@ namespace pugi
private: private:
type_t _type; type_t _type;
xpath_node _storage; xpath_node _storage[1];
xpath_node* _begin; xpath_node* _begin;
xpath_node* _end; xpath_node* _end;
void _assign(const_iterator begin, const_iterator end, type_t type); void _assign(const_iterator begin, const_iterator end, type_t type);
void _move(xpath_node_set& rhs); void _move(xpath_node_set& rhs) PUGIXML_NOEXCEPT;
}; };
#endif #endif
@ -1409,7 +1476,7 @@ namespace std
#endif #endif
/** /**
* Copyright (c) 2006-2017 Arseny Kapoulkine * Copyright (c) 2006-2022 Arseny Kapoulkine
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation