File:  [Public] / libwww / Library / src / HTHist.html
Revision 2.10: download - view: text, annotated - select for diffs
Thu Nov 16 18:23:12 1995 UTC (28 years, 6 months ago) by frystyk
Branches: MAIN
CVS tags: v4/0pre6, v4/0D, v4/0C, v4/0B, v4/0, autoconf, HEAD
pre and post callback

<HTML>
<HEAD>
<TITLE>History module</TITLE>
<!-- Changed by: Henrik Frystyk Nielsen, 15-Nov-1995 -->
</HEAD>
<BODY>

<H1>History Manager</H1>

<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>

This is a simple history module for a WWW client.  It keeps a linear
history, with a destructive <EM>or</EM> non-destructive backtrack, and
list sequencing (previous, next) operations.<P>

If you are building a client, you don't have to use this: just don't
call it.  This module is not used by any other modules in the libwww,
so if you don't refer to it you don't get it in your linked
application. <P>

This module is implemented by <A HREF="HTHist.c">HTHist.c</A>, and it
is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/">
W3C Reference Library</A>.

<PRE>
#ifndef HTHISTORY_H
#define HTHISTORY_H

#include "HTAnchor.h"
</PRE>

<H2>Creation and Deletion Methods</H2>

The history module can handle multiple history lists which can be
useful in a multithreaded environment with several open windows in the
client application. A new histrory lidt is referenced by the handle
returned from the creation method.

<PRE>
typedef struct _HTHistory HTHistory;

extern HTHistory *HTHistory_new		(void);
extern BOOL HTHistory_delete		(HTHistory *old);
</PRE>

<H2>Add and delete History Elements</H2>

<H3>Record an entry in a list</H3>

Registers the object in the linear list. The first entry is the home
page. No check is done for duplicates.  Returns YES if ok, else NO

<PRE>
extern BOOL HTHistory_record		(HTHistory *hist, HTAnchor *cur);
</PRE>

<H3>Replace list with new element</H3>

Iserts the new element at the current position and removes all any
old list from current position. For example if c is cur pos
<UL>
<LI>before: a b c d e
<LI>after : a b f
</UL>
Returns YES if ok, else NO

<PRE>
extern BOOL HTHistory_replace		(HTHistory *hist, HTAnchor *cur);
</PRE>

<H3>Delete last entry in a list</H3>

Deletes the last object from the list Returns YES if OK, else NO

<PRE>
extern BOOL HTHistory_removeLast 	(HTHistory *hist);
</PRE>

<H3>Remove the History list from position</H3>

Deletes the history list FROM the entry at position 'cur' (excluded).
Home page has position 1.  Returns YES if OK, else NO

<PRE>
extern BOOL HTHistory_removeFrom 	(HTHistory *hist, int pos);
</PRE>

<H3>Number of elements stored</H3>

Returns the size of the history list or -1 if none.

<PRE>
extern int HTHistory_count		(HTHistory *hist);
</PRE>

<H3>Current Position</H3>

Returns the current position or -1 on error

<PRE>
extern int HTHistory_position		(HTHistory *hist);
</PRE>

<H3>Find and re-register visited anchor</H3>

Finds already registered anchor at given position and registers it
again EXCEPT if last entry. This allows for `circular' history lists
with duplicate entries. Position 1 is the home anchor. The current
position <EM>is</EM> updated.

<PRE>
extern HTAnchor * HTHistory_recall 	(HTHistory *hist, int pos);
</PRE>

<H3>Find Entry at position</H3>

Entry with the given index in the list (1 is the home page). Like
<CODE>HTHistory_recall</CODE> but without re-registration. Un success,
the current position <EM>is</EM> updated to the value 'pos' value.

<PRE>
extern HTAnchor * HTHistory_find 	(HTHistory *hist, int pos);
</PRE>

<H3>List the History List</H3>

This function is like <CODE>HTHistory_find()</CODE> but <EM>does
not</EM> update the current position

<PRE>
extern HTAnchor * HTHistory_list	(HTHistory *hist, int pos);
</PRE>

<H2>Navigation</H2>

<H3>Can we back in history</H3>

Returns YES if the current anchor is not the first entry (home page)

<PRE>
extern BOOL HTHistory_canBacktrack 	(HTHistory *hist);
</PRE>

<H3>Backtrack with deletion</H3>

Returns the previous object and erases the last object. This does not
allow for 'forward' as we are always at the end of the list. If no
previous object exists, NULL is returned so that the application knows
that no previous object was found. See also HTHistory_back().

<PRE>
extern HTAnchor * HTHistory_backtrack 	(HTHistory *hist);
</PRE>

<H3>Backtrack without deletion</H3>

Returns the previos object but does not erase the last object. This
does not allow for 'forward'. If no previous object exists, NULL is
returned so that the application knows that no previous object was
found. See also HTHistory_backtrack()

<PRE>
extern HTAnchor * HTHistory_back 	(HTHistory *hist);
</PRE>

<H3>Can we go forward</H3>

Returns YES if the current anchor is not the last entry

<PRE>
extern BOOL HTHistory_canForward 	(HTHistory *hist);
</PRE>

<H3>Forward</H3>

Return the next object in the list or NULL if none

<PRE>
extern HTAnchor * HTHistory_forward 	(HTHistory *hist);

#endif /* HTHISTORY_H */
</PRE>
</BODY>
</HTML>

Webmaster