xlink.inc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. (*
  2. * Summary: unfinished XLink detection module
  3. * Description: unfinished XLink detection module
  4. *
  5. * Copy: See Copyright for the status of this software.
  6. *
  7. * Author: Daniel Veillard
  8. *)
  9. {$IFDEF LIBXML_XPTR_ENABLED}
  10. {$IFDEF POINTER}
  11. xlinkHRefPtr = ^xlinkHRef;
  12. xlinkRolePtr = ^xlinkRole;
  13. xlinkTitlePtr = ^xlinkTitle;
  14. xlinkShowPtr = ^xlinkShow;
  15. xlinkActuatePtr = ^xlinkActuate;
  16. xlinkHandlerPtr = ^xlinkHandler;
  17. {$ENDIF}
  18. {$IFDEF TYPE}
  19. (**
  20. * Various defines for the various Link properties.
  21. *
  22. * NOTE: the link detection layer will try to resolve QName expansion
  23. * of namespaces. If "foo" is the prefix for "http://foo.com/"
  24. * then the link detection layer will expand role="foo:myrole"
  25. * to "http://foo.com/:myrole".
  26. * NOTE: the link detection layer will expand URI-Refences found on
  27. * href attributes by using the base mechanism if found.
  28. *)
  29. xlinkHRef = xmlCharPtr;
  30. xlinkRole = xmlCharPtr;
  31. xlinkTitle = xmlCharPtr;
  32. xlinkType = (
  33. XLINK_TYPE_NONE = 0,
  34. XLINK_TYPE_SIMPLE,
  35. XLINK_TYPE_EXTENDED,
  36. XLINK_TYPE_EXTENDED_SET
  37. );
  38. xlinkShow = (
  39. XLINK_SHOW_NONE = 0,
  40. XLINK_SHOW_NEW,
  41. XLINK_SHOW_EMBED,
  42. XLINK_SHOW_REPLACE
  43. );
  44. xlinkActuate = (
  45. XLINK_ACTUATE_NONE = 0,
  46. XLINK_ACTUATE_AUTO,
  47. XLINK_ACTUATE_ONREQUEST
  48. );
  49. (**
  50. * xlinkNodeDetectFunc:
  51. * @ctx: user data pointer
  52. * @node: the node to check
  53. *
  54. * This is the prototype for the link detection routine.
  55. * It calls the default link detection callbacks upon link detection.
  56. *)
  57. xlinkNodeDetectFunc = procedure(ctx: pointer; node: xmlNodePtr); EXTDECL;
  58. (*
  59. * The link detection module interact with the upper layers using
  60. * a set of callback registered at parsing time.
  61. *)
  62. (**
  63. * xlinkSimpleLinkFunk:
  64. * @ctx: user data pointer
  65. * @node: the node carrying the link
  66. * @href: the target of the link
  67. * @role: the role string
  68. * @title: the link title
  69. *
  70. * This is the prototype for a simple link detection callback.
  71. *)
  72. xlinkSimpleLinkFunk = procedure(ctx: pointer; node: xmlNodePtr; href: xlinkHRef; role: xlinkRole; title: xlinkTitle); EXTDECL;
  73. (**
  74. * xlinkExtendedLinkFunk:
  75. * @ctx: user data pointer
  76. * @node: the node carrying the link
  77. * @nbLocators: the number of locators detected on the link
  78. * @hrefs: pointer to the array of locator hrefs
  79. * @roles: pointer to the array of locator roles
  80. * @nbArcs: the number of arcs detected on the link
  81. * @from: pointer to the array of source roles found on the arcs
  82. * @to: pointer to the array of target roles found on the arcs
  83. * @show: array of values for the show attributes found on the arcs
  84. * @actuate: array of values for the actuate attributes found on the arcs
  85. * @nbTitles: the number of titles detected on the link
  86. * @title: array of titles detected on the link
  87. * @langs: array of xml:lang values for the titles
  88. *
  89. * This is the prototype for a extended link detection callback.
  90. *)
  91. xlinkExtendedLinkFunk = procedure(ctx: pointer; node: xmlNodePtr; nbLocators: cint; hrefs: xlinkHRefPtr; roles: xlinkRolePtr;
  92. nbArcs: cint; from, _to: xlinkRolePtr; show: xlinkShowPtr; actuate: xlinkActuatePtr; nbTitles: cint; titles: xlinkTitlePtr; langs: xmlCharPtrPtr); EXTDECL;
  93. (**
  94. * xlinkExtendedLinkSetFunk:
  95. * @ctx: user data pointer
  96. * @node: the node carrying the link
  97. * @nbLocators: the number of locators detected on the link
  98. * @hrefs: pointer to the array of locator hrefs
  99. * @roles: pointer to the array of locator roles
  100. * @nbTitles: the number of titles detected on the link
  101. * @title: array of titles detected on the link
  102. * @langs: array of xml:lang values for the titles
  103. *
  104. * This is the prototype for a extended link set detection callback.
  105. *)
  106. xlinkExtendedLinkSetFunk = procedure(ctx: pointer; node: xmlNodePtr; nbLocators: cint; hrefs: xlinkHRefPtr; roles: xlinkRolePtr;
  107. nbTitles: cint; titles: xlinkTitlePtr; langs: xmlCharPtrPtr); EXTDECL;
  108. (**
  109. * This is the structure containing a set of Links detection callbacks.
  110. *
  111. * There is no default xlink callbacks, if one want to get link
  112. * recognition activated, those call backs must be provided before parsing.
  113. *)
  114. xlinkHandler = record
  115. simple : xlinkSimpleLinkFunk;
  116. extended : xlinkExtendedLinkFunk;
  117. _set : xlinkExtendedLinkSetFunk;
  118. end;
  119. {$ENDIF}
  120. {$IFDEF FUNCTION}
  121. (*
  122. * The default detection routine, can be overridden, they call the default
  123. * detection callbacks.
  124. *)
  125. function xlinkGetDefaultDetect: xlinkNodeDetectFunc; EXTDECL; external xml2lib;
  126. procedure xlinkSetDefaultDetect(func: xlinkNodeDetectFunc); EXTDECL; external xml2lib;
  127. (*
  128. * Routines to set/get the default handlers.
  129. *)
  130. function xlinkGetDefaultHandler: xlinkHandlerPtr; EXTDECL; external xml2lib;
  131. procedure xlinkSetDefaultHandler(handler: xlinkHandlerPtr); EXTDECL; external xml2lib;
  132. (*
  133. * Link detection module itself.
  134. *)
  135. function xlinkIsLink(doc: xmlDocPtr; node: xmlNodePtr): xlinkType; EXTDECL; external xml2lib;
  136. {$ENDIF}
  137. {$ENDIF} (* LIBXML_XPTR_ENABLED *)