Subversion Repositories Kolibri OS

Rev

Rev 3584 | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * This file is part of libdom.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef dom_internal_core_text_h_
  9. #define dom_internal_core_text_h_
  10.  
  11. #include <stdbool.h>
  12.  
  13. #include <dom/core/exceptions.h>
  14. #include <dom/core/text.h>
  15.  
  16. #include "core/characterdata.h"
  17.  
  18. struct dom_document;
  19.  
  20. /**
  21.  * A DOM text node
  22.  */
  23. struct dom_text {
  24.         dom_characterdata base; /**< Base node */
  25.  
  26.         bool element_content_whitespace;        /**< This node is element
  27.                                                  * content whitespace */
  28. };
  29.  
  30. /* Constructor and Destructor */
  31. dom_exception _dom_text_create(struct dom_document *doc,
  32.                 dom_string *name, dom_string *value,
  33.                 dom_text **result);
  34.  
  35. void _dom_text_destroy(dom_text *text);
  36.  
  37. dom_exception _dom_text_initialise(dom_text *text,
  38.                 struct dom_document *doc, dom_node_type type,
  39.                 dom_string *name, dom_string *value);
  40.  
  41. void _dom_text_finalise(dom_text *text);
  42.  
  43.  
  44. /* Virtual functions for dom_text */
  45. dom_exception _dom_text_split_text(dom_text *text,
  46.                 uint32_t offset, dom_text **result);
  47. dom_exception _dom_text_get_is_element_content_whitespace(
  48.                 dom_text *text, bool *result);
  49. dom_exception _dom_text_get_whole_text(dom_text *text,
  50.                 dom_string **result);
  51. dom_exception _dom_text_replace_whole_text(dom_text *text,
  52.                 dom_string *content, dom_text **result);
  53.  
  54. #define DOM_TEXT_VTABLE \
  55.         _dom_text_split_text, \
  56.         _dom_text_get_is_element_content_whitespace, \
  57.         _dom_text_get_whole_text, \
  58.         _dom_text_replace_whole_text
  59.  
  60.  
  61. /* Following comes the protected vtable  */
  62. void __dom_text_destroy(struct dom_node_internal *node);
  63. dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy);
  64.  
  65. #define DOM_TEXT_PROTECT_VTABLE \
  66.         __dom_text_destroy, \
  67.         _dom_text_copy
  68.  
  69. extern struct dom_text_vtable text_vtable;
  70.  
  71. dom_exception _dom_text_copy_internal(dom_text *old, dom_text *new);
  72. #define dom_text_copy_internal(o, n) \
  73.                 _dom_text_copy_internal((dom_text *) (o), (dom_text *) (n))
  74.  
  75. #endif
  76.