home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libpics / csll.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  6.1 KB  |  174 lines

  1.  
  2. /*  W3 Copyright statement 
  3. Copyright 1995 by: Massachusetts Institute of Technology (MIT), INRIA</H2>
  4.  
  5. This W3C software is being provided by the copyright holders under the
  6. following license. By obtaining, using and/or copying this software,
  7. you agree that you have read, understood, and will comply with the
  8. following terms and conditions: 
  9.  
  10. Permission to use, copy, modify, and distribute this software and its
  11. documentation for any purpose and without fee or royalty is hereby
  12. granted, provided that the full text of this NOTICE appears on
  13. <EM>ALL</EM> copies of the software and documentation or portions
  14. thereof, including modifications, that you make. 
  15.  
  16. <B>THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
  17. REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF EXAMPLE,
  18. BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR
  19. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
  20. THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
  21. THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
  22. COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE
  23. OR DOCUMENTATION.
  24.  
  25. The name and trademarks of copyright holders may NOT be used
  26. in advertising or publicity pertaining to the software without
  27. specific, written prior permission.  Title to copyright in this
  28. software and any associated documentation will at all times remain
  29. with copyright holders. 
  30. */
  31. /*                                                                   Label parser for libpics
  32.                                        LABEL PARSER
  33.                                              
  34.  */
  35. /*
  36. **      (c) COPYRIGHT MIT 1996.
  37. **      Please first read the full copyright statement in the file COPYRIGH.
  38. */
  39. /*
  40.  
  41.    This module provides the interface to CSLabel.c. Labels are parsed from strings (see
  42.    CSParse.html). These labels may then be kept in a CSLabel_t structure for inspection by
  43.    the application or compared to the values in a CSUser_t structure (see CSUser.html).
  44.    
  45.  */
  46. #ifndef CSLL_H
  47. #define CSLL_H
  48. /*
  49.  
  50.   State Change Enumeration
  51.   
  52.    Call to the TargetChangeCallback will have one of the following values.
  53.    
  54.  */
  55. typedef enum {
  56.         CSLLTC_LIST = 1,
  57.         CSLLTC_SERVICE,
  58.         CSLLTC_LABEL,
  59.         CSLLTC_LABTREE,
  60.         CSLLTC_SINGLE,
  61.         CSLLTC_RATING,
  62.         CSLLTC_RANGE,
  63.         CSLLTC_AWKWARD,
  64.         CSLLTC_NORAT,
  65.         CSLLTC_SRVERR,
  66.         CSLLTC_LABERR,
  67.         CSLLTC_EXTEN,
  68.         CSLLTC_EXTDATA,
  69.         CSLLTC_COUNT
  70. } CSLLTC_t;
  71. /*
  72.  
  73.   Data shell
  74.   
  75.    All PICS label data is stored in a CSLLData_t
  76.    
  77.  */
  78. typedef struct CSLLData_s CSLLData_t;
  79. #define CSLabel_labelNumber(S) (S->currentLabelNumber)
  80. /*
  81.  
  82.   TargetChangeCallback
  83.   
  84.    As the label is parsed, it will call the assigned TargetChangeCallback as it passes
  85.    from state to state.
  86.    
  87.  */
  88. typedef StateRet_t LabelTargetCallback_t(CSLabel_t * pCSLabel,
  89.                                          CSParse_t * pCSParse,
  90.                                          CSLLTC_t target, BOOL closed,
  91.                                          void * pVoid);
  92. /*
  93.  
  94.   ErrorHandler
  95.   
  96.    All parsing error will be passed to the Apps LLErrorHandler for user display or
  97.    automatic dismissal.
  98.    
  99.  */
  100. typedef StateRet_t LLErrorHandler_t(CSLabel_t * pCSLabel,
  101.                                     CSParse_t * pCSParse, const char * token,
  102.                                     char demark, StateRet_t errorCode);
  103. /*
  104.  
  105.   Construction/Destruction
  106.   
  107.    These methods allow the user to create and get access to both the label and the state.
  108.    CSLabels may be cloned so that one saves state while another continues to iterate or
  109.    parse. The states mus all be freed. Label data will only be freed after all the
  110.    CSLabels that refer to it are deleted.
  111.    
  112.  */
  113. extern CSParse_t * CSParse_newLabel(
  114.                             LabelTargetCallback_t * pLabelTargetCallback,
  115.                             LLErrorHandler_t * pLLErrorHandler);
  116. extern BOOL CSParse_deleteLabel(CSParse_t *);
  117. extern CSLabel_t * CSParse_getLabel(CSParse_t * me);
  118. extern CSLabel_t * CSLabel_copy(CSLabel_t * old);
  119. extern void CSLabel_free(CSLabel_t * me);
  120.  
  121. extern char * CSLabel_getServiceName(CSLabel_t * pCSLabel);
  122. extern int CSLabel_getLabelNumber(CSLabel_t * pCSLabel);
  123. extern char * CSLabel_getRatingName(CSLabel_t * pCSLabel);
  124. extern char * CSLabel_getRatingStr(CSLabel_t * pCSLabel);
  125. extern Range_t * CSLabel_getLabelRatingRange(CSLabel_t * pCSLabel);
  126. /*
  127.  
  128.   Iterating methods
  129.   
  130.   Callback function
  131.   
  132.    The Iterators are passed a callback function to be called for each matching element.
  133.    For instance, when iterating through ranges, the callback function is called once for
  134.    each range, or, if a match is requested, only for the matching range.
  135.    
  136.  */
  137. typedef CSError_t CSLabel_callback_t(CSLabel_t *, State_Parms_t *,
  138.                                              const char *, void * pVoid);
  139. typedef CSError_t CSLabel_iterator_t(CSLabel_t *,
  140.                                              CSLabel_callback_t *,
  141.                                              State_Parms_t *, const char *,
  142.                                              void * pVoid);
  143. /*
  144.  
  145.   Iterators
  146.   
  147.  */
  148. extern CSLabel_iterator_t CSLabel_iterateServices;
  149. extern CSLabel_iterator_t CSLabel_iterateLabels;
  150. extern CSLabel_iterator_t CSLabel_iterateSingleLabels;
  151. extern CSLabel_iterator_t CSLabel_iterateLabelRatings;
  152. /*
  153.  
  154.   Range Utilities
  155.   
  156.    These funtions allow the application to test the value of a given user parameter
  157.    against those in the label.
  158.    
  159.  */
  160. extern HTList * CSLLData_getAllSingleLabels(CSLabel_t * pCSLabel);
  161. extern FVal_t CSLabel_ratingsIncludeFVal(CSLabel_t * pCSLabel,
  162.                                            FVal_t * userValue);
  163. extern FVal_t CSLabel_ratingsIncludeRange(CSLabel_t * pCSLabel,
  164.                                             Range_t * pUserRange);
  165. extern FVal_t CSLabel_ratingsIncludeRanges(CSLabel_t * pCSLabel,
  166.                                              HTList * userRanges);
  167. /*
  168.  
  169.  */
  170. #endif /* CSLL_H */
  171. /*
  172.  
  173.    End of Declaration */
  174.