/* ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. */An anchor represents a region of a hypertext document which is linked to another anchor in the same or a different document. As always we must emulate the fancy features of C++ by hand :-(. In this module you find:
#ifndef HTANCHOR_H #define HTANCHOR_H #include "HTList.h" #include "HTAtom.h"
typedef struct _HyperDoc HyperDoc; /* Ready for forward references */ typedef struct _HTAnchor HTAnchor; typedef struct _HTParentAnchor HTParentAnchor; typedef struct _HTChildAnchor HTChildAnchor;Must be AFTER definition of HTAnchor:
#include "HTFormat.h" typedef HTAtom HTLinkType; typedef struct { HTAnchor * dest; /* The anchor to which this leads */ HTLinkType * type; /* Semantics of this link */ } HTLink;
struct _HTAnchor { HTLink mainLink; /* Main (or default) destination of this */ HTList * links; /* List of extra links from this, if any */ HTParentAnchor * parent; /* Parent of this anchor (self for adults) */ };
struct _HTParentAnchor { /* Common part from the generic anchor structure */ HTLink mainLink; /* Main (or default) destination of this */ HTList * links; /* List of extra links from this, if any */ HTParentAnchor * parent; /* Parent of this anchor (self) */ /* ParentAnchor-specific information */ HTList * children; /* Subanchors of this, if any */ HTList * sources; /* List of anchors pointing to this, if any */ HyperDoc * document; /* The document within this is an anchor */ void * protocol; /* Protocol object */ char * physical; /* Physical address */ HTList * cacheItems ; /* Cache hits (see HTFWriter ) for this URL */ char * address; /* Absolute address of this node */ BOOL isIndex; /* Acceptance of a keyword search */ /* Entity header fields */ BOOL header_parsed; /* Are we done parsing? */ char * title; int methods; /* Allowed methods (bit-flag) */ HTEncoding content_encoding; HTLanguage content_language; /* @@@ SHOULD BE LIST @@@ */ long int content_length; HTCte cte; /* Content-Transfer-Encoding */ HTFormat content_type; HTCharset charset; /* Parameter to content-type */ HTLevel level; /* Parameter to content-type `text/html' */ time_t date; /* When was the request issued */ time_t expires; /* When does the copy expire */ time_t last_modified; char * derived_from; /* Opaque string */ char * version; /* Opaque string */ /* List of unknown headers coming in from the network. Use the field in the request structure for sending test headers. */ HTList * extra_headers; };
struct _HTChildAnchor { /* Common part from the generic anchor structure */ HTLink mainLink; /* Main (or default) destination of this */ HTList * links; /* List of extra links from this, if any */ HTParentAnchor * parent; /* Parent of this anchor */ /* ChildAnchor-specific information */ char * tag; /* Address of this anchor relative to parent */ };
extern HTAnchor * HTAnchor_findAddress PARAMS((CONST char * address));
extern HTChildAnchor * HTAnchor_findChild PARAMS((HTParentAnchor *parent, CONST char * tag));
extern HTChildAnchor * HTAnchor_findChildAndLink PARAMS((HTParentAnchor * parent, /* May not be 0 */ CONST char * tag, /* May be "" or 0 */ CONST char * href, /* May be "" or 0 */ HTLinkType * ltype)); /* May be 0 */
extern BOOL HTAnchor_delete PARAMS((HTParentAnchor *me));
HyperDoc
s found while doing it. The application may keep
its own list of HyperDoc
s, but this function returns it
anyway. It is always for the application to delete any
HyperDoc
s. Return YES if OK, else NO. Note: This function is different from cleaning up the history list!
extern BOOL HTAnchor_deleteAll PARAMS((HTList * objects));
extern BOOL HTAnchor_link PARAMS((HTAnchor *source, HTAnchor *destination, HTLinkType *type));
extern HTAnchor * HTAnchor_followMainLink PARAMS((HTAnchor *me));
extern HTAnchor * HTAnchor_followTypedLink PARAMS((HTAnchor *me, HTLinkType *type));
extern BOOL HTAnchor_makeMainLink PARAMS((HTAnchor *me, HTLink *movingLink));
extern void HTAnchor_makeLastChild PARAMS((HTChildAnchor *me));
extern HTParentAnchor * HTAnchor_parent PARAMS((HTAnchor *me));
extern BOOL HTAnchor_hasChildren PARAMS((HTParentAnchor *me));
extern void HTAnchor_setDocument PARAMS((HTParentAnchor *me, HyperDoc * doc));
extern HyperDoc * HTAnchor_document PARAMS((HTParentAnchor *me));
extern char * HTAnchor_address PARAMS((HTAnchor *me));
extern char * HTAnchor_physical PARAMS((HTParentAnchor * me)); extern void HTAnchor_setPhysical PARAMS((HTParentAnchor * me, char * protocol));
extern void HTAnchor_clearIndex PARAMS((HTParentAnchor *me)); extern void HTAnchor_setIndex PARAMS((HTParentAnchor *me)); extern BOOL HTAnchor_isIndex PARAMS((HTParentAnchor *me));
extern void * HTAnchor_protocol PARAMS((HTParentAnchor * me)); extern void HTAnchor_setProtocol PARAMS((HTParentAnchor * me, void* protocol));
extern CONST char * HTAnchor_title PARAMS((HTParentAnchor *me)); extern void HTAnchor_setTitle PARAMS((HTParentAnchor *me, CONST char * title)); extern void HTAnchor_appendTitle PARAMS((HTParentAnchor *me, CONST char * title));
extern HTFormat HTAnchor_format PARAMS((HTParentAnchor *me)); extern void HTAnchor_setFormat PARAMS((HTParentAnchor *me, HTFormat form));
extern HTCharset HTAnchor_charset PARAMS((HTParentAnchor *me)); extern void HTAnchor_setCharset PARAMS((HTParentAnchor *me, HTCharset charset));
extern HTLevel HTAnchor_level PARAMS((HTParentAnchor * me)); extern void HTAnchor_setLevel PARAMS((HTParentAnchor * me, HTLevel level));
extern HTLanguage HTAnchor_language PARAMS((HTParentAnchor *me)); extern void HTAnchor_setLanguage PARAMS((HTParentAnchor *me, HTLanguage language));
extern HTEncoding HTAnchor_encoding PARAMS((HTParentAnchor *me)); extern void HTAnchor_setEncoding PARAMS((HTParentAnchor *me, HTEncoding encoding));
extern HTCte HTAnchor_cte PARAMS((HTParentAnchor *me)); extern void HTAnchor_setCte PARAMS((HTParentAnchor *me, HTCte cte));
extern long int HTAnchor_length PARAMS((HTParentAnchor *me)); extern void HTAnchor_setLength PARAMS((HTParentAnchor *me, long int length));
extern int HTAnchor_methods PARAMS((HTParentAnchor *me)); extern void HTAnchor_setMethods PARAMS((HTParentAnchor *me, int methodset)); extern void HTAnchor_appendMethods PARAMS((HTParentAnchor *me, int methodset));
extern CONST char * HTAnchor_version PARAMS((HTParentAnchor *me)); extern void HTAnchor_setVersion PARAMS((HTParentAnchor *me, CONST char * version));
extern CONST char * HTAnchor_derived PARAMS((HTParentAnchor *me)); extern void HTAnchor_setDerived PARAMS((HTParentAnchor *me, CONST char * derived_from));
HTAnchor_addExtra()
function to extra headers here, but
use the field in the request structure
for sending test headers.
extern HTList * HTAnchor_Extra PARAMS((HTParentAnchor *me)); extern void HTAnchor_addExtra PARAMS((HTParentAnchor *me, CONST char * header));
extern BOOL HTAnchor_headerParsed PARAMS((HTParentAnchor *me));
extern void HTAnchor_clearHeader PARAMS((HTParentAnchor *me)); #endif /* HTANCHOR_H */