diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2007-07-06 21:42:18 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2007-07-06 21:42:18 +0000 |
commit | 7a9d61b0def3e8cff5b25892fdca5c8cdda4b628 (patch) | |
tree | 38200fb0d97551967a2d9063daaf28927c043902 /src/core/document.c | |
parent | 7f29141f5069d02843468785a54543a2f6d9260a (diff) | |
download | libdom-7a9d61b0def3e8cff5b25892fdca5c8cdda4b628.tar.gz libdom-7a9d61b0def3e8cff5b25892fdca5c8cdda4b628.tar.bz2 |
Purge all trace of the ballache that was dom_ctx.
Document the functions in document.c
svn path=/trunk/dom/; revision=3385
Diffstat (limited to 'src/core/document.c')
-rw-r--r-- | src/core/document.c | 577 |
1 files changed, 479 insertions, 98 deletions
diff --git a/src/core/document.c b/src/core/document.c index 1d54dfd..6edce6e 100644 --- a/src/core/document.c +++ b/src/core/document.c @@ -5,8 +5,10 @@ * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ +#include <dom/functypes.h> #include <dom/core/document.h> +#include "core/document.h" #include "core/node.h" #include "utils/utils.h" @@ -15,45 +17,83 @@ */ struct dom_document { struct dom_node base; /**< Base node */ -}; + dom_alloc alloc; /**< Memory (de)allocation function */ + void *pw; /**< Pointer to client data */ +}; -dom_exception dom_document_get_doctype(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_document_type **result) +/** + * Retrieve the doctype of a document + * + * \param doc The document to retrieve the doctype from + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_get_doctype(struct dom_document *doc, + struct dom_document_type **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_implementation(struct dom_ctx *ctx, - struct dom_document *doc, +/** + * Retrieve the DOM implementation that handles this document + * + * \param doc The document to retrieve the implementation from + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + */ +dom_exception dom_document_get_implementation(struct dom_document *doc, struct dom_implementation **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_element(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_element **result) +/** + * Retrieve the document element of a document + * + * \param doc The document to retrieve the document element from + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_get_element(struct dom_document *doc, + struct dom_element **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_element(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *tag_name, - struct dom_element **result) +/** + * Create an element + * + * \param doc The document owning the element + * \param tag_name The name of the element + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::tag_name is invalid. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_element(struct dom_document *doc, + struct dom_string *tag_name, struct dom_element **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(tag_name); UNUSED(result); @@ -61,21 +101,41 @@ dom_exception dom_document_create_element(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_document_fragment(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_node **result) +/** + * Create a document fragment + * + * \param doc The document owning the fragment + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_document_fragment(struct dom_document *doc, + struct dom_node **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_text_node(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *data, - struct dom_text **result) +/** + * Create a text node + * + * \param doc The document owning the node + * \param data The data for the node + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_text_node(struct dom_document *doc, + struct dom_string *data, struct dom_text **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(data); UNUSED(result); @@ -83,11 +143,22 @@ dom_exception dom_document_create_text_node(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_cdata_section(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *data, - struct dom_text **result) +/** + * Create a CDATA section + * + * \param doc The document owning the section + * \param data The data for the section contents + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_NOT_SUPPORTED_ERR if this is an HTML document. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_cdata_section(struct dom_document *doc, + struct dom_string *data, struct dom_text **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(data); UNUSED(result); @@ -95,12 +166,26 @@ dom_exception dom_document_create_cdata_section(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_processing_instruction(struct dom_ctx *ctx, +/** + * Create a processing instruction + * + * \param doc The document owning the instruction + * \param target The instruction target + * \param data The data for the node + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::target is invalid, + * DOM_NOT_SUPPORTED_ERR if this is an HTML document. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_processing_instruction( struct dom_document *doc, struct dom_string *target, struct dom_string *data, struct dom_node **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(target); UNUSED(data); @@ -109,11 +194,22 @@ dom_exception dom_document_create_processing_instruction(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_attribute(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *name, - struct dom_attr **result) +/** + * Create an attribute + * + * \param doc The document owning the attribute + * \param name The name of the attribute + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::name is invalid. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_attribute(struct dom_document *doc, + struct dom_string *name, struct dom_attr **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(name); UNUSED(result); @@ -121,11 +217,23 @@ dom_exception dom_document_create_attribute(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_entity_reference(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *name, - struct dom_node **result) +/** + * Create an entity reference + * + * \param doc The document owning the reference + * \param name The name of the entity to reference + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::name is invalid, + * DOM_NOT_SUPPORTED_ERR if this is an HTML document. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_entity_reference(struct dom_document *doc, + struct dom_string *name, struct dom_node **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(name); UNUSED(result); @@ -133,11 +241,21 @@ dom_exception dom_document_create_entity_reference(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_elements_by_tag_name(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *tagname, - struct dom_nodelist **result) +/** + * Retrieve a list of all elements with a given tag name + * + * \param doc The document to search in + * \param tagname The tag name to search for ("*" for all) + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned list will have its reference count increased. It is + * the responsibility of the caller to unref the list once it has + * finished with it. + */ +dom_exception dom_document_get_elements_by_tag_name(struct dom_document *doc, + struct dom_string *tagname, struct dom_nodelist **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(tagname); UNUSED(result); @@ -145,11 +263,24 @@ dom_exception dom_document_get_elements_by_tag_name(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_import_node(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_node *node, - bool deep, struct dom_node **result) +/** + * Import a node from another document into this one + * + * \param doc The document to import into + * \param node The node to import + * \param deep Whether to copy the node's subtree + * \param result Pointer to location to receive imported node in this document. + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if any of the names are invalid, + * DOM_NOT_SUPPORTED_ERR if the type of ::node is unsupported + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_import_node(struct dom_document *doc, + struct dom_node *node, bool deep, struct dom_node **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(node); UNUSED(deep); @@ -158,11 +289,38 @@ dom_exception dom_document_import_node(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_element_ns(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *namespace, - struct dom_string *qname, struct dom_element **result) +/** + * Create an element from the qualified name and namespace URI + * + * \param doc The document owning the element + * \param namespace The namespace URI to use + * \param qname The qualified name of the element + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::tag_name is invalid, + * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a + * prefix and ::namespace is NULL, or + * ::qname has a prefix "xml" and + * ::namespace is not + * "http://www.w3.org/XML/1998/namespace", + * or ::qname has a prefix "xmlns" and + * ::namespace is not + * "http://www.w3.org/2000/xmlns", or + * ::namespace is + * "http://www.w3.org/2000/xmlns" and + * ::qname is not (or is not prefixed by) + * "xmlns", + * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" + * feature. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_element_ns(struct dom_document *doc, + struct dom_string *namespace, struct dom_string *qname, + struct dom_element **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(namespace); UNUSED(qname); @@ -171,11 +329,38 @@ dom_exception dom_document_create_element_ns(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_create_attribute_ns(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *namespace, - struct dom_string *qname, struct dom_attr **result) +/** + * Create an attribute from the qualified name and namespace URI + * + * \param doc The document owning the attribute + * \param namespace The namespace URI to use + * \param qname The qualified name of the attribute + * \param result Pointer to location to receive result + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::tag_name is invalid, + * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a + * prefix and ::namespace is NULL, or + * ::qname has a prefix "xml" and + * ::namespace is not + * "http://www.w3.org/XML/1998/namespace", + * or ::qname has a prefix "xmlns" and + * ::namespace is not + * "http://www.w3.org/2000/xmlns", or + * ::namespace is + * "http://www.w3.org/2000/xmlns" and + * ::qname is not (or is not prefixed by) + * "xmlns", + * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" + * feature. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_create_attribute_ns(struct dom_document *doc, + struct dom_string *namespace, struct dom_string *qname, + struct dom_attr **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(namespace); UNUSED(qname); @@ -184,11 +369,23 @@ dom_exception dom_document_create_attribute_ns(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_elements_by_tag_name_ns(struct dom_ctx *ctx, +/** + * Retrieve a list of all elements with a given local name and namespace URI + * + * \param doc The document to search in + * \param namespace The namespace URI + * \param localname The local name + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned list will have its reference count increased. It is + * the responsibility of the caller to unref the list once it has + * finished with it. + */ +dom_exception dom_document_get_elements_by_tag_name_ns( struct dom_document *doc, struct dom_string *namespace, struct dom_string *localname, struct dom_nodelist **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(namespace); UNUSED(localname); @@ -197,11 +394,21 @@ dom_exception dom_document_get_elements_by_tag_name_ns(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_element_by_id(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *id, - struct dom_element **result) +/** + * Retrieve the element that matches the specified ID + * + * \param doc The document to search in + * \param id The ID to search for + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_get_element_by_id(struct dom_document *doc, + struct dom_string *id, struct dom_element **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(id); UNUSED(result); @@ -209,111 +416,208 @@ dom_exception dom_document_get_element_by_id(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_input_encoding(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string **result) +/** + * Retrieve the input encoding of the document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned string will have its reference count increased. It is + * the responsibility of the caller to unref the string once it has + * finished with it. + */ +dom_exception dom_document_get_input_encoding(struct dom_document *doc, + struct dom_string **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_xml_encoding(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string **result) +/** + * Retrieve the XML encoding of the document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned string will have its reference count increased. It is + * the responsibility of the caller to unref the string once it has + * finished with it. + */ +dom_exception dom_document_get_xml_encoding(struct dom_document *doc, + struct dom_string **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_xml_standalone(struct dom_ctx *ctx, - struct dom_document *doc, bool *result) +/** + * Retrieve the standalone status of the document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + */ +dom_exception dom_document_get_xml_standalone(struct dom_document *doc, + bool *result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_set_xml_standalone(struct dom_ctx *ctx, - struct dom_document *doc, bool standalone) +/** + * Set the standalone status of the document + * + * \param doc The document to query + * \param standalone Standalone status to use + * \return DOM_NO_ERR on success, + * DOM_NOT_SUPPORTED_ERR if the document does not support the "XML" + * feature. + */ +dom_exception dom_document_set_xml_standalone(struct dom_document *doc, + bool standalone) { - UNUSED(ctx); UNUSED(doc); UNUSED(standalone); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_xml_version(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string **result) +/** + * Retrieve the XML version of the document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned string will have its reference count increased. It is + * the responsibility of the caller to unref the string once it has + * finished with it. + */ +dom_exception dom_document_get_xml_version(struct dom_document *doc, + struct dom_string **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_set_xml_version(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *version) +/** + * Set the XML version of the document + * + * \param doc The document to query + * \param version XML version to use + * \return DOM_NO_ERR on success, + * DOM_NOT_SUPPORTED_ERR if the document does not support the "XML" + * feature. + */ +dom_exception dom_document_set_xml_version(struct dom_document *doc, + struct dom_string *version) { - UNUSED(ctx); UNUSED(doc); UNUSED(version); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_strict_error_checking(struct dom_ctx *ctx, +/** + * Retrieve the error checking mode of the document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + */ +dom_exception dom_document_get_strict_error_checking( struct dom_document *doc, bool *result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_set_strict_error_checking(struct dom_ctx *ctx, +/** + * Set the error checking mode of the document + * + * \param doc The document to query + * \param strict Whether to use strict error checking + * \return DOM_NO_ERR. + */ +dom_exception dom_document_set_strict_error_checking( struct dom_document *doc, bool strict) { - UNUSED(ctx); UNUSED(doc); UNUSED(strict); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_uri(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string **result) +/** + * Retrieve the URI of the document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned string will have its reference count increased. It is + * the responsibility of the caller to unref the string once it has + * finished with it. + */ +dom_exception dom_document_get_uri(struct dom_document *doc, + struct dom_string **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_set_uri(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_string *uri) +/** + * Set the URI of the document + * + * \param doc The document to query + * \param uri The URI to use + * \return DOM_NO_ERR. + * + * The returned string will have its reference count increased. It is + * the responsibility of the caller to unref the string once it has + * finished with it. + */ +dom_exception dom_document_set_uri(struct dom_document *doc, + struct dom_string *uri) { - UNUSED(ctx); UNUSED(doc); UNUSED(uri); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_adopt_node(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_node *node, - struct dom_node **result) +/** + * Attempt to adopt a node from another document into this document + * + * \param doc The document to adopt into + * \param node The node to adopt + * \param result Pointer to location to receive adopted node + * \return DOM_NO_ERR on success, + * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly, + * DOM_NOT_SUPPORTED_ERR if ::node is of type Document or + * DocumentType + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_adopt_node(struct dom_document *doc, + struct dom_node *node, struct dom_node **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(node); UNUSED(result); @@ -321,31 +625,75 @@ dom_exception dom_document_adopt_node(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_get_dom_config(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_configuration **result) +/** + * Retrieve the DOM configuration associated with a document + * + * \param doc The document to query + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + * + * The returned object will have its reference count increased. It is + * the responsibility of the caller to unref the object once it has + * finished with it. + */ +dom_exception dom_document_get_dom_config(struct dom_document *doc, + struct dom_configuration **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_normalize(struct dom_ctx *ctx, - struct dom_document *doc) +/** + * Normalize a document + * + * \param doc The document to normalize + * \return DOM_NO_ERR. + */ +dom_exception dom_document_normalize(struct dom_document *doc) { - UNUSED(ctx); UNUSED(doc); return DOM_NOT_SUPPORTED_ERR; } -dom_exception dom_document_rename_node(struct dom_ctx *ctx, - struct dom_document *doc, struct dom_node *node, +/** + * Rename a node in a document + * + * \param doc The document containing the node + * \param node The node to rename + * \param namespace The new namespace for the node + * \param qname The new qualified name for the node + * \param result Pointer to location to receive renamed node + * \return DOM_NO_ERR on success, + * DOM_INVALID_CHARACTER_ERR if ::tag_name is invalid, + * DOM_WRONG_DOCUMENT_ERR if ::node was created in a different + * document + * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a + * prefix and ::namespace is NULL, or + * ::qname has a prefix "xml" and + * ::namespace is not + * "http://www.w3.org/XML/1998/namespace", + * or ::qname has a prefix "xmlns" and + * ::namespace is not + * "http://www.w3.org/2000/xmlns", or + * ::namespace is + * "http://www.w3.org/2000/xmlns" and + * ::qname is not (or is not prefixed by) + * "xmlns", + * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" + * feature. + * + * The returned node will have its reference count increased. It is + * the responsibility of the caller to unref the node once it has + * finished with it. + */ +dom_exception dom_document_rename_node(struct dom_document *doc, + struct dom_node *node, struct dom_string *namespace, struct dom_string *qname, struct dom_node **result) { - UNUSED(ctx); UNUSED(doc); UNUSED(node); UNUSED(namespace); @@ -354,3 +702,36 @@ dom_exception dom_document_rename_node(struct dom_ctx *ctx, return DOM_NOT_SUPPORTED_ERR; } + +/** + * Acquire a pointer to the base of the document buffer + * + * \param doc Document to retrieve pointer from + * \return Pointer to document buffer + * + * The document buffer is _not_ reference counted (as it is an implicit part + * of the document). It is destroyed with the document, and thus after all + * users have been destroyed. + */ +const uint8_t *dom_document_get_base(struct dom_document *doc) +{ + UNUSED(doc); + + return NULL; +} + +/** + * (De)allocate memory with a document's context + * + * \param doc The document context to allocate from + * \param ptr Pointer to data to reallocate, or NULL to alloc new + * \param size Required size of data, or 0 to free + * \return Pointer to allocated data or NULL on failure + * + * This call (modulo ::doc) has the same semantics as realloc(). + * It is a thin veneer over the client-provided allocation function. + */ +void *dom_document_alloc(struct dom_document *doc, void *ptr, size_t size) +{ + return doc->alloc(ptr, size, doc->pw); +} |