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