diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2007-07-11 01:04:21 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2007-07-11 01:04:21 +0000 |
commit | a036dfb0d375b0c8c7dd014ad224f0980b09793c (patch) | |
tree | 4795ba27da0c5b7232a97ee34695cbe7b61ca513 /src | |
parent | 946f7833def1d1b49550063296a1a24bcbee11c3 (diff) | |
download | libdom-a036dfb0d375b0c8c7dd014ad224f0980b09793c.tar.gz libdom-a036dfb0d375b0c8c7dd014ad224f0980b09793c.tar.bz2 |
Make CharacterData struct public (within library)
Add Text.
svn path=/trunk/dom/; revision=3398
Diffstat (limited to 'src')
-rw-r--r-- | src/core/Makefile | 2 | ||||
-rw-r--r-- | src/core/characterdata.c | 9 | ||||
-rw-r--r-- | src/core/characterdata.h | 20 | ||||
-rw-r--r-- | src/core/text.c | 98 |
4 files changed, 120 insertions, 9 deletions
diff --git a/src/core/Makefile b/src/core/Makefile index 103e3f4..e30fd05 100644 --- a/src/core/Makefile +++ b/src/core/Makefile @@ -22,7 +22,7 @@ CFLAGS += -I$(CURDIR) # Objects -OBJS = attr characterdata document namednodemap node nodelist string +OBJS = attr characterdata document namednodemap node nodelist string text .PHONY: clean debug distclean export release setup test diff --git a/src/core/characterdata.c b/src/core/characterdata.c index 2dfd617..bfcf6a1 100644 --- a/src/core/characterdata.c +++ b/src/core/characterdata.c @@ -8,17 +8,10 @@ #include <dom/core/characterdata.h> #include <dom/core/string.h> -#include "core/node.h" +#include "core/characterdata.h" #include "utils/utils.h" /** - * DOM character data node - */ -struct dom_characterdata { - struct dom_node base; /**< Base node */ -}; - -/** * Retrieve data from a character data node * * \param cdata Character data node to retrieve data from diff --git a/src/core/characterdata.h b/src/core/characterdata.h new file mode 100644 index 0000000..d6809c3 --- /dev/null +++ b/src/core/characterdata.h @@ -0,0 +1,20 @@ +/* + * This file is part of libdom. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> + */ + +#ifndef dom_internal_core_characterdata_h_ +#define dom_internal_core_characterdata_h_ + +#include "core/node.h" + +/** + * DOM character data node + */ +struct dom_characterdata { + struct dom_node base; /**< Base node */ +}; + +#endif diff --git a/src/core/text.c b/src/core/text.c new file mode 100644 index 0000000..dd85bfe --- /dev/null +++ b/src/core/text.c @@ -0,0 +1,98 @@ +/* + * This file is part of libdom. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> + */ + +#include <dom/core/string.h> +#include <dom/core/text.h> + +#include "core/characterdata.h" +#include "utils/utils.h" + +struct dom_text { + struct dom_characterdata base; /**< Base node */ + + bool element_content_whitespace; /**< This node is element + * content whitespace */ +}; + +/** + * Split a text node at a given character offset + * + * \param text The node to split + * \param offset Character offset to split at + * \param result Pointer to location to receive new node + * \return DOM_NO_ERR on success, + * DOM_INDEX_SIZE_ERR if ::offset is greater than the + * number of characters in ::text, + * DOM_NO_MODIFICATION_ALLOWED_ERR if ::text is readonly. + * + * The returned node will be referenced. The client should unref the node + * once it has finished with it. + */ +dom_exception dom_text_split_text(struct dom_text *text, + unsigned long offset, struct dom_text **result) +{ + UNUSED(text); + UNUSED(offset); + UNUSED(result); + + return DOM_NOT_SUPPORTED_ERR; +} + +/** + * Determine if a text node contains element content whitespace + * + * \param text The node to consider + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + */ +dom_exception dom_text_get_is_element_content_whitespace( + struct dom_text *text, bool *result) +{ + *result = text->element_content_whitespace; + + return DOM_NO_ERR; +} + +/** + * Retrieve all text in Text nodes logically adjacent to a Text node + * + * \param text Text node to consider + * \param result Pointer to location to receive result + * \return DOM_NO_ERR. + */ +dom_exception dom_text_get_whole_text(struct dom_text *text, + struct dom_string **result) +{ + UNUSED(text); + UNUSED(result); + + return DOM_NOT_SUPPORTED_ERR; +} + +/** + * Replace the text of a Text node and all logically adjacent Text nodes + * + * \param text Text node to consider + * \param content Replacement content + * \param result Pointer to location to receive Text node + * \return DOM_NO_ERR on success, + * DOM_NO_MODIFICATION_ALLOWED_ERR if one of the Text nodes being + * replaced is readonly. + * + * The returned node will be referenced. The client should unref the node + * once it has finished with it. + */ +dom_exception dom_text_replace_whole_text(struct dom_text *text, + struct dom_string *content, struct dom_text **result) +{ + UNUSED(text); + UNUSED(content); + UNUSED(result); + + return DOM_NOT_SUPPORTED_ERR; +} + |