Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | 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 2009 Bo Yang <struggleyb.nku@gmail.com>
  6.  */
  7.  
  8. #ifndef dom_internal_html_document_h_
  9. #define dom_internal_html_document_h_
  10.  
  11. #include <dom/html/html_document.h>
  12.  
  13. #include "core/document.h"
  14.  
  15. /**
  16.  * The dom_html_document class
  17.  */
  18. struct dom_html_document {
  19.         struct dom_document base;       /**< The base class */
  20.        
  21.         dom_string *title;      /**< HTML document title */
  22.         dom_string *referrer;   /**< HTML document referrer */
  23.         dom_string *domain;     /**< HTML document domain */
  24.         dom_string *url;        /**< HTML document URL */
  25.         dom_string *cookie;     /**< HTML document cookie */
  26.        
  27.         /** Cached strings for html objects to use */
  28.         dom_string **memoised;
  29. };
  30.  
  31. #include "html_document_strings.h"
  32.  
  33. /* Create a HTMLDocument */
  34. dom_exception _dom_html_document_create(
  35.                 dom_events_default_action_fetcher daf,
  36.                 void *daf_ctx,
  37.                 dom_html_document **doc);
  38. /* Initialise a HTMLDocument */
  39. dom_exception _dom_html_document_initialise(
  40.                 dom_html_document *doc,
  41.                 dom_events_default_action_fetcher daf,
  42.                 void *daf_ctx);
  43. /* Finalise a HTMLDocument */
  44. bool _dom_html_document_finalise(dom_html_document *doc);
  45.  
  46. void _dom_html_document_destroy(dom_node_internal *node);
  47. dom_exception _dom_html_document_copy(dom_node_internal *old,
  48.                 dom_node_internal **copy);
  49.  
  50. #define DOM_HTML_DOCUMENT_PROTECT_VTABLE \
  51.         _dom_html_document_destroy, \
  52.         _dom_html_document_copy
  53.  
  54. dom_exception _dom_html_document_get_title(dom_html_document *doc,
  55.                 dom_string **title);
  56. dom_exception _dom_html_document_set_title(dom_html_document *doc,
  57.                 dom_string *title);
  58. dom_exception _dom_html_document_get_referrer(dom_html_document *doc,
  59.                 dom_string **referrer);
  60. dom_exception _dom_html_document_get_domain(dom_html_document *doc,
  61.                 dom_string **domain);
  62. dom_exception _dom_html_document_get_url(dom_html_document *doc,
  63.                 dom_string **url);
  64. dom_exception _dom_html_document_get_body(dom_html_document *doc,
  65.                 struct dom_html_element **body);
  66. dom_exception _dom_html_document_set_body(dom_html_document *doc,
  67.                 struct dom_html_element *body);
  68. dom_exception _dom_html_document_get_images(dom_html_document *doc,
  69.                 struct dom_html_collection **col);
  70. dom_exception _dom_html_document_get_applets(dom_html_document *doc,
  71.                 struct dom_html_collection **col);
  72. dom_exception _dom_html_document_get_links(dom_html_document *doc,
  73.                 struct dom_html_collection **col);
  74. dom_exception _dom_html_document_get_forms(dom_html_document *doc,
  75.                 struct dom_html_collection **col);
  76. dom_exception _dom_html_document_get_anchors(dom_html_document *doc,
  77.                 struct dom_html_collection **col);
  78. dom_exception _dom_html_document_get_cookie(dom_html_document *doc,
  79.                 dom_string **cookie);
  80. dom_exception _dom_html_document_set_cookie(dom_html_document *doc,
  81.                 dom_string *cookie);
  82.  
  83. dom_exception _dom_html_document_open(dom_html_document *doc);
  84. dom_exception _dom_html_document_close(dom_html_document *doc);
  85. dom_exception _dom_html_document_write(dom_html_document *doc,
  86.                 dom_string *text);
  87. dom_exception _dom_html_document_writeln(dom_html_document *doc,
  88.                 dom_string *text);
  89. dom_exception _dom_html_document_get_elements_by_name(dom_html_document *doc,
  90.                 dom_string *name, struct dom_nodelist **list);
  91.  
  92.  
  93. #define DOM_HTML_DOCUMENT_VTABLE \
  94.         _dom_html_document_get_title, \
  95.         _dom_html_document_set_title, \
  96.         _dom_html_document_get_referrer, \
  97.         _dom_html_document_get_domain, \
  98.         _dom_html_document_get_url, \
  99.         _dom_html_document_get_body, \
  100.         _dom_html_document_set_body, \
  101.         _dom_html_document_get_images, \
  102.         _dom_html_document_get_applets, \
  103.         _dom_html_document_get_links, \
  104.         _dom_html_document_get_forms, \
  105.         _dom_html_document_get_anchors, \
  106.         _dom_html_document_get_cookie, \
  107.         _dom_html_document_set_cookie, \
  108.         _dom_html_document_open, \
  109.         _dom_html_document_close, \
  110.         _dom_html_document_write, \
  111.         _dom_html_document_writeln, \
  112.         _dom_html_document_get_elements_by_name
  113.  
  114. dom_exception _dom_html_document_create_element(dom_document *doc,
  115.                 dom_string *tag_name, dom_element **result);
  116. dom_exception _dom_html_document_create_element_ns(dom_document *doc,
  117.                 dom_string *namespace, dom_string *qname,
  118.                 dom_element **result);
  119. dom_exception _dom_html_document_get_elements_by_tag_name(dom_document *doc,
  120.                 dom_string *tagname, dom_nodelist **result);
  121. dom_exception _dom_html_document_get_elements_by_tag_name_ns(
  122.                 dom_document *doc, dom_string *namespace,
  123.                 dom_string *localname, dom_nodelist **result);
  124. dom_exception _dom_html_document_create_attribute(dom_document *doc,
  125.                 dom_string *name, dom_attr **result);
  126. dom_exception _dom_html_document_create_attribute_ns(dom_document *doc,
  127.                 dom_string *namespace, dom_string *qname,
  128.                 dom_attr **result);
  129.  
  130. #define DOM_DOCUMENT_VTABLE_HTML \
  131.         _dom_document_get_doctype, \
  132.         _dom_document_get_implementation, \
  133.         _dom_document_get_document_element, \
  134.         _dom_html_document_create_element, \
  135.         _dom_document_create_document_fragment, \
  136.         _dom_document_create_text_node, \
  137.         _dom_document_create_comment, \
  138.         _dom_document_create_cdata_section, \
  139.         _dom_document_create_processing_instruction, \
  140.         _dom_html_document_create_attribute, \
  141.         _dom_document_create_entity_reference, \
  142.         _dom_html_document_get_elements_by_tag_name, \
  143.         _dom_document_import_node, \
  144.         _dom_html_document_create_element_ns, \
  145.         _dom_html_document_create_attribute_ns, \
  146.         _dom_html_document_get_elements_by_tag_name_ns, \
  147.         _dom_document_get_element_by_id, \
  148.         _dom_document_get_input_encoding, \
  149.         _dom_document_get_xml_encoding, \
  150.         _dom_document_get_xml_standalone, \
  151.         _dom_document_set_xml_standalone, \
  152.         _dom_document_get_xml_version, \
  153.         _dom_document_set_xml_version, \
  154.         _dom_document_get_strict_error_checking, \
  155.         _dom_document_set_strict_error_checking, \
  156.         _dom_document_get_uri, \
  157.         _dom_document_set_uri, \
  158.         _dom_document_adopt_node, \
  159.         _dom_document_get_dom_config, \
  160.         _dom_document_normalize, \
  161.         _dom_document_rename_node,      \
  162.         _dom_document_get_quirks_mode,  \
  163.         _dom_document_set_quirks_mode
  164.  
  165. #endif
  166.  
  167.