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 2007 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef dom_core_node_h_
  9. #define dom_core_node_h_
  10.  
  11. #include <inttypes.h>
  12. #include <stdbool.h>
  13.  
  14. #include <dom/core/exceptions.h>
  15. #include <dom/core/string.h>
  16. #include <dom/events/event_target.h>
  17.  
  18. struct dom_document;
  19. struct dom_nodelist;
  20. struct dom_namednodemap;
  21. struct dom_node;
  22.  
  23. /**
  24.  * Bits defining position of a node in a document relative to some other node
  25.  */
  26. typedef enum {
  27.         DOM_DOCUMENT_POSITION_DISCONNECTED              = 0x01,
  28.         DOM_DOCUMENT_POSITION_PRECEDING                 = 0x02,
  29.         DOM_DOCUMENT_POSITION_FOLLOWING                 = 0x04,
  30.         DOM_DOCUMENT_POSITION_CONTAINS                  = 0x08,
  31.         DOM_DOCUMENT_POSITION_CONTAINED_BY              = 0x10,
  32.         DOM_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC   = 0x20
  33. } dom_document_position;
  34.  
  35. /**
  36.  * Type of node operation being notified to user_data_handler
  37.  */
  38. typedef enum {
  39.         DOM_NODE_CLONED         = 1,
  40.         DOM_NODE_IMPORTED       = 2,
  41.         DOM_NODE_DELETED        = 3,
  42.         DOM_NODE_RENAMED        = 4,
  43.         DOM_NODE_ADOPTED        = 5
  44. } dom_node_operation;
  45.  
  46. /**
  47.  * Type of handler function for user data registered on a DOM node
  48.  */
  49. typedef void (*dom_user_data_handler)(dom_node_operation operation,
  50.                 dom_string *key, void *data, struct dom_node *src,
  51.                 struct dom_node *dst);
  52.  
  53. /**
  54.  * Type of a DOM node
  55.  */
  56. typedef enum {
  57.         DOM_ELEMENT_NODE                = 1,
  58.         DOM_ATTRIBUTE_NODE              = 2,
  59.         DOM_TEXT_NODE                   = 3,
  60.         DOM_CDATA_SECTION_NODE          = 4,
  61.         DOM_ENTITY_REFERENCE_NODE       = 5,
  62.         DOM_ENTITY_NODE                 = 6,
  63.         DOM_PROCESSING_INSTRUCTION_NODE = 7,
  64.         DOM_COMMENT_NODE                = 8,
  65.         DOM_DOCUMENT_NODE               = 9,
  66.         DOM_DOCUMENT_TYPE_NODE          = 10,
  67.         DOM_DOCUMENT_FRAGMENT_NODE      = 11,
  68.         DOM_NOTATION_NODE               = 12,
  69.  
  70.         /* And a count of the number of node types */
  71.         DOM_NODE_TYPE_COUNT             = DOM_NOTATION_NODE
  72. } dom_node_type;
  73.  
  74. typedef struct dom_node_internal dom_node_internal;
  75.  
  76. /**
  77.  * DOM node type
  78.  */
  79. typedef struct dom_node {
  80.         void *vtable;
  81.         uint32_t refcnt;
  82. } dom_node;
  83.  
  84. /* DOM node vtable */
  85. typedef struct dom_node_vtable {
  86.         dom_event_target_vtable base;
  87.         /* pre-destruction hook */
  88.         dom_exception (*dom_node_try_destroy)(dom_node_internal *node);
  89.         /* The DOM level 3 node's oprations */
  90.         dom_exception (*dom_node_get_node_name)(dom_node_internal *node,
  91.                         dom_string **result);
  92.         dom_exception (*dom_node_get_node_value)(dom_node_internal *node,
  93.                         dom_string **result);
  94.         dom_exception (*dom_node_set_node_value)(dom_node_internal *node,
  95.                         dom_string *value);
  96.         dom_exception (*dom_node_get_node_type)(dom_node_internal *node,
  97.                         dom_node_type *result);
  98.         dom_exception (*dom_node_get_parent_node)(dom_node_internal *node,
  99.                         dom_node_internal **result);
  100.         dom_exception (*dom_node_get_child_nodes)(dom_node_internal *node,
  101.                         struct dom_nodelist **result);
  102.         dom_exception (*dom_node_get_first_child)(dom_node_internal *node,
  103.                         dom_node_internal **result);
  104.         dom_exception (*dom_node_get_last_child)(dom_node_internal *node,
  105.                         dom_node_internal **result);
  106.         dom_exception (*dom_node_get_previous_sibling)(dom_node_internal *node,
  107.                         dom_node_internal **result);
  108.         dom_exception (*dom_node_get_next_sibling)(dom_node_internal *node,
  109.                         dom_node_internal **result);
  110.         dom_exception (*dom_node_get_attributes)(dom_node_internal *node,
  111.                         struct dom_namednodemap **result);
  112.         dom_exception (*dom_node_get_owner_document)(dom_node_internal *node,
  113.                         struct dom_document **result);
  114.         dom_exception (*dom_node_insert_before)(dom_node_internal *node,
  115.                         dom_node_internal *new_child,
  116.                         dom_node_internal *ref_child,
  117.                         dom_node_internal **result);
  118.         dom_exception (*dom_node_replace_child)(dom_node_internal *node,
  119.                         dom_node_internal *new_child,
  120.                         dom_node_internal *old_child,
  121.                         dom_node_internal **result);
  122.         dom_exception (*dom_node_remove_child)(dom_node_internal *node,
  123.                         dom_node_internal *old_child,
  124.                         dom_node_internal **result);
  125.         dom_exception (*dom_node_append_child)(dom_node_internal *node,
  126.                         dom_node_internal *new_child,
  127.                         dom_node_internal **result);
  128.         dom_exception (*dom_node_has_child_nodes)(dom_node_internal *node,
  129.                         bool *result);
  130.         dom_exception (*dom_node_clone_node)(dom_node_internal *node, bool deep,
  131.                         dom_node_internal **result);
  132.         dom_exception (*dom_node_normalize)(dom_node_internal *node);
  133.         dom_exception (*dom_node_is_supported)(dom_node_internal *node,
  134.                         dom_string *feature, dom_string *version,
  135.                         bool *result);
  136.         dom_exception (*dom_node_get_namespace)(dom_node_internal *node,
  137.                         dom_string **result);
  138.         dom_exception (*dom_node_get_prefix)(dom_node_internal *node,
  139.                         dom_string **result);
  140.         dom_exception (*dom_node_set_prefix)(dom_node_internal *node,
  141.                         dom_string *prefix);
  142.         dom_exception (*dom_node_get_local_name)(dom_node_internal *node,
  143.                         dom_string **result);
  144.         dom_exception (*dom_node_has_attributes)(dom_node_internal *node,
  145.                         bool *result);
  146.         dom_exception (*dom_node_get_base)(dom_node_internal *node,
  147.                         dom_string **result);
  148.         dom_exception (*dom_node_compare_document_position)(
  149.                         dom_node_internal *node, dom_node_internal *other,
  150.                         uint16_t *result);
  151.         dom_exception (*dom_node_get_text_content)(dom_node_internal *node,
  152.                         dom_string **result);
  153.         dom_exception (*dom_node_set_text_content)(dom_node_internal *node,
  154.                         dom_string *content);
  155.         dom_exception (*dom_node_is_same)(dom_node_internal *node,
  156.                         dom_node_internal *other, bool *result);
  157.         dom_exception (*dom_node_lookup_prefix)(dom_node_internal *node,
  158.                         dom_string *namespace,
  159.                         dom_string **result);
  160.         dom_exception (*dom_node_is_default_namespace)(dom_node_internal *node,
  161.                         dom_string *namespace, bool *result);
  162.         dom_exception (*dom_node_lookup_namespace)(dom_node_internal *node,
  163.                         dom_string *prefix, dom_string **result);
  164.         dom_exception (*dom_node_is_equal)(dom_node_internal *node,
  165.                         dom_node_internal *other, bool *result);
  166.         dom_exception (*dom_node_get_feature)(dom_node_internal *node,
  167.                         dom_string *feature, dom_string *version,
  168.                         void **result);
  169.         dom_exception (*dom_node_set_user_data)(dom_node_internal *node,
  170.                         dom_string *key, void *data,
  171.                         dom_user_data_handler handler, void **result);
  172.         dom_exception (*dom_node_get_user_data)(dom_node_internal *node,
  173.                         dom_string *key, void **result);
  174. } dom_node_vtable;
  175.  
  176. /* The ref/unref methods define */
  177.  
  178. static inline dom_node *dom_node_ref(dom_node *node)
  179. {
  180.         if (node != NULL)
  181.                 node->refcnt++;
  182.        
  183.         return node;
  184. }
  185.  
  186. #define dom_node_ref(n) dom_node_ref((dom_node *) (n))
  187.  
  188. static inline dom_exception dom_node_try_destroy(dom_node *node)
  189. {
  190.         return ((dom_node_vtable *) node->vtable)->dom_node_try_destroy(
  191.                         (dom_node_internal *) node);
  192. }
  193. #define dom_node_try_destroy(n) dom_node_try_destroy((dom_node *) (n))
  194.  
  195. static inline void dom_node_unref(dom_node *node)
  196. {
  197.         if (node != NULL) {
  198.                 if (--node->refcnt == 0)
  199.                         dom_node_try_destroy(node);
  200.         }
  201.                
  202. }
  203. #define dom_node_unref(n) dom_node_unref((dom_node *) (n))
  204.  
  205. static inline dom_exception dom_node_get_node_name(struct dom_node *node,
  206.                 dom_string **result)
  207. {
  208.         return ((dom_node_vtable *) node->vtable)->dom_node_get_node_name(
  209.                         (dom_node_internal *) node, result);
  210. }
  211. #define dom_node_get_node_name(n, r) dom_node_get_node_name((dom_node *) (n), (r))
  212.  
  213. static inline dom_exception dom_node_get_node_value(struct dom_node *node,
  214.                 dom_string **result)
  215. {
  216.         return ((dom_node_vtable *) node->vtable)->dom_node_get_node_value(
  217.                         (dom_node_internal *) node, result);
  218. }
  219. #define dom_node_get_node_value(n, r) dom_node_get_node_value( \
  220.                 (dom_node *) (n), (r))
  221.  
  222. static inline dom_exception dom_node_set_node_value(struct dom_node *node,
  223.                 dom_string *value)
  224. {
  225.         return ((dom_node_vtable *) node->vtable)->dom_node_set_node_value(
  226.                         (dom_node_internal *) node, value);
  227. }
  228. #define dom_node_set_node_value(n, v) dom_node_set_node_value( \
  229.                 (dom_node *) (n), (v))
  230.  
  231. static inline dom_exception dom_node_get_node_type(struct dom_node *node,
  232.                 dom_node_type *result)
  233. {
  234.         return ((dom_node_vtable *) node->vtable)->dom_node_get_node_type(
  235.                         (dom_node_internal *) node, result);
  236. }
  237. #define dom_node_get_node_type(n, r) dom_node_get_node_type( \
  238.                 (dom_node *) (n), (dom_node_type *) (r))
  239.  
  240. static inline dom_exception dom_node_get_parent_node(struct dom_node *node,
  241.                 dom_node **result)
  242. {
  243.         return ((dom_node_vtable *) node->vtable)->dom_node_get_parent_node(
  244.                         (dom_node_internal *) node,
  245.                         (dom_node_internal **) result);
  246. }
  247. #define dom_node_get_parent_node(n, r) dom_node_get_parent_node( \
  248.                 (dom_node *) (n), (dom_node **) (r))
  249.  
  250. static inline dom_exception dom_node_get_child_nodes(struct dom_node *node,
  251.                 struct dom_nodelist **result)
  252. {
  253.         return ((dom_node_vtable *) node->vtable)->dom_node_get_child_nodes(
  254.                         (dom_node_internal *) node, result);
  255. }
  256. #define dom_node_get_child_nodes(n, r) dom_node_get_child_nodes( \
  257.                 (dom_node *) (n), (struct dom_nodelist **) (r))
  258.  
  259. static inline dom_exception dom_node_get_first_child(struct dom_node *node,
  260.                 dom_node **result)
  261. {
  262.         return ((dom_node_vtable *) node->vtable)->dom_node_get_first_child(
  263.                         (dom_node_internal *) node,
  264.                         (dom_node_internal **) result);
  265. }
  266. #define dom_node_get_first_child(n, r) dom_node_get_first_child( \
  267.                 (dom_node *) (n), (dom_node **) (r))
  268.  
  269. static inline dom_exception dom_node_get_last_child(struct dom_node *node,
  270.                 dom_node **result)
  271. {
  272.         return ((dom_node_vtable *) node->vtable)->dom_node_get_last_child(
  273.                         (dom_node_internal *) node,
  274.                         (dom_node_internal **) result);
  275. }
  276. #define dom_node_get_last_child(n, r) dom_node_get_last_child( \
  277.                 (dom_node *) (n), (dom_node **) (r))
  278.  
  279. static inline dom_exception dom_node_get_previous_sibling(
  280.                 struct dom_node *node, dom_node **result)
  281. {
  282.         return ((dom_node_vtable *) node->vtable)->
  283.                         dom_node_get_previous_sibling(
  284.                         (dom_node_internal *) node,
  285.                         (dom_node_internal **) result);
  286. }
  287. #define dom_node_get_previous_sibling(n, r) dom_node_get_previous_sibling( \
  288.                 (dom_node *) (n), (dom_node **) (r))
  289.  
  290. static inline dom_exception dom_node_get_next_sibling(struct dom_node *node,
  291.                 dom_node **result)
  292. {
  293.         return ((dom_node_vtable *) node->vtable)->dom_node_get_next_sibling(
  294.                         (dom_node_internal *) node,
  295.                         (dom_node_internal **) result);
  296. }
  297. #define dom_node_get_next_sibling(n, r) dom_node_get_next_sibling( \
  298.                 (dom_node *) (n), (dom_node **) (r))
  299.  
  300. static inline dom_exception dom_node_get_attributes(struct dom_node *node,
  301.                 struct dom_namednodemap **result)
  302. {
  303.         return ((dom_node_vtable *) node->vtable)->dom_node_get_attributes(
  304.                         (dom_node_internal *) node, result);
  305. }
  306. #define dom_node_get_attributes(n, r) dom_node_get_attributes( \
  307.                 (dom_node *) (n), (struct dom_namednodemap **) (r))
  308.  
  309. static inline dom_exception dom_node_get_owner_document(struct dom_node *node,
  310.                 struct dom_document **result)
  311. {
  312.         return ((dom_node_vtable *) node->vtable)->dom_node_get_owner_document(
  313.                         (dom_node_internal *) node, result);
  314. }
  315. #define dom_node_get_owner_document(n, r) dom_node_get_owner_document( \
  316.                 (dom_node *) (n), (struct dom_document **) (r))
  317.  
  318. static inline dom_exception dom_node_insert_before(struct dom_node *node,
  319.                 struct dom_node *new_child, struct dom_node *ref_child,
  320.                 struct dom_node **result)
  321. {
  322.         return ((dom_node_vtable *) node->vtable)->dom_node_insert_before(
  323.                         (dom_node_internal *) node,
  324.                         (dom_node_internal *) new_child,
  325.                         (dom_node_internal *) ref_child,
  326.                         (dom_node_internal **) result);
  327. }
  328. #define dom_node_insert_before(n, nn, ref, ret) dom_node_insert_before( \
  329.                 (dom_node *) (n), (dom_node *) (nn), (dom_node *) (ref),\
  330.                 (dom_node **) (ret))
  331.  
  332. static inline dom_exception dom_node_replace_child(struct dom_node *node,
  333.                 struct dom_node *new_child, struct dom_node *old_child,
  334.                 struct dom_node **result)
  335. {
  336.         return ((dom_node_vtable *) node->vtable)->dom_node_replace_child(
  337.                         (dom_node_internal *) node,
  338.                         (dom_node_internal *) new_child,
  339.                         (dom_node_internal *) old_child,
  340.                         (dom_node_internal **) result);
  341. }
  342. #define dom_node_replace_child(n, nn, old, ret) dom_node_replace_child( \
  343.                 (dom_node *) (n), (dom_node *) (nn), (dom_node *) (old),\
  344.                 (dom_node **) (ret))
  345.  
  346. static inline dom_exception dom_node_remove_child(struct dom_node *node,
  347.                 struct dom_node *old_child,
  348.                 struct dom_node **result)
  349. {
  350.         return ((dom_node_vtable *) node->vtable)->dom_node_remove_child(
  351.                         (dom_node_internal *) node,
  352.                         (dom_node_internal *) old_child,
  353.                         (dom_node_internal **) result);
  354. }
  355. #define dom_node_remove_child(n, old, ret) dom_node_remove_child( \
  356.                 (dom_node *) (n), (dom_node *) (old), (dom_node **) (ret))
  357.  
  358. static inline dom_exception dom_node_append_child(struct dom_node *node,
  359.                 struct dom_node *new_child,
  360.                 struct dom_node **result)
  361. {
  362.         return ((dom_node_vtable *) node->vtable)->dom_node_append_child(
  363.                         (dom_node_internal *) node,
  364.                         (dom_node_internal *) new_child,
  365.                         (dom_node_internal **) result);
  366. }
  367. #define dom_node_append_child(n, nn, ret) dom_node_append_child( \
  368.                 (dom_node *) (n), (dom_node *) (nn), (dom_node **) (ret))
  369.  
  370. static inline dom_exception dom_node_has_child_nodes(struct dom_node *node,
  371.                 bool *result)
  372. {
  373.         return ((dom_node_vtable *) node->vtable)->dom_node_has_child_nodes(
  374.                         (dom_node_internal *) node, result);
  375. }
  376. #define dom_node_has_child_nodes(n, r) dom_node_has_child_nodes( \
  377.                 (dom_node *) (n), (bool *) (r))
  378.  
  379. static inline dom_exception dom_node_clone_node(struct dom_node *node,
  380.                 bool deep, struct dom_node **result)
  381. {
  382.         return ((dom_node_vtable *) node->vtable)->dom_node_clone_node(
  383.                         (dom_node_internal *) node, deep,
  384.                         (dom_node_internal **) result);
  385. }
  386. #define dom_node_clone_node(n, d, r) dom_node_clone_node((dom_node *) (n), \
  387.                 (bool) (d), (dom_node **) (r))
  388.  
  389. static inline dom_exception dom_node_normalize(struct dom_node *node)
  390. {
  391.         return ((dom_node_vtable *) node->vtable)->dom_node_normalize(
  392.                         (dom_node_internal *) node);
  393. }
  394. #define dom_node_normalize(n) dom_node_normalize((dom_node *) (n))
  395.  
  396. static inline dom_exception dom_node_is_supported(struct dom_node *node,
  397.                 dom_string *feature, dom_string *version,
  398.                 bool *result)
  399. {
  400.         return ((dom_node_vtable *) node->vtable)->dom_node_is_supported(
  401.                         (dom_node_internal *) node, feature,
  402.                         version, result);
  403. }
  404. #define dom_node_is_supported(n, f, v, r) dom_node_is_supported( \
  405.                 (dom_node *) (n), (f), (v), (bool *) (r))
  406.  
  407. static inline dom_exception dom_node_get_namespace(struct dom_node *node,
  408.                 dom_string **result)
  409. {
  410.         return ((dom_node_vtable *) node->vtable)->dom_node_get_namespace(
  411.                         (dom_node_internal *) node, result);
  412. }
  413. #define dom_node_get_namespace(n, r) dom_node_get_namespace((dom_node *) (n), (r))
  414.  
  415. static inline dom_exception dom_node_get_prefix(struct dom_node *node,
  416.                 dom_string **result)
  417. {
  418.         return ((dom_node_vtable *) node->vtable)->dom_node_get_prefix(
  419.                         (dom_node_internal *) node, result);
  420. }
  421. #define dom_node_get_prefix(n, r) dom_node_get_prefix((dom_node *) (n), (r))
  422.  
  423. static inline dom_exception dom_node_set_prefix(struct dom_node *node,
  424.                 dom_string *prefix)
  425. {
  426.         return ((dom_node_vtable *) node->vtable)->dom_node_set_prefix(
  427.                         (dom_node_internal *) node, prefix);
  428. }
  429. #define dom_node_set_prefix(n, p) dom_node_set_prefix((dom_node *) (n), (p))
  430.  
  431. static inline dom_exception dom_node_get_local_name(struct dom_node *node,
  432.                 dom_string **result)
  433. {
  434.         return ((dom_node_vtable *) node->vtable)->dom_node_get_local_name(
  435.                         (dom_node_internal *) node, result);
  436. }
  437. #define dom_node_get_local_name(n, r) dom_node_get_local_name((dom_node *) (n), (r))
  438.  
  439. static inline dom_exception dom_node_has_attributes(struct dom_node *node,
  440.                 bool *result)
  441. {
  442.         return ((dom_node_vtable *) node->vtable)->dom_node_has_attributes(
  443.                         (dom_node_internal *) node, result);
  444. }
  445. #define dom_node_has_attributes(n, r) dom_node_has_attributes( \
  446.                 (dom_node *) (n), (bool *) (r))
  447.  
  448. static inline dom_exception dom_node_get_base(struct dom_node *node,
  449.                 dom_string **result)
  450. {
  451.         return ((dom_node_vtable *) node->vtable)->dom_node_get_base(
  452.                         (dom_node_internal *) node, result);
  453. }
  454. #define dom_node_get_base(n, r) dom_node_get_base((dom_node *) (n), (r))
  455.  
  456. static inline dom_exception dom_node_compare_document_position(
  457.                 struct dom_node *node, struct dom_node *other,
  458.                 uint16_t *result)
  459. {
  460.         return ((dom_node_vtable *) node->vtable)->
  461.                         dom_node_compare_document_position(
  462.                         (dom_node_internal *) node,
  463.                         (dom_node_internal *) other, result);
  464. }
  465. #define dom_node_compare_document_position(n, o, r) \
  466.                 dom_node_compare_document_position((dom_node *) (n), \
  467.                 (dom_node *) (o), (uint16_t *) (r))
  468.  
  469. static inline dom_exception dom_node_get_text_content(struct dom_node *node,
  470.                 dom_string **result)
  471. {
  472.         return ((dom_node_vtable *) node->vtable)->dom_node_get_text_content(
  473.                         (dom_node_internal *) node, result);
  474. }
  475. #define dom_node_get_text_content(n, r) dom_node_get_text_content( \
  476.                 (dom_node *) (n), (r))
  477.  
  478. static inline dom_exception dom_node_set_text_content(struct dom_node *node,
  479.                 dom_string *content)
  480. {
  481.         return ((dom_node_vtable *) node->vtable)->dom_node_set_text_content(
  482.                         (dom_node_internal *) node, content);
  483. }
  484. #define dom_node_set_text_content(n, c) dom_node_set_text_content( \
  485.                 (dom_node *) (n), (c))
  486.  
  487. static inline dom_exception dom_node_is_same(struct dom_node *node,
  488.                 struct dom_node *other, bool *result)
  489. {
  490.         return ((dom_node_vtable *) node->vtable)->dom_node_is_same(
  491.                         (dom_node_internal *) node,
  492.                         (dom_node_internal *) other,
  493.                         result);
  494. }
  495. #define dom_node_is_same(n, o, r) dom_node_is_same((dom_node *) (n), \
  496.                 (dom_node *) (o), (bool *) (r))
  497.  
  498. static inline dom_exception dom_node_lookup_prefix(struct dom_node *node,
  499.                 dom_string *namespace, dom_string **result)
  500. {
  501.         return ((dom_node_vtable *) node->vtable)->dom_node_lookup_prefix(
  502.                         (dom_node_internal *) node, namespace, result);
  503. }
  504. #define dom_node_lookup_prefix(n, ns, r) dom_node_lookup_prefix( \
  505.                 (dom_node *) (n), (ns), (r))
  506.  
  507. static inline dom_exception dom_node_is_default_namespace(
  508.                 struct dom_node *node, dom_string *namespace,
  509.                 bool *result)
  510. {
  511.         return ((dom_node_vtable *) node->vtable)->
  512.                         dom_node_is_default_namespace(
  513.                         (dom_node_internal *) node, namespace, result);
  514. }
  515. #define dom_node_is_default_namespace(n, ns, r) dom_node_is_default_namespace(\
  516.                 (dom_node *) (n), (ns), (bool *) (r))
  517.  
  518. static inline dom_exception dom_node_lookup_namespace(struct dom_node *node,
  519.                 dom_string *prefix, dom_string **result)
  520. {
  521.         return ((dom_node_vtable *) node->vtable)->dom_node_lookup_namespace(
  522.                         (dom_node_internal *) node, prefix, result);
  523. }
  524. #define dom_node_lookup_namespace(n, p, r) dom_node_lookup_namespace( \
  525.                 (dom_node *) (n), (p), (r))
  526.  
  527. static inline dom_exception dom_node_is_equal(struct dom_node *node,
  528.                 struct dom_node *other, bool *result)
  529. {
  530.         return ((dom_node_vtable *) node->vtable)->dom_node_is_equal(
  531.                         (dom_node_internal *) node,
  532.                         (dom_node_internal *) other,
  533.                         result);
  534. }
  535. #define dom_node_is_equal(n, o, r) dom_node_is_equal((dom_node *) (n), \
  536.                 (dom_node *) (o), (bool *) (r))
  537.  
  538. static inline dom_exception dom_node_get_feature(struct dom_node *node,
  539.                 dom_string *feature, dom_string *version,
  540.                 void **result)
  541. {
  542.         return ((dom_node_vtable *) node->vtable)->dom_node_get_feature(
  543.                         (dom_node_internal *) node, feature, version, result);
  544. }
  545. #define dom_node_get_feature(n, f, v, r) dom_node_get_feature( \
  546.                 (dom_node *) (n), (f), (v), (void **) (r))
  547.  
  548. static inline dom_exception dom_node_set_user_data(struct dom_node *node,
  549.                 dom_string *key, void *data,
  550.                 dom_user_data_handler handler, void **result)
  551. {
  552.         return ((dom_node_vtable *) node->vtable)->dom_node_set_user_data(
  553.                         (dom_node_internal *) node, key, data, handler,
  554.                         result);
  555. }
  556. #define dom_node_set_user_data(n, k, d, h, r) dom_node_set_user_data( \
  557.                 (dom_node *) (n), (k), (void *) (d), \
  558.                 (dom_user_data_handler) h, (void **) (r))
  559.  
  560. static inline dom_exception dom_node_get_user_data(struct dom_node *node,
  561.                 dom_string *key, void **result)
  562. {
  563.         return ((dom_node_vtable *) node->vtable)->dom_node_get_user_data(
  564.                         (dom_node_internal *) node, key, result);
  565. }
  566. #define dom_node_get_user_data(n, k, r) dom_node_get_user_data( \
  567.                 (dom_node *) (n), (k), (void **) (r))
  568.  
  569. #endif
  570.