libdom
Loading...
Searching...
No Matches
characterdata.h File Reference
#include <dom/core/characterdata.h>
#include "core/node.h"

Go to the source code of this file.

Classes

struct  dom_characterdata
 

Macros

#define DOM_CHARACTERDATA_VTABLE
 
#define DOM_NODE_VTABLE_CHARACTERDATA
 
#define DOM_CHARACTERDATA_PROTECT_VTABLE
 
#define dom_characterdata_copy_internal(o, n)
 

Functions

dom_characterdata_dom_characterdata_create (void)
 
dom_exception _dom_characterdata_initialise (struct dom_characterdata *cdata, struct dom_document *doc, dom_node_type type, dom_string *name, dom_string *value)
 
void _dom_characterdata_finalise (struct dom_characterdata *cdata)
 
dom_exception _dom_characterdata_get_data (struct dom_characterdata *cdata, dom_string **data)
 
dom_exception _dom_characterdata_set_data (struct dom_characterdata *cdata, dom_string *data)
 
dom_exception _dom_characterdata_get_length (struct dom_characterdata *cdata, uint32_t *length)
 
dom_exception _dom_characterdata_substring_data (struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string **data)
 
dom_exception _dom_characterdata_append_data (struct dom_characterdata *cdata, dom_string *data)
 
dom_exception _dom_characterdata_insert_data (struct dom_characterdata *cdata, uint32_t offset, dom_string *data)
 
dom_exception _dom_characterdata_delete_data (struct dom_characterdata *cdata, uint32_t offset, uint32_t count)
 
dom_exception _dom_characterdata_replace_data (struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string *data)
 
dom_exception _dom_characterdata_get_text_content (dom_node_internal *node, dom_string **result)
 
dom_exception _dom_characterdata_set_text_content (dom_node_internal *node, dom_string *content)
 
void _dom_characterdata_destroy (dom_node_internal *node)
 
dom_exception _dom_characterdata_copy (dom_node_internal *old, dom_node_internal **copy)
 
dom_exception _dom_characterdata_copy_internal (dom_characterdata *old, dom_characterdata *new)
 

Variables

const struct dom_characterdata_vtable characterdata_vtable
 

Macro Definition Documentation

◆ dom_characterdata_copy_internal

#define dom_characterdata_copy_internal ( o,
n )
Value:
dom_exception _dom_characterdata_copy_internal(dom_characterdata *old, dom_characterdata *new)
Definition characterdata.c:508
Definition characterdata.h:18

◆ DOM_CHARACTERDATA_PROTECT_VTABLE

#define DOM_CHARACTERDATA_PROTECT_VTABLE
Value:
void _dom_characterdata_destroy(dom_node_internal *node)
Definition characterdata.c:480
dom_exception _dom_characterdata_copy(dom_node_internal *old, dom_node_internal **copy)
Definition characterdata.c:487

◆ DOM_CHARACTERDATA_VTABLE

#define DOM_CHARACTERDATA_VTABLE
Value:
dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, uint32_t offset, dom_string *data)
Definition characterdata.c:277
dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, uint32_t *length)
Definition characterdata.c:161
dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, dom_string **data)
Definition characterdata.c:99
dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, dom_string *data)
Definition characterdata.c:124
dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, dom_string *data)
Definition characterdata.c:228
dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count)
Definition characterdata.c:339
dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string *data)
Definition characterdata.c:408
dom_exception _dom_characterdata_substring_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string **data)
Definition characterdata.c:194

◆ DOM_NODE_VTABLE_CHARACTERDATA

#define DOM_NODE_VTABLE_CHARACTERDATA

Function Documentation

◆ _dom_characterdata_append_data()

dom_exception _dom_characterdata_append_data ( struct dom_characterdata * cdata,
dom_string * data )

Append data to the end of a character data node's content

Parameters
cdataThe node to append data to
dataThe data to append
Returns
DOM_NO_ERR on success, DOM_NO_MODIFICATION_ALLOWED_ERR if cdata is readonly.

◆ _dom_characterdata_copy()

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

◆ _dom_characterdata_copy_internal()

dom_exception _dom_characterdata_copy_internal ( dom_characterdata * old,
dom_characterdata * new )

◆ _dom_characterdata_create()

dom_characterdata * _dom_characterdata_create ( void )

◆ _dom_characterdata_delete_data()

dom_exception _dom_characterdata_delete_data ( struct dom_characterdata * cdata,
uint32_t offset,
uint32_t count )

