HTHist.h
Upload User: zlh9724
Upload Date: 2007-01-04
Package Size: 1991k
Code Size: 5k
Category:

Browser Client

Development Platform:

Unix_Linux

  1. /*                                                                             History module
  2.                                      HISTORY MANAGER
  3.                                              
  4.  */
  5. /*
  6. **      (c) COPYRIGHT MIT 1995.
  7. **      Please first read the full copyright statement in the file COPYRIGH.
  8. */
  9. /*
  10.    This is a simple history module for a WWW client.  It keeps a linear history, with a
  11.    destructive or non-destructive backtrack, and list sequencing (previous, next)
  12.    operations.
  13.    
  14.    If you are building a client, you don't have to use this: just don't call it.  This
  15.    module is not used by any other modules in the libwww, so if you don't refer to it you
  16.    don't get it in your linked application.
  17.    
  18.    This module is implemented by HTHist.c, and it is a part of the W3C Reference Library.
  19.    
  20.  */
  21. #ifndef HTHISTORY_H
  22. #define HTHISTORY_H
  23. #include "HTAnchor.h"
  24. /*
  25. Creation and Deletion Methods
  26.    The history module can handle multiple history lists which can be useful in a
  27.    multithreaded environment with several open windows in the client application. A new
  28.    histrory lidt is referenced by the handle returned from the creation method.
  29.    
  30.  */
  31. typedef struct _HTHistory HTHistory;
  32. extern HTHistory *HTHistory_new         (void);
  33. extern BOOL HTHistory_delete            (HTHistory *old);
  34. /*
  35. Add and delete History Elements
  36.   RECORD AN ENTRY IN A LIST
  37.   
  38.    Registers the object in the linear list. The first entry is the home page. No check is
  39.    done for duplicates.  Returns YES if ok, else NO
  40.    
  41.  */
  42. extern BOOL HTHistory_record            (HTHistory *hist, HTAnchor *cur);
  43. /*
  44.   REPLACE LIST WITH NEW ELEMENT
  45.   
  46.    Iserts the new element at the current position and removes all any old list from
  47.    current position. For example if c is cur pos
  48.    
  49.       before: a b c d e
  50.       
  51.       after : a b f
  52.       
  53.    Returns YES if ok, else NO
  54.    
  55.  */
  56. extern BOOL HTHistory_replace           (HTHistory *hist, HTAnchor *cur);
  57. /*
  58.   DELETE LAST ENTRY IN A LIST
  59.   
  60.    Deletes the last object from the list Returns YES if OK, else NO
  61.    
  62.  */
  63. extern BOOL HTHistory_removeLast        (HTHistory *hist);
  64. /*
  65.   REMOVE THE HISTORY LIST FROM POSITION
  66.   
  67.    Deletes the history list FROM the entry at position 'cur' (excluded). Home page has
  68.    position 1.  Returns YES if OK, else NO
  69.    
  70.  */
  71. extern BOOL HTHistory_removeFrom        (HTHistory *hist, int pos);
  72. /*
  73.   NUMBER OF ELEMENTS STORED
  74.   
  75.    Returns the size of the history list or -1 if none.
  76.    
  77.  */
  78. extern int HTHistory_count              (HTHistory *hist);
  79. /*
  80.   CURRENT POSITION
  81.   
  82.    Returns the current position or -1 on error
  83.    
  84.  */
  85. extern int HTHistory_position           (HTHistory *hist);
  86. /*
  87.   FIND AND RE-REGISTER VISITED ANCHOR
  88.   
  89.    Finds already registered anchor at given position and registers it again EXCEPT if last
  90.    entry. This allows for `circular' history lists with duplicate entries. Position 1 is
  91.    the home anchor. The current position is updated.
  92.    
  93.  */
  94. extern HTAnchor * HTHistory_recall      (HTHistory *hist, int pos);
  95. /*
  96.   FIND ENTRY AT POSITION
  97.   
  98.    Entry with the given index in the list (1 is the home page). Like HTHistory_recall but
  99.    without re-registration. Un success, the current position is updated to the value 'pos'
  100.    value.
  101.    
  102.  */
  103. extern HTAnchor * HTHistory_find        (HTHistory *hist, int pos);
  104. /*
  105.   LIST THE HISTORY LIST
  106.   
  107.    This function is like HTHistory_find() but does not update the current position
  108.    
  109.  */
  110. extern HTAnchor * HTHistory_list        (HTHistory *hist, int pos);
  111. /*
  112. Navigation
  113.   CAN WE BACK IN HISTORY
  114.   
  115.    Returns YES if the current anchor is not the first entry (home page)
  116.    
  117.  */
  118. extern BOOL HTHistory_canBacktrack      (HTHistory *hist);
  119. /*
  120.   BACKTRACK WITH DELETION
  121.   
  122.    Returns the previous object and erases the last object. This does not allow for
  123.    'forward' as we are always at the end of the list. If no previous object exists, NULL
  124.    is returned so that the application knows that no previous object was found. See also
  125.    HTHistory_back().
  126.    
  127.  */
  128. extern HTAnchor * HTHistory_backtrack   (HTHistory *hist);
  129. /*
  130.   BACKTRACK WITHOUT DELETION
  131.   
  132.    Returns the previos object but does not erase the last object. This does not allow for
  133.    'forward'. If no previous object exists, NULL is returned so that the application knows
  134.    that no previous object was found. See also HTHistory_backtrack()
  135.    
  136.  */
  137. extern HTAnchor * HTHistory_back        (HTHistory *hist);
  138. /*
  139.   CAN WE GO FORWARD
  140.   
  141.    Returns YES if the current anchor is not the last entry
  142.    
  143.  */
  144. extern BOOL HTHistory_canForward        (HTHistory *hist);
  145. /*
  146.   FORWARD
  147.   
  148.    Return the next object in the list or NULL if none
  149.    
  150.  */
  151. extern HTAnchor * HTHistory_forward     (HTHistory *hist);
  152. #endif /* HTHISTORY_H */
  153. /*
  154.     */