Annotation of libwww/Library/src/HTLink.html, revision 2.1

2.1     ! frystyk     1: <HTML>
        !             2: <HEAD>
        !             3:   <!-- Changed by: Henrik Frystyk Nielsen, 30-Jun-1996 -->
        !             4:   <TITLE>W3C Reference Library libwww Link Class</TITLE>
        !             5: </HEAD>
        !             6: <BODY>
        !             7: <H1>
        !             8:   The Link Class
        !             9: </H1>
        !            10: <PRE>
        !            11: /*
        !            12: **     (c) COPYRIGHT MIT 1995.
        !            13: **     Please first read the full copyright statement in the file COPYRIGH.
        !            14: */
        !            15: </PRE>
        !            16: <P>
        !            17: A <A HREF="HTLink.html">Link</A> represents the link between anchor objects.
        !            18: By keeping the link as a object and not as part of the anchor we are capable
        !            19: of handling link semantics in a much more organized way. For example, we
        !            20: can then search for link types among all the link objects that we have created.
        !            21: <A HREF="HTAnchor.html">Anchor objects</A> are bound together using Link
        !            22: objects. Each anchor can be the source or destination of zero, one, or more
        !            23: links from and to other anchors.
        !            24: <P>
        !            25: This module is implemented by <A HREF="HTLink.c">HTLink.c</A>, and it is
        !            26: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C Reference
        !            27: Library</A>.
        !            28: <PRE>
        !            29: #ifndef HTLINK_H
        !            30: #define HTLINK_H
        !            31: 
        !            32: typedef struct _HTLink HTLink;
        !            33: 
        !            34: #include "WWWUtil.h"
        !            35: #include "HTMethod.h"
        !            36: #include "HTAnchor.h"
        !            37: </PRE>
        !            38: <H2>
        !            39:   Creation and Deletion Methods
        !            40: </H2>
        !            41: <P>
        !            42: These are the methods for crating and deleting new link objects
        !            43: <H3>
        !            44:   Create a new Link Object
        !            45: </H3>
        !            46: <PRE>typedef HTAtom *  HTLinkType;
        !            47: 
        !            48: typedef enum _HTLinkResult {
        !            49:     HT_LINK_INVALID = -1,
        !            50:     HT_LINK_NONE = 0,
        !            51:     HT_LINK_ERROR,
        !            52:     HT_LINK_OK
        !            53: } HTLinkResult;
        !            54: 
        !            55: struct _HTLink {
        !            56:     HTAnchor *         dest;              /* The anchor to which this leads */
        !            57:     HTLinkType         type;                      /* Semantics of this link */
        !            58:     HTMethod           method;            /* Method for this link, e.g. PUT */
        !            59:     HTLinkResult       result;    /* Result of any attempt to get this link */
        !            60: };
        !            61: 
        !            62: HTLink * HTLink_new (void);
        !            63: </PRE>
        !            64: <H3>
        !            65:   Delete a Link Object
        !            66: </H3>
        !            67: <P>
        !            68: A link can be removed as any other object
        !            69: <PRE>BOOL HTLink_delete (HTLink * link);
        !            70: </PRE>
        !            71: <H3>
        !            72:   Remove All Link Information from an Anchor
        !            73: </H3>
        !            74: <P>
        !            75: This is normally a part of deleting anchor objects.
        !            76: <PRE>extern BOOL HTLink_removeAll (HTAnchor * me);
        !            77: </PRE>
        !            78: <H2>
        !            79:   Handle Link Between Anchors
        !            80: </H2>
        !            81: <P>
        !            82: As mentioned, link objects are the ones that bind anchor objects together
        !            83: in a Web like structure
        !            84: <H3>
        !            85:   Add a Link between two Anchors
        !            86: </H3>
        !            87: <P>
        !            88: This method creates a new link between two <A HREF="HTAnchor.html">anchor
        !            89: objects</A>.
        !            90: <PRE>extern BOOL HTLink_add (HTAnchor *        source,
        !            91:                             HTAnchor * destination, 
        !            92:                             HTLinkType type,
        !            93:                             HTMethod   method);
        !            94: </PRE>
        !            95: <H3>
        !            96:   Remove All Links Between two Anchors
        !            97: </H3>
        !            98: <P>
        !            99: Removes link information from one anchor to another.
        !           100: <PRE>extern BOOL HTLink_remove (HTAnchor * source, HTAnchor * destination);
        !           101: </PRE>
        !           102: <H3>
        !           103:   Find a Link
        !           104: </H3>
        !           105: <P>
        !           106: Find the anchor object between a destination and a source ancher. Return
        !           107: link object if any, else NULL
        !           108: <PRE>extern HTLink * HTLink_find (HTAnchor * source, HTAnchor * destination);
        !           109: </PRE>
        !           110: <H2>
        !           111:   Link Information
        !           112: </H2>
        !           113: <P>
        !           114: This is the set of methods for accessing the information carried by a link
        !           115: object
        !           116: <H3>
        !           117:   Link Destination
        !           118: </H3>
        !           119: <P>
        !           120: The link destination is the destination anchor pointed to by the link.
        !           121: <PRE>extern BOOL HTLink_setDestination (HTLink * link, HTAnchor * dest);
        !           122: extern HTAnchor * HTLink_destination (HTLink * link);
        !           123: </PRE>
        !           124: <H3>
        !           125:   Link Types and Semantic Links
        !           126: </H3>
        !           127: <P>
        !           128: Each link has a sematic representation associated with it. This means that
        !           129: the application can distinguish between pages based on the semantics of the
        !           130: link. This is very similar to the <CODE>LINK</CODE> tag in HTML pages which
        !           131: indicates the meaning if this pages to other pages.
        !           132: <PRE>extern BOOL HTLink_setType (HTLink * link, HTLinkType type);
        !           133: extern HTLinkType HTLink_type (HTLink * link);
        !           134: </PRE>
        !           135: <H3>
        !           136:   Link Method
        !           137: </H3>
        !           138: <P>
        !           139: The link method is the HTTP method we have performed between the two links.
        !           140: For example, it can be a POST operation, or a PUT operation where the operation
        !           141: on the first anchor created a new anchor.
        !           142: <PRE>extern BOOL HTLink_setMethod (HTLink * link, HTMethod method);
        !           143: extern HTMethod HTLink_method (HTLink * link);
        !           144: </PRE>
        !           145: <H3>
        !           146:   Link Result
        !           147: </H3>
        !           148: <P>
        !           149: When a link has been used for posting an object from a source to a destination
        !           150: link, the result of the operation is stored as part of the link information.
        !           151: This means that we can keep track of which operations we have performed on
        !           152: a link and hence the application can ask the user whether he or she wants
        !           153: to do a re-post, for example.
        !           154: <PRE>
        !           155: extern BOOL HTLink_setResult (HTLink * link, HTLinkResult result);
        !           156: extern HTLinkResult HTLink_result (HTLink * link);
        !           157: </PRE>
        !           158: <PRE>
        !           159: #endif /* HTLINK_H */
        !           160: </PRE>
        !           161: <P>
        !           162:   <HR>
        !           163: <ADDRESS>
        !           164:   @(#) $Id: HTAnchor.html,v 2.43 1996/06/03 19:25:02 eric Exp $
        !           165: </ADDRESS>
        !           166: </BODY></HTML>

Webmaster