*** old2/rapidxml.hpp --- new2/rapidxml.hpp *************** *** 145,150 **** --- 145,152 ---- node_pi //!< A PI node. Name contains target. Value contains instructions. }; + const std::size_t auto_size = ~0; + /////////////////////////////////////////////////////////////////////// // Parsing flags *************** *** 406,425 **** //! \return Pointer to allocated node. This pointer will never be NULL. xml_node *allocate_node(node_type type, const Ch *name = 0, const Ch *value = 0, ! std::size_t name_size = 0, std::size_t value_size = 0) { void *memory = allocate_memory(sizeof(xml_node)); xml_node *node = new(memory) xml_node(type); if (name) { ! if (name_size > 0) node->name(name, name_size); else node->name(name); } if (value) { ! if (value_size > 0) node->value(value, value_size); else node->value(value); --- 408,427 ---- //! \return Pointer to allocated node. This pointer will never be NULL. xml_node *allocate_node(node_type type, const Ch *name = 0, const Ch *value = 0, ! std::size_t name_size = auto_size, std::size_t value_size = auto_size) { void *memory = allocate_memory(sizeof(xml_node)); xml_node *node = new(memory) xml_node(type); if (name) { ! if (name_size != auto_size) node->name(name, name_size); else node->name(name); } if (value) { ! if (value_size != auto_size) node->value(value, value_size); else node->value(value); *************** *** 437,456 **** //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string. //! \return Pointer to allocated attribute. This pointer will never be NULL. xml_attribute *allocate_attribute(const Ch *name = 0, const Ch *value = 0, ! std::size_t name_size = 0, std::size_t value_size = 0) { void *memory = allocate_memory(sizeof(xml_attribute)); xml_attribute *attribute = new(memory) xml_attribute; if (name) { ! if (name_size > 0) attribute->name(name, name_size); else attribute->name(name); } if (value) { ! if (value_size > 0) attribute->value(value, value_size); else attribute->value(value); --- 439,458 ---- //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string. //! \return Pointer to allocated attribute. This pointer will never be NULL. xml_attribute *allocate_attribute(const Ch *name = 0, const Ch *value = 0, ! std::size_t name_size = auto_size, std::size_t value_size = auto_size) { void *memory = allocate_memory(sizeof(xml_attribute)); xml_attribute *attribute = new(memory) xml_attribute; if (name) { ! if (name_size != auto_size) attribute->name(name, name_size); else attribute->name(name); } if (value) { ! if (value_size != auto_size) attribute->value(value, value_size); else attribute->value(value); *************** *** 465,474 **** //! \param source String to initialize the allocated memory with, or 0 to not initialize it. //! \param size Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated. //! \return Pointer to allocated char array. This pointer will never be NULL. ! Ch *allocate_string(const Ch *source = 0, std::size_t size = 0) { ! assert(source || size); // Either source or size (or both) must be specified ! if (size == 0) size = internal::measure(source) + 1; Ch *result = static_cast(allocate_memory(size)); if (source) --- 467,476 ---- //! \param source String to initialize the allocated memory with, or 0 to not initialize it. //! \param size Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated. //! \return Pointer to allocated char array. This pointer will never be NULL. ! Ch *allocate_string(const Ch *source = 0, std::size_t size = auto_size) { ! assert(source || size != auto_size); // Either source or size (or both) must be specified ! if (size == auto_size) size = internal::measure(source) + 1; Ch *result = static_cast(allocate_memory(size)); if (source)