libdom
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions | Variables
text.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <dom/core/string.h>
#include <dom/core/text.h>
#include <libwapcaplet/libwapcaplet.h>
#include "core/characterdata.h"
#include "core/document.h"
#include "core/text.h"
#include "utils/utils.h"

Typedefs

typedef enum walk_operation walk_operation
 
typedef enum walk_order walk_order
 

Enumerations

enum  walk_operation { COLLECT , DELETE }
 
enum  walk_order { LEFT , RIGHT }
 

Functions

dom_exception _dom_text_create (dom_document *doc, dom_string *name, dom_string *value, dom_text **result)
 
void _dom_text_destroy (dom_text *text)
 
dom_exception _dom_text_initialise (dom_text *text, dom_document *doc, dom_node_type type, dom_string *name, dom_string *value)
 
void _dom_text_finalise (dom_text *text)
 
dom_exception _dom_text_split_text (dom_text *text, uint32_t offset, dom_text **result)
 
dom_exception _dom_text_get_is_element_content_whitespace (dom_text *text, bool *result)
 
dom_exception _dom_text_get_whole_text (dom_text *text, dom_string **result)
 
dom_exception _dom_text_replace_whole_text (dom_text *text, dom_string *content, dom_text **result)
 
void __dom_text_destroy (dom_node_internal *node)
 
dom_exception _dom_text_copy (dom_node_internal *old, dom_node_internal **copy)
 
dom_exception _dom_text_copy_internal (dom_text *old, dom_text *new)
 

Variables

const struct dom_text_vtable text_vtable
 

Typedef Documentation

◆ walk_operation

◆ walk_order

typedef enum walk_order walk_order

Enumeration Type Documentation

◆ walk_operation

Enumerator
COLLECT 
DELETE 

◆ walk_order

enum walk_order
Enumerator
LEFT 
RIGHT 

Function Documentation

◆ __dom_text_destroy()

void __dom_text_destroy ( dom_node_internal * node)

◆ _dom_text_copy()

dom_exception _dom_text_copy ( dom_node_internal * old,
dom_node_internal ** copy )

◆ _dom_text_copy_internal()

dom_exception _dom_text_copy_internal ( dom_text * old,
dom_text * new )

◆ _dom_text_create()

dom_exception _dom_text_create ( dom_document * doc,
dom_string * name,
dom_string * value,
dom_text ** result )

Create a text node

Parameters
docThe owning document
nameThe name of the node to create
valueThe text content of the node
resultPointer to location to receive created node
Returns
DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion.

::doc, ::name and ::value will have their reference counts increased.

The returned node will already be referenced.

◆ _dom_text_destroy()

void _dom_text_destroy ( dom_text * text)

Destroy a text node

Parameters
docThe owning document
textThe text node to destroy

The contents of ::text will be destroyed and ::text will be freed.

◆ _dom_text_finalise()

void _dom_text_finalise ( dom_text * text)

Finalise a text node

Parameters
docThe owning document
textThe text node to finalise

The contents of ::text will be cleaned up. ::text will not be freed.

◆ _dom_text_get_is_element_content_whitespace()

dom_exception _dom_text_get_is_element_content_whitespace ( dom_text * text,
bool * result )

Determine if a text node contains element content whitespace

Parameters
textThe node to consider
resultPointer to location to receive result
Returns
DOM_NO_ERR.

◆ _dom_text_get_whole_text()

dom_exception _dom_text_get_whole_text ( dom_text * text,
dom_string ** result )

Retrieve all text in Text nodes logically adjacent to a Text node

Parameters
textText node to consider
resultPointer to location to receive result
Returns
DOM_NO_ERR.

◆ _dom_text_initialise()

dom_exception _dom_text_initialise ( dom_text * text,
dom_document * doc,
dom_node_type type,
dom_string * name,
dom_string * value )

Initialise a text node

Parameters
textThe node to initialise
docThe owning document
typeThe type of the node
nameThe name of the node to create
valueThe text content of the node
Returns
DOM_NO_ERR on success.

::doc, ::name and ::value will have their reference counts increased.

◆ _dom_text_replace_whole_text()

dom_exception _dom_text_replace_whole_text ( dom_text * text,
dom_string * content,
dom_text ** result )

Replace the text of a Text node and all logically adjacent Text nodes

Parameters
textText node to consider
contentReplacement content
resultPointer to location to receive Text node
Returns
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_text_split_text()

dom_exception _dom_text_split_text ( dom_text * text,
uint32_t offset,
dom_text ** result )

Split a text node at a given character offset

Parameters
textThe node to split
offsetCharacter offset to split at
resultPointer to location to receive new node
Returns
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.

Variable Documentation

◆ text_vtable

const struct dom_text_vtable text_vtable
Initial value:
= {
{
{
{
},
},
},
}
#define DOM_CHARACTERDATA_VTABLE
Definition characterdata.h:57
#define DOM_NODE_VTABLE_CHARACTERDATA
Definition characterdata.h:67
#define DOM_NODE_EVENT_TARGET_VTABLE
Definition node.h:188
#define DOM_TEXT_VTABLE
Definition text.h:54