Delete data from a character data node's content

Parameters
cdataThe node to delete from
offsetThe character offset to start deletion from
countThe number of characters to delete
Returns
DOM_NO_ERR on success, DOM_INDEX_SIZE_ERR if offset is negative or greater than the number of characters in cdata or count is negative, DOM_NO_MODIFICATION_ALLOWED_ERR if cdata is readonly.

◆ _dom_characterdata_destroy()

void _dom_characterdata_destroy ( dom_node_internal * node)

◆ _dom_characterdata_finalise()

void _dom_characterdata_finalise ( struct dom_characterdata * cdata)

Finalise a character data node

Parameters
cdataThe node to finalise

The contents of cdata will be cleaned up. cdata will not be freed.

◆ _dom_characterdata_get_data()

dom_exception _dom_characterdata_get_data ( struct dom_characterdata * cdata,
dom_string ** data )

Retrieve data from a character data node

Parameters
cdataCharacter data node to retrieve data from
dataPointer to location to receive data
Returns
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.

DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in this implementation; dom_strings are unbounded.

◆ _dom_characterdata_get_length()

dom_exception _dom_characterdata_get_length ( struct dom_characterdata * cdata,
uint32_t * length )

Get the length (in characters) of a character data node's content

Parameters
cdataNode to read content length of
lengthPointer to location to receive character length of content
Returns
DOM_NO_ERR.

◆ _dom_characterdata_get_text_content()

dom_exception _dom_characterdata_get_text_content ( dom_node_internal * node,
dom_string ** result )

◆ _dom_characterdata_initialise()

dom_exception _dom_characterdata_initialise ( struct dom_characterdata * cdata,
struct dom_document * doc,
dom_node_type type,
dom_string * name,
dom_string * value )

Initialise a character data node

Parameters
cdataThe character data node to initialise
docThe document which owns the node
typeThe node type required
nameThe node name, or NULL
valueThe node value, or NULL
Returns
DOM_NO_ERR on success.

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

◆ _dom_characterdata_insert_data()

dom_exception _dom_characterdata_insert_data ( struct dom_characterdata * cdata,
uint32_t offset,
dom_string * data )

Insert data into a character data node's content

Parameters
cdataThe node to insert into
offsetThe character offset to insert at
dataThe data to insert
Returns
DOM_NO_ERR on success, DOM_INDEX_SIZE_ERR if offset is negative or greater than the number of characters in cdata, DOM_NO_MODIFICATION_ALLOWED_ERR if cdata is readonly.

◆ _dom_characterdata_replace_data()

dom_exception _dom_characterdata_replace_data ( struct dom_characterdata * cdata,
uint32_t offset,
uint32_t count,
dom_string * data )

Replace a section of a character data node's content

Parameters
cdataThe node to modify
offsetThe character offset of the sequence to replace
countThe number of characters to replace
dataThe replacement data
Returns
DOM_NO_ERR on success, DOM_INDEX_SIZE_ERR if offset is negative or greater than the number of characters in cdata or count is negative, DOM_NO_MODIFICATION_ALLOWED_ERR if cdata is readonly.

◆ _dom_characterdata_set_data()

dom_exception _dom_characterdata_set_data ( struct dom_characterdata * cdata,
dom_string * data )

Set the content of a character data node

Parameters
cdataNode to set the content of
dataNew value for node
Returns
DOM_NO_ERR on success, DOM_NO_MODIFICATION_ALLOWED_ERR if cdata is readonly.

The new content will have its reference count increased, so the caller should unref it after the call (as the caller should have already claimed a reference on the string). The node's existing content will be unrefed.

◆ _dom_characterdata_set_text_content()

dom_exception _dom_characterdata_set_text_content ( dom_node_internal * node,
dom_string * content )

◆ _dom_characterdata_substring_data()

dom_exception _dom_characterdata_substring_data ( struct dom_characterdata * cdata,
uint32_t offset,
uint32_t count,
dom_string ** data )

Extract a range of data from a character data node

Parameters
cdataThe node to extract data from
offsetThe character offset of substring to extract
countThe number of characters to extract
dataPointer to location to receive substring
Returns
DOM_NO_ERR on success, DOM_INDEX_SIZE_ERR if offset is negative or greater than the number of characters in cdata or count is negative.

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.

DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in this implementation; dom_strings are unbounded.

Variable Documentation

◆ characterdata_vtable

const struct dom_characterdata_vtable characterdata_vtable
extern