libdom
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
text.h File Reference
#include <stdbool.h>
#include <dom/core/exceptions.h>
#include <dom/core/text.h>
#include "core/characterdata.h"

Go to the source code of this file.

Classes

struct  dom_text
 

Macros

#define DOM_TEXT_VTABLE
 
#define DOM_TEXT_PROTECT_VTABLE
 
#define dom_text_copy_internal(o, n)    _dom_text_copy_internal((dom_text *) (o), (dom_text *) (n))
 

Functions

dom_exception _dom_text_create (struct 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, struct 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 (struct 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
 

Macro Definition Documentation

◆ dom_text_copy_internal

#define dom_text_copy_internal ( o,
n )    _dom_text_copy_internal((dom_text *) (o), (dom_text *) (n))

◆ DOM_TEXT_PROTECT_VTABLE

#define DOM_TEXT_PROTECT_VTABLE
Value:
void __dom_text_destroy(struct dom_node_internal *node)
Definition text.c:297
dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy)
Definition text.c:303

◆ DOM_TEXT_VTABLE

#define DOM_TEXT_VTABLE
Value:
dom_exception _dom_text_get_whole_text(dom_text *text, dom_string **result)
Definition text.c:254
dom_exception _dom_text_split_text(dom_text *text, uint32_t offset, dom_text **result)
Definition text.c:180
dom_exception _dom_text_get_is_element_content_whitespace(dom_text *text, bool *result)
Definition text.c:239
dom_exception _dom_text_replace_whole_text(dom_text *text, dom_string *content, dom_text **result)
Definition text.c:273

Function Documentation

◆ __dom_text_destroy()

void __dom_text_destroy ( struct 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
extern