home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / extra / ustdio / uscanset.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  2.4 KB  |  81 lines

  1. /*
  2. *******************************************************************************
  3. *                                                                             *
  4. * COPYRIGHT:                                                                  *
  5. *   (C) Copyright International Business Machines Corporation, 1999           *
  6. *   Licensed Material - Program-Property of IBM - All Rights Reserved.        *
  7. *   US Government Users Restricted Rights - Use, duplication, or disclosure   *
  8. *   restricted by GSA ADP Schedule Contract with IBM Corp.                    *
  9. *                                                                             *
  10. *******************************************************************************
  11. *
  12. * File uscanset.h
  13. *
  14. * Modification History:
  15. *
  16. *   Date        Name        Description
  17. *   12/03/98    stephen        Creation.
  18. *   03/12/99    stephen     Modified for new C API.
  19. *******************************************************************************
  20. */
  21.  
  22. #ifndef USCANSET_H
  23. #define USCANSET_H
  24.  
  25. #include "utypes.h"
  26.  
  27.  
  28. /**
  29.  * Simple struct for a scanset pair, ie a-z or A-Z
  30.  */
  31. struct u_scanf_scanset_pair {
  32.   UChar start;
  33.   UChar end;
  34. };
  35. typedef struct u_scanf_scanset_pair u_scanf_scanset_pair;
  36.  
  37. #define U_SCANF_MAX_SCANSET_SIZE 512
  38.  
  39. /**
  40.  * Struct representing a scanset
  41.  */
  42. struct u_scanf_scanset {
  43.   bool_t        is_inclusive;    /* false if '^' is given */
  44.  
  45.   UChar            singles        [U_SCANF_MAX_SCANSET_SIZE];
  46.   u_scanf_scanset_pair     pairs         [U_SCANF_MAX_SCANSET_SIZE];
  47.  
  48.   int32_t        single_count;    /* count of single chars in set */
  49.   int32_t        pair_count;     /* count of pairs in set */
  50. };
  51. typedef struct u_scanf_scanset u_scanf_scanset;
  52.  
  53. /**
  54.  * Init a u_scanf_scanset.
  55.  * @param scanset A pointer to the u_scanf_scanset to init.
  56.  * @param s A pointer to the first character in the scanset
  57.  * @param len On input, a pointer to the length of <TT>s</TT>.  On output,
  58.  * a pointer to the number of characters parsed, excluding the final ']'
  59.  * @return TRUE if successful, FALSE otherwise.
  60.  */
  61. bool_t
  62. u_scanf_scanset_init(u_scanf_scanset     *scanset,
  63.              const UChar    *s,
  64.              int32_t        *len);
  65.  
  66. /**
  67.  * Determine if a UChar is in a u_scanf_scanset
  68.  * @param scanset A pointer to a u_scanf_scanset
  69.  * @param c The UChar to test.
  70.  * @return TRUE if the UChar is in the scanset, FALSE otherwise
  71.  */
  72. bool_t
  73. u_scanf_scanset_in(u_scanf_scanset     *scanset,
  74.            UChar         c);
  75.  
  76. #endif
  77.  
  78.  
  79.  
  80.  
  81.