Merge 5f55411972 into d62b2541d7
This commit is contained in:
commit
038b8ea261
@ -236,6 +236,15 @@ PUGI__NS_END
|
|||||||
PUGI__NS_BEGIN
|
PUGI__NS_BEGIN
|
||||||
template <typename T, typename D = void(*)(T*)> struct auto_deleter
|
template <typename T, typename D = void(*)(T*)> struct auto_deleter
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
auto_deleter(const auto_deleter&) = delete;
|
||||||
|
auto_deleter& operator=(const auto_deleter) = delete;
|
||||||
|
#else
|
||||||
|
auto_deleter(const auto_deleter&);
|
||||||
|
auto_deleter& operator=(const auto_deleter);
|
||||||
|
#endif
|
||||||
|
|
||||||
T* data;
|
T* data;
|
||||||
D deleter;
|
D deleter;
|
||||||
|
|
||||||
@ -483,7 +492,7 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
struct xml_allocator
|
struct xml_allocator
|
||||||
{
|
{
|
||||||
xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size)
|
explicit xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size)
|
||||||
{
|
{
|
||||||
#ifdef PUGIXML_COMPACT
|
#ifdef PUGIXML_COMPACT
|
||||||
_hash = 0;
|
_hash = 0;
|
||||||
@ -1030,7 +1039,7 @@ namespace pugi
|
|||||||
{
|
{
|
||||||
struct xml_attribute_struct
|
struct xml_attribute_struct
|
||||||
{
|
{
|
||||||
xml_attribute_struct(impl::xml_memory_page* page): header(page, 0), namevalue_base(0)
|
explicit xml_attribute_struct(impl::xml_memory_page* page): header(page, 0), namevalue_base(0)
|
||||||
{
|
{
|
||||||
PUGI__STATIC_ASSERT(sizeof(xml_attribute_struct) == 8);
|
PUGI__STATIC_ASSERT(sizeof(xml_attribute_struct) == 8);
|
||||||
}
|
}
|
||||||
@ -1075,7 +1084,7 @@ namespace pugi
|
|||||||
{
|
{
|
||||||
struct xml_attribute_struct
|
struct xml_attribute_struct
|
||||||
{
|
{
|
||||||
xml_attribute_struct(impl::xml_memory_page* page): header(reinterpret_cast<uintptr_t>(page)), name(0), value(0), prev_attribute_c(0), next_attribute(0)
|
explicit xml_attribute_struct(impl::xml_memory_page* page): header(reinterpret_cast<uintptr_t>(page)), name(0), value(0), prev_attribute_c(0), next_attribute(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1120,7 +1129,7 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
struct xml_document_struct: public xml_node_struct, public xml_allocator
|
struct xml_document_struct: public xml_node_struct, public xml_allocator
|
||||||
{
|
{
|
||||||
xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0)
|
explicit xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0)
|
||||||
{
|
{
|
||||||
#ifdef PUGIXML_COMPACT
|
#ifdef PUGIXML_COMPACT
|
||||||
_hash = &hash;
|
_hash = &hash;
|
||||||
@ -2898,12 +2907,21 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
struct xml_parser
|
struct xml_parser
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xml_parser(const xml_parser&) = delete;
|
||||||
|
xml_parser& operator=(const xml_parser) = delete;
|
||||||
|
#else
|
||||||
|
xml_parser(const xml_parser&);
|
||||||
|
xml_parser& operator=(const xml_parser);
|
||||||
|
#endif
|
||||||
|
|
||||||
xml_allocator alloc;
|
xml_allocator alloc;
|
||||||
xml_allocator* alloc_state;
|
xml_allocator* alloc_state;
|
||||||
char_t* error_offset;
|
char_t* error_offset;
|
||||||
xml_parse_status error_status;
|
xml_parse_status error_status;
|
||||||
|
|
||||||
xml_parser(xml_allocator* alloc_): alloc(*alloc_), alloc_state(alloc_), error_offset(0), error_status(status_ok)
|
explicit xml_parser(xml_allocator* alloc_): alloc(*alloc_), alloc_state(alloc_), error_offset(0), error_status(status_ok)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3142,7 +3160,6 @@ PUGI__NS_BEGIN
|
|||||||
{
|
{
|
||||||
// load into registers
|
// load into registers
|
||||||
xml_node_struct* cursor = ref_cursor;
|
xml_node_struct* cursor = ref_cursor;
|
||||||
char_t ch = 0;
|
|
||||||
|
|
||||||
// parse node contents, starting with question mark
|
// parse node contents, starting with question mark
|
||||||
++s;
|
++s;
|
||||||
@ -3160,6 +3177,8 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
if (declaration ? PUGI__OPTSET(parse_declaration) : PUGI__OPTSET(parse_pi))
|
if (declaration ? PUGI__OPTSET(parse_declaration) : PUGI__OPTSET(parse_pi))
|
||||||
{
|
{
|
||||||
|
char_t ch = 0;
|
||||||
|
|
||||||
if (declaration)
|
if (declaration)
|
||||||
{
|
{
|
||||||
// disallow non top-level declarations
|
// disallow non top-level declarations
|
||||||
@ -7430,7 +7449,16 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
struct xpath_allocator_capture
|
struct xpath_allocator_capture
|
||||||
{
|
{
|
||||||
xpath_allocator_capture(xpath_allocator* alloc): _target(alloc), _state(*alloc)
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xpath_allocator_capture(const xpath_allocator_capture&) = delete;
|
||||||
|
xpath_allocator_capture& operator=(const xpath_allocator_capture) = delete;
|
||||||
|
#else
|
||||||
|
xpath_allocator_capture(const xpath_allocator_capture&);
|
||||||
|
xpath_allocator_capture& operator=(const xpath_allocator_capture);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
explicit xpath_allocator_capture(xpath_allocator* alloc): _target(alloc), _state(*alloc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8148,7 +8176,7 @@ PUGI__NS_BEGIN
|
|||||||
const char_t* prefix;
|
const char_t* prefix;
|
||||||
size_t prefix_length;
|
size_t prefix_length;
|
||||||
|
|
||||||
namespace_uri_predicate(const char_t* name)
|
explicit namespace_uri_predicate(const char_t* name)
|
||||||
{
|
{
|
||||||
const char_t* pos = find_char(name, ':');
|
const char_t* pos = find_char(name, ':');
|
||||||
|
|
||||||
@ -8168,7 +8196,7 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
PUGI__FN const char_t* namespace_uri(xml_node node)
|
PUGI__FN const char_t* namespace_uri(xml_node node)
|
||||||
{
|
{
|
||||||
namespace_uri_predicate pred = node.name();
|
namespace_uri_predicate pred(node.name());
|
||||||
|
|
||||||
xml_node p = node;
|
xml_node p = node;
|
||||||
|
|
||||||
@ -8186,7 +8214,7 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
PUGI__FN const char_t* namespace_uri(xml_attribute attr, xml_node parent)
|
PUGI__FN const char_t* namespace_uri(xml_attribute attr, xml_node parent)
|
||||||
{
|
{
|
||||||
namespace_uri_predicate pred = attr.name();
|
namespace_uri_predicate pred(attr.name());
|
||||||
|
|
||||||
// Default namespace does not apply to attributes
|
// Default namespace does not apply to attributes
|
||||||
if (!pred.prefix) return PUGIXML_TEXT("");
|
if (!pred.prefix) return PUGIXML_TEXT("");
|
||||||
@ -8351,6 +8379,15 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
struct xpath_variable_string: xpath_variable
|
struct xpath_variable_string: xpath_variable
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xpath_variable_string(const xpath_variable_string&) = delete;
|
||||||
|
xpath_variable_string& operator=(const xpath_variable_string) = delete;
|
||||||
|
#else
|
||||||
|
xpath_variable_string(const xpath_variable_string&);
|
||||||
|
xpath_variable_string& operator=(const xpath_variable_string);
|
||||||
|
#endif
|
||||||
|
|
||||||
xpath_variable_string(): xpath_variable(xpath_type_string), value(0)
|
xpath_variable_string(): xpath_variable(xpath_type_string), value(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -240,7 +240,7 @@ namespace pugi
|
|||||||
typedef It const_iterator;
|
typedef It const_iterator;
|
||||||
typedef It iterator;
|
typedef It iterator;
|
||||||
|
|
||||||
xml_object_range(It b, It e): _begin(b), _end(e)
|
explicit xml_object_range(It b, It e): _begin(b), _end(e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,9 +264,18 @@ namespace pugi
|
|||||||
// xml_writer implementation for FILE*
|
// xml_writer implementation for FILE*
|
||||||
class PUGIXML_CLASS xml_writer_file: public xml_writer
|
class PUGIXML_CLASS xml_writer_file: public xml_writer
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xml_writer_file(const xml_writer_file&) = delete;
|
||||||
|
xml_writer_file& operator=(const xml_writer_file) = delete;
|
||||||
|
#else
|
||||||
|
xml_writer_file(const xml_writer_file&);
|
||||||
|
xml_writer_file& operator=(const xml_writer_file);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
|
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
|
||||||
xml_writer_file(void* file);
|
explicit xml_writer_file(void* file);
|
||||||
|
|
||||||
virtual void write(const void* data, size_t size);
|
virtual void write(const void* data, size_t size);
|
||||||
|
|
||||||
@ -278,10 +287,19 @@ namespace pugi
|
|||||||
// xml_writer implementation for streams
|
// xml_writer implementation for streams
|
||||||
class PUGIXML_CLASS xml_writer_stream: public xml_writer
|
class PUGIXML_CLASS xml_writer_stream: public xml_writer
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xml_writer_stream(const xml_writer_stream&) = delete;
|
||||||
|
xml_writer_stream& operator=(const xml_writer_stream) = delete;
|
||||||
|
#else
|
||||||
|
xml_writer_stream(const xml_writer_stream&);
|
||||||
|
xml_writer_stream& operator=(const xml_writer_stream);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Construct writer from an output stream object
|
// Construct writer from an output stream object
|
||||||
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
|
explicit xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
|
||||||
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
|
explicit xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
|
||||||
|
|
||||||
virtual void write(const void* data, size_t size);
|
virtual void write(const void* data, size_t size);
|
||||||
|
|
||||||
@ -784,7 +802,7 @@ namespace pugi
|
|||||||
mutable xml_attribute _wrap;
|
mutable xml_attribute _wrap;
|
||||||
xml_node _parent;
|
xml_node _parent;
|
||||||
|
|
||||||
xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
|
explicit xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Iterator traits
|
// Iterator traits
|
||||||
@ -801,7 +819,7 @@ namespace pugi
|
|||||||
xml_attribute_iterator();
|
xml_attribute_iterator();
|
||||||
|
|
||||||
// Construct an iterator which points to the specified attribute
|
// Construct an iterator which points to the specified attribute
|
||||||
xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
|
explicit xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
|
||||||
|
|
||||||
// Iterator operators
|
// Iterator operators
|
||||||
bool operator==(const xml_attribute_iterator& rhs) const;
|
bool operator==(const xml_attribute_iterator& rhs) const;
|
||||||
@ -837,7 +855,7 @@ namespace pugi
|
|||||||
xml_named_node_iterator();
|
xml_named_node_iterator();
|
||||||
|
|
||||||
// Construct an iterator which points to the specified node
|
// Construct an iterator which points to the specified node
|
||||||
xml_named_node_iterator(const xml_node& node, const char_t* name);
|
explicit xml_named_node_iterator(const xml_node& node, const char_t* name);
|
||||||
|
|
||||||
// Iterator operators
|
// Iterator operators
|
||||||
bool operator==(const xml_named_node_iterator& rhs) const;
|
bool operator==(const xml_named_node_iterator& rhs) const;
|
||||||
@ -938,14 +956,18 @@ namespace pugi
|
|||||||
// Document class (DOM tree root)
|
// Document class (DOM tree root)
|
||||||
class PUGIXML_CLASS xml_document: public xml_node
|
class PUGIXML_CLASS xml_document: public xml_node
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
char_t* _buffer;
|
|
||||||
|
|
||||||
char _memory[192];
|
|
||||||
|
|
||||||
// Non-copyable semantics
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xml_document(const xml_document&) = delete;
|
||||||
|
const xml_document& operator=(const xml_document&) = delete;
|
||||||
|
#else
|
||||||
xml_document(const xml_document&);
|
xml_document(const xml_document&);
|
||||||
const xml_document& operator=(const xml_document&);
|
const xml_document& operator=(const xml_document&);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
char_t* _buffer;
|
||||||
|
char _memory[192];
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
void destroy();
|
void destroy();
|
||||||
@ -1040,17 +1062,21 @@ namespace pugi
|
|||||||
// A single XPath variable
|
// A single XPath variable
|
||||||
class PUGIXML_CLASS xpath_variable
|
class PUGIXML_CLASS xpath_variable
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xpath_variable(const xpath_variable&) = delete;
|
||||||
|
xpath_variable& operator=(const xpath_variable&) = delete;
|
||||||
|
#else
|
||||||
|
xpath_variable(const xpath_variable&);
|
||||||
|
xpath_variable& operator=(const xpath_variable&);
|
||||||
|
#endif
|
||||||
friend class xpath_variable_set;
|
friend class xpath_variable_set;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
xpath_value_type _type;
|
xpath_value_type _type;
|
||||||
xpath_variable* _next;
|
xpath_variable* _next;
|
||||||
|
|
||||||
xpath_variable(xpath_value_type type);
|
explicit xpath_variable(xpath_value_type type);
|
||||||
|
|
||||||
// Non-copyable semantics
|
|
||||||
xpath_variable(const xpath_variable&);
|
|
||||||
xpath_variable& operator=(const xpath_variable&);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Get variable name
|
// Get variable name
|
||||||
@ -1118,16 +1144,21 @@ namespace pugi
|
|||||||
// A compiled XPath query object
|
// A compiled XPath query object
|
||||||
class PUGIXML_CLASS xpath_query
|
class PUGIXML_CLASS xpath_query
|
||||||
{
|
{
|
||||||
|
// Non-copyable semantics
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
xpath_query(const xpath_query&) = delete;
|
||||||
|
xpath_query& operator=(const xpath_query&) = delete;
|
||||||
|
#else
|
||||||
|
xpath_query(const xpath_query&);
|
||||||
|
xpath_query& operator=(const xpath_query&);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void* _impl;
|
void* _impl;
|
||||||
xpath_parse_result _result;
|
xpath_parse_result _result;
|
||||||
|
|
||||||
typedef void (*unspecified_bool_type)(xpath_query***);
|
typedef void (*unspecified_bool_type)(xpath_query***);
|
||||||
|
|
||||||
// Non-copyable semantics
|
|
||||||
xpath_query(const xpath_query&);
|
|
||||||
xpath_query& operator=(const xpath_query&);
|
|
||||||
|
|
||||||
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.
|
||||||
@ -1223,7 +1254,7 @@ namespace pugi
|
|||||||
|
|
||||||
// Construct XPath node from XML node/attribute
|
// Construct XPath node from XML node/attribute
|
||||||
xpath_node(const xml_node& node);
|
xpath_node(const xml_node& node);
|
||||||
xpath_node(const xml_attribute& attribute, const xml_node& parent);
|
explicit xpath_node(const xml_attribute& attribute, const xml_node& parent);
|
||||||
|
|
||||||
// Get node/attribute, if any
|
// Get node/attribute, if any
|
||||||
xml_node node() const;
|
xml_node node() const;
|
||||||
@ -1271,7 +1302,7 @@ namespace pugi
|
|||||||
xpath_node_set();
|
xpath_node_set();
|
||||||
|
|
||||||
// Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
|
// Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
|
||||||
xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
|
explicit xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~xpath_node_set();
|
~xpath_node_set();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user