From ca3f051fbf42b9abf7c22e3f58215cf5010f9727 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Fri, 24 Sep 2010 05:37:50 +0000 Subject: docs: Removed pugixpath.cpp mentions, updated evaluate_* arguments and added xpath_node ctor clarification, updated custom memory management description, updated CDATA printing information, added wide load_file/save_file documentation, added as_utf8/as_wide string overloads, fixed xml_node::root() complexity git-svn-id: http://pugixml.googlecode.com/svn/trunk@752 99668b35-9821-0410-8761-19e4c4f06640 --- docs/manual/dom.html | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'docs/manual/dom.html') diff --git a/docs/manual/dom.html b/docs/manual/dom.html index 2d65070..def86a5 100644 --- a/docs/manual/dom.html +++ b/docs/manual/dom.html @@ -371,9 +371,10 @@

- All tree functions that work with strings work with either C-style null terminated - strings or STL strings of the selected character type. For example, node - name accessors look like this in char mode: + $$ wording - one may think that child() has a string overload All tree functions + that work with strings work with either C-style null terminated strings or + STL strings of the selected character type. For example, node name accessors + look like this in char mode:

const char* xml_node::name() const;
 bool xml_node::set_name(const char* value);
@@ -416,7 +417,12 @@
         performs conversion from UTF-8 to UTF-16/32. Invalid UTF sequences are silently
         discarded upon conversion. str
         has to be a valid string; passing null pointer results in undefined behavior.
+        There are also two overloads with the same semantics which accept a string
+        as an argument:
       

+
std::string as_utf8(const std::wstring& str);
+std::wstring as_wide(const std::string& str);
+
@@ -493,7 +499,7 @@ guarantees beyond the ones provided by callback.

- XPath functions may throw xpath_exception + $$ XPath functions may throw xpath_exception on parsing error; also, XPath implementation uses STL, and thus may throw i.e. std::bad_alloc in low memory conditions. Still, XPath functions provide strong exception guarantee. @@ -514,10 +520,10 @@ functions

- All memory for tree structure/data is allocated via globally specified - functions, which default to malloc/free. You can set your own allocation - functions with set_memory_management functions. The function interfaces - are the same as that of malloc/free: + All memory for tree structure, tree data and XPath objects is allocated + via globally specified functions, which default to malloc/free. You can + set your own allocation functions with set_memory_management functions. + The function interfaces are the same as that of malloc/free:

typedef void* (*allocation_function)(size_t size);
 typedef void (*deallocation_function)(void* ptr);
@@ -533,13 +539,15 @@
 

Allocation function is called with the size (in bytes) as an argument and should return a pointer to memory block with alignment that is suitable - for pointer storage and size that is greater or equal to the requested - one. If the allocation fails, the function has to return null pointer (throwing - an exception from allocation function results in undefined behavior). Deallocation - function is called with the pointer that was returned by the previous call - or with a null pointer; null pointer deallocation should be handled as - a no-op. If memory management functions are not thread-safe, library thread - safety is not guaranteed. + for storage of primitive types (usually a maximum of pointer and double types alignment is sufficient) and + size that is greater or equal to the requested one. If the allocation fails, + the function has to return null pointer (throwing an exception from allocation + function results in undefined behavior). +

+

+ Deallocation function is called with the pointer that was returned by the + previous call; it is never called with a null pointer. If memory management + functions are not thread-safe, library thread safety is not guaranteed.

This is a simple example of custom memory management (samples/custom_memory_management.cpp): @@ -572,16 +580,6 @@ are destroyed, the new deallocation function will be called with the memory obtained by the old allocation function, resulting in undefined behavior.

-
[Note]
- - - - - -
[Note]Note

- Currently memory for XPath objects is allocated using default operators - new/delete; this will change in the next version. -

-- cgit v1.2.3